the first commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
## OS Generated
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
## Eclipse IDE
|
||||||
|
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
local.properties
|
||||||
|
.externalToolBuilders/
|
||||||
|
*.launch
|
||||||
|
.pmd
|
||||||
|
.eclipse-pmd
|
||||||
|
|
||||||
|
# Intellij Idea
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
target/
|
||||||
|
|
||||||
|
# Gradle
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
/gradle/
|
||||||
|
/gradlew
|
||||||
|
/gradlew.bat
|
||||||
|
|
||||||
|
## Project specific
|
||||||
|
deploy
|
||||||
|
|
||||||
|
# Default by github for Java projects
|
||||||
|
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
# Maven versionsBackup
|
||||||
|
|
||||||
|
*.versionsBackup
|
||||||
@@ -1,3 +1,58 @@
|
|||||||
# scanpath-v1-tests
|
# Scanpath v1 Tests
|
||||||
|
|
||||||
Unit tests for the Scanpath v1 library
|
> Integration and unit tests for the Javassist-backed Scanpath v1 library.
|
||||||
|
|
||||||
|
This project exercises the public scanning API provided by
|
||||||
|
[Scanpath v1](https://rprime.indroneel.co/libzero/scanpath-v1). The suite uses small, purpose-built
|
||||||
|
type hierarchies and annotations to verify discovery behavior without relying on
|
||||||
|
application-specific classes.
|
||||||
|
|
||||||
|
## Coverage
|
||||||
|
|
||||||
|
The test scenarios cover:
|
||||||
|
|
||||||
|
- Direct and indirect inheritance and interface implementations
|
||||||
|
- Class-level annotation discovery
|
||||||
|
- Field-level annotation discovery
|
||||||
|
- Method-level annotation discovery
|
||||||
|
- Package and class filtering
|
||||||
|
- Duplicate scope handling
|
||||||
|
- Positive and negative discovery cases
|
||||||
|
|
||||||
|
Tests are organized under
|
||||||
|
[`src/test/java/dux/scanpath/v1/test`](src/test/java/dux/scanpath/v1/test), with scenarios grouped
|
||||||
|
by discovery behavior.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Java 17 or newer
|
||||||
|
- Gradle 9.x
|
||||||
|
- A locally installed or reachable `dux.scanpath:dux.scanpath:v1-SNAPSHOT` dependency
|
||||||
|
|
||||||
|
The build resolves dependencies from `mavenLocal()`, Maven Central, and the DuxTechnica snapshot
|
||||||
|
repository. Build and install the sibling Scanpath v1 project first when the snapshot is not
|
||||||
|
already available:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ../scanpath-v1
|
||||||
|
mvn install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run the tests
|
||||||
|
|
||||||
|
From this directory, run the complete JUnit Platform test suite:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gradle clean build test
|
||||||
|
```
|
||||||
|
|
||||||
|
The reports are written to the following locations:
|
||||||
|
|
||||||
|
- `build/reports/tests/test/index.html` - JUnit test report
|
||||||
|
- `build/reports/jacoco/test/html/index.html` - JaCoCo coverage report
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is distributed under the
|
||||||
|
[DuxTechnica Limited Use Source Code License Agreement](LICENSE). Review the license before
|
||||||
|
using or redistributing the source code.
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id "java"
|
||||||
|
id "jacoco"
|
||||||
|
}
|
||||||
|
|
||||||
|
version = "v1-SNAPSHOT"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url "https://maven.indroneel.co/repo/snapshots"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "dux.scanpath:dux.scanpath:v1-SNAPSHOT"
|
||||||
|
|
||||||
|
implementation "org.junit.jupiter:junit-jupiter:5.10.2"
|
||||||
|
implementation "org.junit.platform:junit-platform-launcher:1.10.2"
|
||||||
|
|
||||||
|
implementation "org.slf4j:jul-to-slf4j:2.0.7"
|
||||||
|
implementation "ch.qos.logback:logback-classic:1.4.6"
|
||||||
|
implementation "org.codehaus.janino:janino:3.1.9"
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("test", Test) {
|
||||||
|
useJUnitPlatform()
|
||||||
|
systemProperty "junit.jupiter.extensions.autodetection.enabled", "true"
|
||||||
|
|
||||||
|
/*
|
||||||
|
filter {
|
||||||
|
includeTestsMatching("fully.qualified.package.*")
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
testLogging {
|
||||||
|
events "started", "passed", "failed", "skipped"
|
||||||
|
showStandardStreams = true
|
||||||
|
displayGranularity 2
|
||||||
|
reports
|
||||||
|
finalizedBy jacocoTestReport
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jacocoTestReport {
|
||||||
|
dependsOn test
|
||||||
|
reports {
|
||||||
|
xml.required = true
|
||||||
|
csv.required = false
|
||||||
|
//html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
def classDir = file("${projectDir}/../scanpath-v1/target/classes")
|
||||||
|
def sourceDir = file("${projectDir}/../scanpath-v1/src/main/java")
|
||||||
|
|
||||||
|
sourceDirectories.setFrom(files(sourceDir))
|
||||||
|
classDirectories.setFrom(files(
|
||||||
|
fileTree(dir: classDir)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
rootProject.name = "scanpath-v1-tests"
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class InheritanceTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger L = Logger.getLogger(InheritanceTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(S1BaseClass.class.getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.setClassLoader(null);
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listInheritingClasses(S1BaseFace.class);
|
||||||
|
L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S1Descend01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S1Descend02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(S1BaseClass.class.getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listInheritingClasses(S1BaseClass.class);
|
||||||
|
L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S1Descend03.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S1Descend04.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class NonDescend {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S1BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a marker interface that is used to scan for classes that implement this interface.
|
||||||
|
*
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface S1BaseFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S1Descend01 implements S1BaseFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S1Descend02 implements S1BaseFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S1Descend03 extends S1BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S1Descend04 extends S1BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class InheritanceTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(InheritanceTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(S2BaseClass.class.getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listInheritingClasses(S2BaseFace.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S2Descend01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S2Descend02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(S2BaseClass.class.getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listInheritingClasses(S2BaseClass.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S2Descend03.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S2Descend04.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface S2BaseFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2ChildClass extends S2BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface S2ChildFace extends S2BaseFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2Descend01 implements S2ChildFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2Descend02 implements S2ChildFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2Descend03 extends S2BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S2Descend04 extends S2BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ClassAnnotationTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(ClassAnnotationTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S3ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S3Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S3Target02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S3ClsAnn02.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S3Target03.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
public void test03() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S3ClsAnn03.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S3Target04.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(4)
|
||||||
|
public void test04() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S3ClsAnn04.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S3Target05.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**'
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S3ClsAnn02
|
||||||
|
public class S3BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S3ClsAnn03
|
||||||
|
public interface S3BaseFace1 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S3ClsAnn04
|
||||||
|
public interface S3BaseFace2 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S3ClsAnn01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S3ClsAnn02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S3ClsAnn03 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S3ClsAnn04 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface S3DerivedFace extends S3BaseFace2 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S3ClsAnn01
|
||||||
|
public class S3Target01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S3ClsAnn01
|
||||||
|
public class S3Target02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S3Target03 extends S3BaseClass {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S3Target04 implements S3BaseFace1 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S3Target05 implements S3DerivedFace {
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MethodAnnotationTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(MethodAnnotationTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedMethods(S4MthdAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S4Container01.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedMethods(S4MthdAnn02.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S4Container02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Order(3)
|
||||||
|
public void test03() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedMethods(S4MthdAnn03.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S4BaseContainer02.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4BaseContainer01 {
|
||||||
|
|
||||||
|
@S4MthdAnn02
|
||||||
|
public void method01() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4BaseContainer02 {
|
||||||
|
|
||||||
|
@S4MthdAnn03
|
||||||
|
private void method01() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4Container01 {
|
||||||
|
|
||||||
|
@S4MthdAnn01
|
||||||
|
public void method01() {}
|
||||||
|
|
||||||
|
@S4MthdAnn01
|
||||||
|
public void method02() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4Container02 extends S4BaseContainer01 {
|
||||||
|
|
||||||
|
public void method02() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4Container03 {
|
||||||
|
|
||||||
|
@S4MthdAnn03
|
||||||
|
private void method01() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S4Container04 extends S4BaseContainer02 {
|
||||||
|
|
||||||
|
public void method02() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S4MthdAnn01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S4MthdAnn02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s4;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S4MthdAnn03 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@DisplayName("Classes can be found using field-level annotations")
|
||||||
|
public class FieldAnnotationTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(FieldAnnotationTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a public field can be used to find a class")
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container01.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a private field can be used to find a class")
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn02.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a protected field can be used to find a class")
|
||||||
|
@Order(3)
|
||||||
|
public void test03() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn03.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container03.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a public field can be used to find a derived class")
|
||||||
|
@Order(4)
|
||||||
|
public void test04() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn04.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container04.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a private field can be used to find a derived class")
|
||||||
|
@Order(5)
|
||||||
|
public void test05() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn05.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container05.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Annotation on a protected field can be used to find a derived class")
|
||||||
|
@Order(6)
|
||||||
|
public void test06() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listClassesWithAnnotatedFields(S5FldAnn06.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.contains(S5Container06.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class S5BaseContainer01 {
|
||||||
|
|
||||||
|
@S5FldAnn04
|
||||||
|
public String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class S5BaseContainer02 {
|
||||||
|
|
||||||
|
@S5FldAnn05
|
||||||
|
private String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class S5BaseContainer03 {
|
||||||
|
|
||||||
|
@S5FldAnn06
|
||||||
|
protected String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container01 {
|
||||||
|
|
||||||
|
@S5FldAnn01
|
||||||
|
public String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container02 {
|
||||||
|
|
||||||
|
@S5FldAnn02
|
||||||
|
private String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container03 {
|
||||||
|
|
||||||
|
@S5FldAnn03
|
||||||
|
protected String value01;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container04 extends S5BaseContainer01 {
|
||||||
|
|
||||||
|
public String value02;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container05 extends S5BaseContainer02 {
|
||||||
|
|
||||||
|
private String value02;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class S5Container06 extends S5BaseContainer03 {
|
||||||
|
|
||||||
|
protected String value02;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn03 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn04 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn05 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s5;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S5FldAnn06 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.support.ClassAnnotationVisitor;
|
||||||
|
import dux.scanpath.v1.support.ClassVisitor;
|
||||||
|
import dux.scanpath.v1.support.FieldAnnotationVisitor;
|
||||||
|
import dux.scanpath.v1.support.InheritanceVisitor;
|
||||||
|
import dux.scanpath.v1.support.MethodAnnotationVisitor;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@DisplayName("Test for the filtering capabilities of scan scope")
|
||||||
|
public class FilterScopeTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(FilterScopeTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes can be explicitly included in scan scope")
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
//ss.includePackage(getClass().getPackageName());
|
||||||
|
ss.includeClass(S6Target01.class.getName());
|
||||||
|
ss.includeClass(S6Target02.class.getName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes can be explicitly excluded in scan scope")
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
ss.excludeClass(S6Target01.class.getName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target02.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target03.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(SXTarget01.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes on the classpath are included in scan scope")
|
||||||
|
@Order(3)
|
||||||
|
public void test03() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage("dux.scanpath");
|
||||||
|
ss.excludePackage("dux.scanpath.test");
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList1 = scanner.listInheritingClasses(ClassVisitor.class);
|
||||||
|
_L.info(clsList1.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList1.contains(InheritanceVisitor.class));
|
||||||
|
Assertions.assertTrue(clsList1.contains(ClassAnnotationVisitor.class));
|
||||||
|
Assertions.assertTrue(clsList1.contains(MethodAnnotationVisitor.class));
|
||||||
|
Assertions.assertTrue(clsList1.contains(FieldAnnotationVisitor.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes on the classpath can be excluded from scan scope")
|
||||||
|
@Order(4)
|
||||||
|
public void test04() {
|
||||||
|
File cwd = new File(System.getProperty("user.dir"));
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.excludeSystemClassPath();
|
||||||
|
ss.addClassPath(new File(cwd, "/build/classes/java/test").getAbsolutePath());
|
||||||
|
ss.addClassPath(new File(cwd, "/build/resources/test").getAbsolutePath());
|
||||||
|
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList1 = scanner.listInheritingClasses(ClassVisitor.class);
|
||||||
|
_L.info(clsList1.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList1.isEmpty());
|
||||||
|
|
||||||
|
List<Class<?>> clsList2 = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList2.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList2.contains(S6Target01.class));
|
||||||
|
Assertions.assertTrue(clsList2.contains(S6Target02.class));
|
||||||
|
Assertions.assertTrue(clsList2.contains(S6Target03.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes are included in scan scope using regular expression")
|
||||||
|
@Order(5)
|
||||||
|
public void test05() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includeClassesByPattern(".+01\\z");
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(SXTarget01.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes are excluded from scan scope using regular expression")
|
||||||
|
@Order(6)
|
||||||
|
public void test06() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
ss.excludeClassesByPattern(".+01\\z");
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target02.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target03.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Invalid include patterns in scan scope are ignored")
|
||||||
|
@Order(7)
|
||||||
|
public void test07() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includeClassesByPattern("[0-");
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertTrue(clsList.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Invalid exclude patterns in scan scope are ignored")
|
||||||
|
@Order(8)
|
||||||
|
public void test08() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
ss.excludeClassesByPattern("[0-");
|
||||||
|
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(ss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S6ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(4, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target02.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S6Target03.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(SXTarget01.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S6ClsAnn01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S6ClsAnn01
|
||||||
|
public class S6Target01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S6ClsAnn01
|
||||||
|
public class S6Target02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S6ClsAnn01
|
||||||
|
public class S6Target03 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S6ClsAnn01
|
||||||
|
public class SXTarget01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s7;
|
||||||
|
|
||||||
|
import dux.scanpath.v1.ClasspathScanner;
|
||||||
|
import dux.scanpath.v1.ScanScope;
|
||||||
|
import dux.scanpath.v1.test.setup.AbstractTests;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Order;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@DisplayName("Tests that scan scope can be duplicated correctly")
|
||||||
|
public class DuplicateScopeTests extends AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger _L = Logger.getLogger(DuplicateScopeTests.class.getName());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Packages included in duplicate scan scope")
|
||||||
|
@Order(1)
|
||||||
|
public void test01() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
|
||||||
|
ScanScope dss = ss.duplicate();
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(dss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S7ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(3, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target02.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target03.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes included in duplicate scan scope")
|
||||||
|
@Order(2)
|
||||||
|
public void test02() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includeClass(S7Target01.class.getName());
|
||||||
|
ss.includeClass(S7Target02.class.getName());
|
||||||
|
|
||||||
|
ScanScope dss = ss.duplicate();
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(dss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S7ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target01.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target02.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes are included in duplicate scan scope using regular expression")
|
||||||
|
@Order(3)
|
||||||
|
public void test03() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includeClassesByPattern(".+01\\z");
|
||||||
|
|
||||||
|
ScanScope dss = ss.duplicate();
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(dss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S7ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(1, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target01.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Classes are excluded from duplicate scan scope using regular expression")
|
||||||
|
@Order(4)
|
||||||
|
public void test04() {
|
||||||
|
ScanScope ss = new ScanScope();
|
||||||
|
ss.includePackage(getClass().getPackageName());
|
||||||
|
ss.excludeClassesByPattern(".+01\\z");
|
||||||
|
|
||||||
|
ScanScope dss = ss.duplicate();
|
||||||
|
ClasspathScanner scanner = new ClasspathScanner();
|
||||||
|
scanner.load(dss);
|
||||||
|
|
||||||
|
List<Class<?>> clsList = scanner.listAnnotatedClasses(S7ClsAnn01.class);
|
||||||
|
_L.info(clsList.toString());
|
||||||
|
|
||||||
|
Assertions.assertEquals(2, clsList.size());
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target02.class));
|
||||||
|
Assertions.assertTrue(clsList.contains(S7Target03.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s7;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface S7ClsAnn01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S7ClsAnn01
|
||||||
|
public class S7Target01 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S7ClsAnn01
|
||||||
|
public class S7Target02 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.scenario.s7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@S7ClsAnn01
|
||||||
|
public class S7Target03 {
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.setup;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.MethodOrderer;
|
||||||
|
import org.junit.jupiter.api.TestInfo;
|
||||||
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
|
public abstract class AbstractTests {
|
||||||
|
|
||||||
|
private static final Logger L = Logger.getLogger(AbstractTests.class.getName());
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void beforeEach(TestInfo info) {
|
||||||
|
String clsName = "UnknownClass";
|
||||||
|
String mthdName = "unknownMethod";
|
||||||
|
if(info.getTestClass().isPresent()) {
|
||||||
|
clsName = info.getTestClass().get().getSimpleName();
|
||||||
|
}
|
||||||
|
if(info.getTestMethod().isPresent()) {
|
||||||
|
mthdName = info.getTestMethod().get().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
L.info("%s.%s(): %s".formatted(
|
||||||
|
clsName, mthdName, info.getDisplayName().toUpperCase(Locale.getDefault())));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void logMultiLines(Logger logger, String logout) {
|
||||||
|
String[] lines = logout.split("\n");
|
||||||
|
for(String line : lines) {
|
||||||
|
logger.info(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) DuxTechnica
|
||||||
|
*
|
||||||
|
* Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
* contacting:
|
||||||
|
*
|
||||||
|
* Dux Technica, [email protected]
|
||||||
|
*
|
||||||
|
* This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dux.scanpath.v1.test.setup;
|
||||||
|
|
||||||
|
import org.junit.platform.launcher.LauncherSession;
|
||||||
|
import org.junit.platform.launcher.LauncherSessionListener;
|
||||||
|
import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author indroneel
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LauncherSessionHandler implements LauncherSessionListener {
|
||||||
|
|
||||||
|
private static final Logger L = Logger.getLogger(LauncherSessionHandler.class.getName());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launcherSessionOpened(LauncherSession session) {
|
||||||
|
SLF4JBridgeHandler.removeHandlersForRootLogger();
|
||||||
|
SLF4JBridgeHandler.install();
|
||||||
|
|
||||||
|
L.info("launcher session opened");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void launcherSessionClosed(LauncherSession session) {
|
||||||
|
L.info("launcher session closed");
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) DuxTechnica
|
||||||
|
#
|
||||||
|
# Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
# use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
# contacting:
|
||||||
|
#
|
||||||
|
# Dux Technica, [email protected]
|
||||||
|
#
|
||||||
|
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
# either express or implied. See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
dux.scanpath.v1.test.setup.LauncherSessionHandler
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) DuxTechnica
|
||||||
|
~
|
||||||
|
~ Licensed under the DuxTechnica Limited Use Source Code License Agreement (DT-LUSCL); you may not
|
||||||
|
~ use this file except in compliance with the License. You may obtain a copy of the License by
|
||||||
|
~ contacting:
|
||||||
|
~
|
||||||
|
~ Dux Technica, [email protected]
|
||||||
|
~
|
||||||
|
~ This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
~ either express or implied. See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!DOCTYPE configuration>
|
||||||
|
<configuration debug="false">
|
||||||
|
|
||||||
|
<import class="ch.qos.logback.classic.jul.LevelChangePropagator"/>
|
||||||
|
<contextListener class="LevelChangePropagator">
|
||||||
|
<resetJUL>true</resetJUL>
|
||||||
|
</contextListener>
|
||||||
|
|
||||||
|
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
%4line: %msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="STDOUT_MIN" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>
|
||||||
|
%n%msg%n
|
||||||
|
</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="WARN">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</root>
|
||||||
|
<logger name="dux.scanpath.v1.test.setup" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="STDOUT_MIN"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="dux.scanpath.v1" level="TRACE" additivity="false">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</logger>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user