diff --git a/core/test/src/main/java/com/buschmais/jqassistant/core/test/plugin/AbstractPluginIT.java b/core/test/src/main/java/com/buschmais/jqassistant/core/test/plugin/AbstractPluginIT.java index e50b23d59b..1992dd05e3 100644 --- a/core/test/src/main/java/com/buschmais/jqassistant/core/test/plugin/AbstractPluginIT.java +++ b/core/test/src/main/java/com/buschmais/jqassistant/core/test/plugin/AbstractPluginIT.java @@ -2,13 +2,7 @@ import java.io.File; import java.io.IOException; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; import java.lang.reflect.Method; -import java.net.URI; -import java.net.URISyntaxException; import java.net.URLDecoder; import java.nio.charset.Charset; import java.util.*; @@ -47,7 +41,6 @@ import com.buschmais.jqassistant.core.scanner.spi.ScannerPluginRepository; import com.buschmais.jqassistant.core.store.api.Store; import com.buschmais.jqassistant.core.store.api.StoreFactory; -import com.buschmais.jqassistant.core.store.api.configuration.Remote; import com.buschmais.xo.api.Query; import com.buschmais.xo.api.Query.Result.CompositeRowObject; @@ -82,8 +75,6 @@ public abstract class AbstractPluginIT { private File outputDirectory; - private TestStore testStore; - protected Store store; protected InMemoryReportPlugin reportPlugin; protected RuleSet ruleSet; @@ -107,14 +98,13 @@ public static void destroyPluginRepository() { public void beforeEach(TestInfo testInfo) throws IOException, RuleException { Method method = testInfo.getTestMethod() .orElseThrow(() -> new AssertionError("Unable to get the test method for test '" + testInfo.getDisplayName() + "'.")); - testStore = method.getAnnotation(TestStore.class); ConfigurationBuilder configurationBuilder = createConfigurationBuilder(); configure(configurationBuilder); Configuration configuration = createConfiguration(configurationBuilder); workingDirectory = new File("."); outputDirectory = new File(workingDirectory, "target/jqassistant"); outputDirectory.mkdirs(); - startStore(configuration.store(), testStore); + startStore(configuration.store()); initializeRuleSet(configuration); initializeReportPlugin(configuration); } @@ -128,35 +118,6 @@ protected List getConfigurationProfiles() { private ConfigurationBuilder createConfigurationBuilder() { ConfigurationBuilder configurationBuilder = new ConfigurationBuilder("ITConfigSource", 110); - TestStore.Type type = testStore != null ? testStore.type() : TestStore.Type.MEMORY; - switch (type) { - case FILE: - break; - case MEMORY: - try { - configurationBuilder.with(com.buschmais.jqassistant.core.store.api.configuration.Store.class, - com.buschmais.jqassistant.core.store.api.configuration.Store.URI, new URI(STORE_URI_MEMORY)); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("Cannot create store URI", e); - } - break; - case REMOTE: - try { - configurationBuilder.with(com.buschmais.jqassistant.core.store.api.configuration.Store.class, - com.buschmais.jqassistant.core.store.api.configuration.Store.URI, new URI(STORE_URI_REMOTE)); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("Cannot create store URI", e); - } - configurationBuilder.with(Remote.class, Remote.ENCRYPTION, "NONE"); - configurationBuilder.with(Remote.class, Remote.USERNAME, "neo4j"); - configurationBuilder.with(Remote.class, Remote.PASSWORD, "jqassistant"); - Properties properties = new Properties(); - properties.put("neo4j.remote.statement.log.level", "info"); - configurationBuilder.with(Remote.class, Remote.PROPERTIES, properties); - break; - default: - throw new AssertionError("Test store type not supported: " + type); - } configurationBuilder.with(Report.class, Report.PROPERTIES, getReportProperties()); return configurationBuilder; } @@ -239,13 +200,10 @@ protected Map getRuleInterpreterProperties() { /** * Initializes and resets the store. */ - private void startStore(com.buschmais.jqassistant.core.store.api.configuration.Store storeConfiguration, TestStore testStore) { + private void startStore(com.buschmais.jqassistant.core.store.api.configuration.Store storeConfiguration) { StoreFactory storeFactory = new StoreFactory(pluginRepository.getStorePluginRepository(), plugins -> emptyList()); store = storeFactory.getStore(storeConfiguration, () -> TEST_STORE_DIRECTORY); store.start(); - if (testStore == null || testStore.reset()) { - store.reset(); - } } /** @@ -435,21 +393,6 @@ protected void executeGroup(String id, Map parameters) throws Ru getAnalyzer(parameters).execute(ruleSet, ruleSelection); } - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - protected @interface TestStore { - - boolean reset() default true; - - Type type() default Type.FILE; - - enum Type { - FILE, - MEMORY, - REMOTE; - } - } - /** * Represents a test result which allows fetching values by row or columns. */ diff --git a/plugin/java/src/test/java/com/buschmais/jqassistant/plugin/java/test/scanner/JavaRuntimePT.java b/plugin/java/src/test/java/com/buschmais/jqassistant/plugin/java/test/scanner/JavaRuntimePT.java index cdc99aae26..e90c5c30fb 100644 --- a/plugin/java/src/test/java/com/buschmais/jqassistant/plugin/java/test/scanner/JavaRuntimePT.java +++ b/plugin/java/src/test/java/com/buschmais/jqassistant/plugin/java/test/scanner/JavaRuntimePT.java @@ -23,8 +23,7 @@ class JavaRuntimePT extends AbstractJavaPluginIT { * variable java.home. */ @Test - @TestStore(type = TestStore.Type.FILE) - void javaRuntime01Scan() { + void javaRuntime01Scan() throws RuleException { String javaHome = System.getProperty("java.home"); assumeNotNull("java.home is not set.", javaHome); File runtimeJar = new File(javaHome + "/lib/rt.jar"); @@ -32,17 +31,7 @@ void javaRuntime01Scan() { store.beginTransaction(); getScanner().scan(runtimeJar, runtimeJar.getAbsolutePath(), null); store.commitTransaction(); - } - - @Test - @TestStore(type = TestStore.Type.FILE, reset = false) - public void javaRuntime02VirtualDependsOn() throws RuleException { applyConcept("java:VirtualDependsOn"); - } - - @Test - @TestStore(type = TestStore.Type.FILE, reset = false) - public void javaRuntime03VirtualInvokes() throws RuleException { applyConcept("java:VirtualInvokes"); } } diff --git a/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/anchor/AnchorIT.java b/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/anchor/AnchorIT.java index 1d6e6cd052..d98611e0a1 100644 --- a/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/anchor/AnchorIT.java +++ b/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/anchor/AnchorIT.java @@ -134,7 +134,6 @@ void cypherAnchorOnSequenceItem() { assertThat(result).hasSize(1); } - @TestStore(type = TestStore.Type.MEMORY) @Test void cypherAnchorOnSequenceItemResultsInToSequences() { readSourceDocument("/anchor/toplevel-sequence-anchor-on-sequence.yml"); @@ -151,7 +150,6 @@ void cypherAnchorOnSequenceItemResultsInToSequences() { assertThat(sequences).hasSize(2); } - @TestStore(type = TestStore.Type.MEMORY) @Test void cypherAnchorOnSequenceItemResultsInCorrectSettingOfFirstAndLand() { readSourceDocument("/anchor/toplevel-sequence-anchor-on-sequence.yml"); diff --git a/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/issues/GH5AnchorsInAComplexKeyIT.java b/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/issues/GH5AnchorsInAComplexKeyIT.java index 652c003f89..205f38b08b 100644 --- a/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/issues/GH5AnchorsInAComplexKeyIT.java +++ b/plugin/yaml/src/test/java/com/buschmais/jqassistant/plugin/yaml2/impl/scanner/issues/GH5AnchorsInAComplexKeyIT.java @@ -8,7 +8,6 @@ class GH5AnchorsInAComplexKeyIT extends AbstractYAMLPluginIT { - @TestStore(reset = false, type = TestStore.Type.MEMORY) @Test void anchorOnlyInAComplexKey() { readSourceDocument("/anchorincomplexkey/anchor-only.yaml"); @@ -19,7 +18,6 @@ void anchorOnlyInAComplexKey() { assertThat(testResult.getColumns()).containsKeys("n"); } - @TestStore(reset = false, type = TestStore.Type.MEMORY) @Test void anchorInKeyAndAliasAsValue() { readSourceDocument("/anchorincomplexkey/anchor-and-alias.yaml");