diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..e30577e
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: bdhoine,royteeuwen
\ No newline at end of file
diff --git a/.github/workflows/analyse.yml b/.github/workflows/analyse.yml
new file mode 100644
index 0000000..bc9f520
--- /dev/null
+++ b/.github/workflows/analyse.yml
@@ -0,0 +1,39 @@
+name: Analyse
+
+on: [ push, pull_request ]
+
+jobs:
+ sonar:
+ name: SonarCloud
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Setup Java
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 17
+
+ - name: Cache local Maven repository
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+
+ - name: Build and analyze
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..d43edd6
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,32 @@
+name: Build
+
+on: [ push, pull_request ]
+
+jobs:
+ build:
+ name: Maven build
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Setup Java
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 17
+
+ - name: Cache local Maven repository
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ - name: Build
+ run: mvn --batch-mode --update-snapshots install
+
+ - name: Integration Tests
+ run: mvn install -Pit
\ No newline at end of file
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..897c539
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,107 @@
+name: Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ central:
+ description: 'Release to Maven Central'
+ required: false
+ default: true
+ type: boolean
+ github:
+ description: 'Create GitHub release'
+ required: false
+ default: true
+ type: boolean
+ push:
+ description: 'Push changes'
+ required: false
+ default: true
+ type: boolean
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ name: Maven and GitHub release
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Cache local Maven repository
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ - name: Set up Java with Maven Central Repository
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'zulu'
+ java-version: 17
+ server-id: ossrh
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+
+ - name: Remove SNAPSHOT from version
+ run: mvn --batch-mode versions:set -DremoveSnapshot versions:commit
+
+ - name: Set RELEASE_VERSION env variable
+ run: |
+ echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
+
+ - name: Update CHANGELOG.md
+ if: ${{ inputs.push }}
+ uses: thomaseizinger/keep-a-changelog-new-release@v1
+ with:
+ version: ${{ env.RELEASE_VERSION }}
+
+ - name: Get release info
+ id: changelog
+ uses: release-flow/keep-a-changelog-action/get-release-info@v1
+
+ - name: Deploy package
+ if: ${{ inputs.central }}
+ run: mvn --batch-mode deploy --activate-profiles release
+ env:
+ MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
+
+ - name: Commit and push release
+ if: ${{ inputs.push }}
+ uses: stefanzweifel/git-auto-commit-action@v4
+ with:
+ commit_message: "Create release ${{ steps.changelog.outputs.release-version }}"
+ tagging_message: ${{ steps.changelog.outputs.release-version }}
+
+ - name: Create release
+ if: ${{ inputs.github }}
+ uses: softprops/action-gh-release@v1
+ with:
+ name: ${{ steps.update-changelog.outputs.release-version }}
+ tag_name: ${{ steps.changelog.outputs.release-version }}
+ files: all/target/aem-groovy-console-all-*.zip
+ body: ${{ steps.changelog.outputs.release-notes }}
+
+ - name: Next SNAPSHOT version
+ if: ${{ inputs.push }}
+ run: mvn --batch-mode versions:set -DnextSnapshot versions:commit
+
+ - name: Set RELEASE_VERSION env variable
+ if: ${{ inputs.push }}
+ run: |
+ echo "RELEASE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
+
+ - name: Commit and push development version
+ if: ${{ inputs.push }}
+ uses: stefanzweifel/git-auto-commit-action@v4
+ with:
+ commit_message: "Bump development version to ${{ env.RELEASE_VERSION }}"
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..71ebab9
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,10 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+- Initial release of the log method weaving hook
\ No newline at end of file
diff --git a/README.md b/README.md
index d0d36cf..ba2787c 100644
--- a/README.md
+++ b/README.md
@@ -15,8 +15,7 @@ Example, search for your classname, method name and amount of parameters you wan
```json
{
"className": "my.package.MyClass",
- "methodName": "doGet",
- "amountOfParameters": 2
+ "methodName": "doGet"
}
```
@@ -24,4 +23,4 @@ To make the weaving hook work, either a framework restart of an entire java proc
## Future
-- Add weaving hooks to create custom spans and metrics using OpenTelemetry
\ No newline at end of file
+- Add weaving hooks to create custom spans and metrics using OpenTelemetry
diff --git a/pom.xml b/pom.xml
index f7f5d71..de5b9dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,44 +8,216 @@
be.orbinson.sling
sling-observability-weavinghooks
- bundle
0.0.1-SNAPSHOT
Sling Observability Weaving Hooks
+ Library of weaving hooks to ease the process of observability in out-of-the-box code
+
+ https://github.com/orbinson/sling-observability-weavinghooks
+
+
+
+ Barry d'Hoine
+ barrydhoine@gmail.com
+ bdhoine
+
+
+ Roy Teeuwen
+ roy@orbinson.be
+ royteeuwen
+
+
+
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0
+ repo
+
+
+
+
+ scm:git:https://github.com/orbinson/sling-observability-weavinghooks.git
+ scm:git:https://github.com/orbinson/sling-observability-weavinghooks.git
+ https://github.com/orbinson/sling-observability-weavinghooks.git
+
+
+
+ GitHub
+ https://github.com/orbinson/sling-observability-weavinghooks/issues
+
+
+
+
+ ossrh
+ Central Repository OSSRH - Snapshots
+ https://s01.oss.sonatype.org/content/repositories/snapshots
+
+
+ ossrh
+ Central Repository OSSRH
+ https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/
+
+
+
+
+ localhost
+ 8080
+ admin
+ admin
+
+ orbinson
+ ${sonar.organization}_${project.artifactId}
+ https://sonarcloud.io
+ **/target/site/jacoco
+
- org.apache.felix
- maven-bundle-plugin
- 5.1.9
- true
+ org.apache.maven.plugins
+ maven-release-plugin
+ 3.0.1
- ${basedir}/target/classes
-
- ${project.artifactId}
- ${project.version}
- asm,asm-util,asm-tree,asm-analysis
-
+ [maven-scm] :
+ clean install
+ install
+ release
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.3.0
+ true
+
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+ prepare-agent
+
+ prepare-agent
+
+
+
+ report
+
+ report
+
+
+
+
org.apache.maven.plugins
maven-compiler-plugin
+ 3.12.1
1.8
1.8
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+
+
+ biz.aQute.bnd
+ bnd-maven-plugin
+ 6.4.0
+
+
+ bnd-process
+
+ bnd-process
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+ ${project.build.outputDirectory}/META-INF/MANIFEST.MF
+
+
+
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.7
+ true
+
+ ossrh
+ https://s01.oss.sonatype.org/
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 1.6
+
+
+ deploy
+
+ sign
+
+
+
+
+
+
+ --pinentry-mode
+ loopback
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.4.1
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.2.1
+
+
+ attach-sources
+
+ jar-no-fork
+
+
+
+
+
+
-
- localhost
- 8080
- admin
- admin
-
@@ -76,6 +248,156 @@
+
+ it
+
+
+
+
+ biz.aQute.bnd
+ bnd-maven-plugin
+ 6.4.0
+ true
+
+
+ test-jar
+
+ test-jar
+
+
+
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.2.0
+
+
+ reserve-network-port
+
+ reserve-network-port
+
+ process-resources
+
+
+ http.port
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+ 3.1.2
+
+
+ install-to-local-repo
+
+ install
+
+ pre-integration-test
+
+
+
+
+ org.apache.sling
+ slingfeature-maven-plugin
+ 1.8.4
+ true
+
+ true
+
+
+
+
+ attach-features
+
+
+
+
+
+ org.apache.sling
+ feature-launcher-maven-plugin
+ 0.1.6
+
+
+
+ model
+ ${skipTests}
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+ test
+ slingosgifeature
+
+
+
+
+ ${http.port}
+
+
+
+
+
+
+ 180
+
+
+
+
+
+
+ start
+ stop
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 3.3.1
+
+
+ ${http.port}
+ ${project.build.directory}/../build.log
+
+
+
+
+
+ integration-test
+ verify
+
+
+
+
+
+
+
+
+ release
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+
@@ -134,5 +456,19 @@
5.10.2
test
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.14
+ test
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ test
+
+
+
diff --git a/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHook.java b/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHook.java
index 732fb54..ab2df5e 100644
--- a/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHook.java
+++ b/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHook.java
@@ -19,13 +19,13 @@ public class LogMethodWeavingHook implements WeavingHook {
private final String className;
private final String methodName;
private final String logLevel;
- private final boolean enableTraceVisitor;
+ private final boolean showGeneratedBytecode;
public LogMethodWeavingHook(LogMethodWeavingHookConfiguration config) {
this.className = config.getClassName();
this.methodName = config.getMethodName();
this.logLevel = config.getLogLevel();
- this.enableTraceVisitor = config.isEnableTraceVisitor();
+ this.showGeneratedBytecode = config.isShowGeneratedBytecode();
}
@Override
@@ -41,7 +41,7 @@ private void addLogMethodToClass(WovenClass wovenClass) {
final ClassReader cr = new ClassReader(wovenClass.getBytes());
final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
ClassVisitor logMethodClassVisitor;
- if (enableTraceVisitor) {
+ if (showGeneratedBytecode) {
StringWriter out = new StringWriter();
final TraceClassVisitor tcv = new TraceClassVisitor(cw, new PrintWriter(out));
logMethodClassVisitor = new LogMethodClassVisitor(tcv, className, methodName, logLevel);
@@ -62,4 +62,4 @@ private void addDynamicImports(WovenClass wovenClass) {
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHookConfiguration.java b/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHookConfiguration.java
index d0adf09..564bd9a 100644
--- a/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHookConfiguration.java
+++ b/src/main/java/be/orbinson/sling/observability/weavinghooks/logmethod/LogMethodWeavingHookConfiguration.java
@@ -30,20 +30,20 @@ public class LogMethodWeavingHookConfiguration {
String logLevel() default "info";
@AttributeDefinition(description = "Enable the trace visitor to show what the generated byte code is")
- boolean enableTraceVisitor() default false;
+ boolean showGeneratedBytecode() default false;
}
private String className;
private String methodName;
private String logLevel;
- private boolean enableTraceVisitor;
+ private boolean showGeneratedBytecode;
@Activate
void activate(Config config) {
this.className = config.className();
this.methodName = config.methodName();
this.logLevel = config.logLevel();
- this.enableTraceVisitor = config.enableTraceVisitor();
+ this.showGeneratedBytecode = config.showGeneratedBytecode();
}
public String getClassName() {
@@ -58,7 +58,7 @@ public String getLogLevel() {
return logLevel;
}
- public boolean isEnableTraceVisitor() {
- return enableTraceVisitor;
+ public boolean isShowGeneratedBytecode() {
+ return showGeneratedBytecode;
}
}
diff --git a/src/test/features/model.json b/src/test/features/model.json
new file mode 100644
index 0000000..30881d5
--- /dev/null
+++ b/src/test/features/model.json
@@ -0,0 +1,123 @@
+{
+ "id": "${project.groupId}:${project.artifactId}:model:test:${project.version}",
+ "bundles": [
+ // OSGi
+ {
+ "id": "org.osgi:org.osgi.util.promise:1.1.1",
+ "start-order": "1"
+ },
+ {
+ "id": "org.osgi:org.osgi.util.function:1.1.0",
+ "start-order": "1"
+ },
+ {
+ "id": "org.osgi:org.osgi.util.converter:1.0.1",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.felix:org.apache.felix.scr:2.1.20",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.commons:commons-lang3:3.9",
+ "start-order": "1"
+ },
+ {
+ "id": "commons-fileupload:commons-fileupload:1.4",
+ "start-order": "1"
+ },
+ {
+ "id": "commons-io:commons-io:2.6",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.felix:org.apache.felix.webconsole:4.5.0",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.felix:org.apache.felix.configadmin:1.9.16",
+ "start-order": "1"
+ },
+ // Logging
+ {
+ "id": "org.slf4j:jcl-over-slf4j:1.7.25",
+ "start-order": "1"
+ },
+ {
+ "id": "org.slf4j:log4j-over-slf4j:1.7.25",
+ "start-order": "1"
+ },
+ {
+ "id": "org.slf4j:slf4j-api:1.7.25",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.felix:org.apache.felix.log:1.2.2",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.sling:org.apache.sling.commons.log:5.1.12",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.sling:org.apache.sling.commons.logservice:1.1.0",
+ "start-order": "1"
+ },
+ {
+ "id": "org.apache.sling:org.apache.sling.commons.log.webconsole:1.0.0",
+ "start-order": "5"
+ },
+ // Servlet API for IT tests
+ {
+ "id": "org.apache.felix:org.apache.felix.http.servlet-api:1.1.2",
+ "start-order": "5"
+ },
+ {
+ "id": "org.apache.felix:org.apache.felix.http.jetty:4.0.16",
+ "start-order": "5"
+ },
+ // Actual project
+ {
+ "id": "${project.groupId}:${project.artifactId}:${project.version}",
+ "start-order": 1
+ },
+ // Test OSGI servlet. Feature model only use a new version if the project succesfully compiled (so -DskipTests might be required)
+ {
+ "id": "${project.groupId}:${project.artifactId}:jar:tests:${project.version}",
+ "start-order": "5"
+ }
+ ],
+ "configurations": {
+ "org.apache.sling.commons.log.LogManager.factory.config~error.log": {
+ "org.apache.sling.commons.log.level": "info",
+ "org.apache.sling.commons.log.file": "logs/error.log",
+ "org.apache.sling.commons.log.names": [
+ "org.apache"
+ ]
+ },
+ "org.apache.sling.commons.log.LogManager.factory.config~weavinghook.log": {
+ "org.apache.sling.commons.log.level": "debug",
+ "org.apache.sling.commons.log.file": "logs/weavinghook.log",
+ "org.apache.sling.commons.log.names": [
+ "be.orbinson.sling.observability.weavinghooks"
+ ]
+ },
+ "org.apache.sling.commons.log.LogManager.factory.config~test.log": {
+ "org.apache.sling.commons.log.level": "info",
+ "org.apache.sling.commons.log.file": "logs/test.log",
+ "org.apache.sling.commons.log.names": [
+ "be.orbinson.sling.observability.weavinghooks.testservlet"
+ ]
+ },
+ "be.orbinson.sling.observability.weavinghooks.logmethod.LogMethodWeavingHookConfiguration~TestServlet-methodOne": {
+ "className": "be.orbinson.sling.observability.weavinghooks.testservlet.TestServlet",
+ "methodName": "methodWithOneParameter",
+ "showGeneratedBytecode": true
+ },
+ "be.orbinson.sling.observability.weavinghooks.logmethod.LogMethodWeavingHookConfiguration~TestServlet-methodTwo": {
+ "className": "be.orbinson.sling.observability.weavinghooks.testservlet.TestServlet",
+ "methodName": "methodWithTwoParameters",
+ "showGeneratedBytecode": true
+ }
+ }
+}
diff --git a/src/test/java/be/orbinson/sling/observability/weavinghooks/it/WeavingHookIT.java b/src/test/java/be/orbinson/sling/observability/weavinghooks/it/WeavingHookIT.java
new file mode 100644
index 0000000..f813f5b
--- /dev/null
+++ b/src/test/java/be/orbinson/sling/observability/weavinghooks/it/WeavingHookIT.java
@@ -0,0 +1,40 @@
+package be.orbinson.sling.observability.weavinghooks.it;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.junit.jupiter.api.Test;
+
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class WeavingHookIT {
+
+ private static final int SLING_PORT = Integer.getInteger("HTTP_PORT", 8080);
+
+ /**
+ * Uses the {@link be.orbinson.sling.observability.weavinghooks.testservlet.TestServlet} that has two weaved methods on startup
+ */
+ @Test
+ public void testServletShouldLogMethodParams() throws Exception {
+ try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
+ HttpGet get = new HttpGet("http://localhost:" + SLING_PORT + "/test");
+ try (CloseableHttpResponse response = httpclient.execute(get)) {
+ String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
+ assertEquals("OK", responseBody);
+ }
+
+ HttpGet checkLogs = new HttpGet("http://localhost:" + SLING_PORT + "/system/console/slinglog/tailer.txt?name=/logs/test.log");
+ checkLogs.addHeader("Authorization", "Basic " + Base64.encodeBase64String("admin:admin".getBytes(StandardCharsets.UTF_8)));
+ try (CloseableHttpResponse response = httpclient.execute(checkLogs)) {
+ String[] lines = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8).split("\n");
+ assertEquals("TestServlet methodWithOneParameter, param_1: ", lines[0].substring(lines[0].indexOf("TestServlet")));
+ assertEquals("TestServlet methodWithTwoParameters, param_1: , param_2: ", lines[1].substring(lines[1].indexOf("TestServlet")));
+ }
+ }
+ }
+}
diff --git a/src/test/java/be/orbinson/sling/observability/weavinghooks/testservlet/TestServlet.java b/src/test/java/be/orbinson/sling/observability/weavinghooks/testservlet/TestServlet.java
new file mode 100644
index 0000000..4a00daa
--- /dev/null
+++ b/src/test/java/be/orbinson/sling/observability/weavinghooks/testservlet/TestServlet.java
@@ -0,0 +1,39 @@
+package be.orbinson.sling.observability.weavinghooks.testservlet;
+
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardContextSelect;
+import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern;
+
+import javax.servlet.Servlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * Servlet used in {@link be.orbinson.sling.observability.weavinghooks.it.WeavingHookIT} Integration test to validate that logs are appended
+ */
+@HttpWhiteboardServletPattern("/test")
+@HttpWhiteboardContextSelect("(osgi.http.whiteboard.context.name=org.osgi.service.http)")
+@Component(service = Servlet.class)
+public class TestServlet extends HttpServlet {
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws IOException {
+ methodWithOneParameter("parameterOne");
+ methodWithTwoParameters("parameterOne", "parameterTwo");
+ resp.getWriter().print("OK");
+ resp.getWriter().flush();
+ }
+
+ private void methodWithOneParameter(String parameterOne) {
+ // do nothing
+ }
+
+ private void methodWithTwoParameters(String parameterOne, String parameterTwo) {
+ // do nothing
+ }
+
+}
diff --git a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/ASMifierTester.java b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/ASMifierTester.java
similarity index 92%
rename from src/test/java/be/orbinson/sling/observability/weavinghooks/test/ASMifierTester.java
rename to src/test/java/be/orbinson/sling/observability/weavinghooks/util/ASMifierTester.java
index 19dda29..f50c3bf 100644
--- a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/ASMifierTester.java
+++ b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/ASMifierTester.java
@@ -1,4 +1,4 @@
-package be.orbinson.sling.observability.weavinghooks.test;
+package be.orbinson.sling.observability.weavinghooks.util;
import org.junit.jupiter.api.Test;
import org.objectweb.asm.ClassReader;
diff --git a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/MyClass.java b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/MyClass.java
similarity index 83%
rename from src/test/java/be/orbinson/sling/observability/weavinghooks/test/MyClass.java
rename to src/test/java/be/orbinson/sling/observability/weavinghooks/util/MyClass.java
index 53ae6ea..42d91a8 100644
--- a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/MyClass.java
+++ b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/MyClass.java
@@ -1,4 +1,4 @@
-package be.orbinson.sling.observability.weavinghooks.test;
+package be.orbinson.sling.observability.weavinghooks.util;
import org.slf4j.LoggerFactory;
diff --git a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/TextifierTester.java b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/TextifierTester.java
similarity index 92%
rename from src/test/java/be/orbinson/sling/observability/weavinghooks/test/TextifierTester.java
rename to src/test/java/be/orbinson/sling/observability/weavinghooks/util/TextifierTester.java
index 2870342..d739275 100644
--- a/src/test/java/be/orbinson/sling/observability/weavinghooks/test/TextifierTester.java
+++ b/src/test/java/be/orbinson/sling/observability/weavinghooks/util/TextifierTester.java
@@ -1,4 +1,4 @@
-package be.orbinson.sling.observability.weavinghooks.test;
+package be.orbinson.sling.observability.weavinghooks.util;
import org.junit.jupiter.api.Test;
import org.objectweb.asm.ClassReader;