use of com.buschmais.jqassistant.core.store.api.StoreConfiguration in project jqa-maven-plugin by jQAssistant.
the class AbstractMojo method getStoreConfiguration.
/**
* Creates the {@link StoreConfiguration}. This is a copy of the {@link #store}
* enriched by default values and additional command line parameters.
*
* @param rootModule
* The root module.
* @return The directory.
*/
private StoreConfiguration getStoreConfiguration(MavenProject rootModule) {
StoreConfiguration.StoreConfigurationBuilder builder = StoreConfiguration.builder();
File storeDirectory = coalesce(this.storeDirectory, new File(rootModule.getBuild().getDirectory(), STORE_DIRECTORY));
builder.uri(coalesce(storeUri, store.getUri(), new File(storeDirectory, "/").toURI()));
builder.username(coalesce(storeUserName, store.getUsername()));
builder.password(coalesce(storePassword, store.getPassword()));
builder.encryption(coalesce(storeEncryption, store.getEncryption()));
builder.trustStrategy(coalesce(storeTrustStrategy, store.getTrustStrategy()));
builder.trustCertificate(coalesce(storeTrustCertificate, store.getTrustCertificate()));
builder.properties(store.getProperties());
builder.embedded(getEmbeddedNeo4jConfiguration());
StoreConfiguration storeConfiguration = builder.build();
getLog().debug("Using store configuration " + storeConfiguration);
return storeConfiguration;
}
use of com.buschmais.jqassistant.core.store.api.StoreConfiguration in project jqa-maven-plugin by jQAssistant.
the class AbstractMojo method getStore.
/**
* Determine the store instance to use for the given root module.
*
* @param rootModule
* The root module.
* @return The store instance.
* @throws MojoExecutionException
* If the store cannot be opened.
*/
private Store getStore(MavenProject rootModule) throws MojoExecutionException {
StoreConfiguration configuration = getStoreConfiguration(rootModule);
Object existingStore = cachingStoreProvider.getStore(configuration, getPluginRepository());
if (!Store.class.isAssignableFrom(existingStore.getClass())) {
throw new MojoExecutionException("Cannot re-use store instance from reactor. Either declare the plugin as extension or execute Maven using the property -D" + PROPERTY_STORE_LIFECYCLE + "=" + StoreLifecycle.MODULE + " on the command line.");
}
return (Store) existingStore;
}
use of com.buschmais.jqassistant.core.store.api.StoreConfiguration in project jqa-core-framework by jQAssistant.
the class AbstractPluginIT method startStore.
/**
* Initializes and resets the store.
*/
private void startStore(TestInfo testInfo) throws URISyntaxException {
Method method = testInfo.getTestMethod().orElseThrow(() -> new AssertionError("Unabled to get the test method for test '" + testInfo.getDisplayName() + "'."));
TestStore testStore = method.getAnnotation(TestStore.class);
TestStore.Type type = testStore != null ? testStore.type() : TestStore.Type.MEMORY;
StoreConfiguration.StoreConfigurationBuilder storeConfigurationBuilder = StoreConfiguration.builder();
switch(type) {
case FILE:
String fileName = "target/jqassistant/test-store";
storeConfigurationBuilder.uri(new File(fileName).toURI());
storeConfigurationBuilder.embedded(getEmbeddedNeo4jConfiguration());
break;
case MEMORY:
storeConfigurationBuilder.uri(new URI("memory:///"));
storeConfigurationBuilder.embedded(getEmbeddedNeo4jConfiguration());
break;
case REMOTE:
storeConfigurationBuilder.uri(new URI("bolt://localhost:7687"));
storeConfigurationBuilder.encryption("NONE");
storeConfigurationBuilder.username("neo4j").password("jqassistant");
Properties properties = new Properties();
properties.put("neo4j.remote.statement.log.level", "info");
storeConfigurationBuilder.properties(properties);
break;
default:
throw new AssertionError("Test store type not supported: " + type);
}
/*
* You might break IT of depending jQAssistant plugins if you change the
* location of the used database. Oliver B. Fischer, 2017-06-10
*/
StoreConfiguration configuration = storeConfigurationBuilder.build();
store = StoreFactory.getStore(configuration, pluginRepository.getStorePluginRepository());
store.start();
if (testStore == null || testStore.reset()) {
store.reset();
}
}
Aggregations