use of org.neo4j.udc.UsageData in project neo4j by neo4j.
the class UsageDataTest method shouldPutAndRetrieve.
@Test
public void shouldPutAndRetrieve() throws Throwable {
// Given
UsageData ms = new UsageData(mock(JobScheduler.class));
UsageDataKey<String> key = key("hello");
// When
ms.set(key, "Hello!");
// Then
assertEquals("Hello!", ms.get(key));
assertEquals(null, ms.get(key("other")));
}
use of org.neo4j.udc.UsageData in project neo4j by neo4j.
the class SessionRule method apply.
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
Map<Setting<?>, String> config = new HashMap<>();
config.put(GraphDatabaseSettings.auth_enabled, Boolean.toString(authEnabled));
gdb = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabase(config);
DependencyResolver resolver = gdb.getDependencyResolver();
Authentication authentication = authentication(resolver.resolveDependency(AuthManager.class), resolver.resolveDependency(UserManagerSupplier.class));
boltFactory = new BoltFactoryImpl(gdb, new UsageData(null), NullLogService.getInstance(), resolver.resolveDependency(ThreadToStatementContextBridge.class), authentication, BoltConnectionTracker.NOOP, Config.defaults());
boltFactory.start();
try {
base.evaluate();
} finally {
try {
if (runningMachines != null) {
runningMachines.forEach(BoltStateMachine::close);
}
} catch (Throwable e) {
e.printStackTrace();
}
gdb.shutdown();
}
}
};
}
use of org.neo4j.udc.UsageData in project neo4j by neo4j.
the class RESTApiModuleTest method shouldRegisterASingleUri.
@Test
public void shouldRegisterASingleUri() throws Exception {
// Given
WebServer webServer = mock(WebServer.class);
Map<String, String> params = new HashMap();
String path = "/db/data";
params.put(ServerSettings.rest_api_path.name(), path);
Config config = Config.embeddedDefaults(params);
Dependencies deps = new Dependencies();
deps.satisfyDependency(new UsageData(mock(JobScheduler.class)));
Database db = mock(Database.class);
// When
RESTApiModule module = new RESTApiModule(webServer, config, deps, NullLogProvider.getInstance());
module.start();
// Then
verify(webServer).addJAXRSClasses(any(List.class), anyString(), anyCollection());
}
Aggregations