use of org.neo4j.server.configuration.ThirdPartyJaxRsPackage in project neo4j-clean-remote-db-addon by jexp.
the class DeleteDatabaseTest method startServerWithACleanDb.
@BeforeClass
public static void startServerWithACleanDb() {
graphDatabase = new EmbeddedGraphDatabase("target/db1");
ServerConfigurator config = new ServerConfigurator(graphDatabase);
config.configuration().setProperty("org.neo4j.server.thirdparty.delete.key", "secret-key");
config.getThirdpartyJaxRsClasses().add(new ThirdPartyJaxRsPackage("org.neo4j.server.extension.test.delete", "/cleandb"));
WrappingNeoServerBootstrapper bootstrapper = new WrappingNeoServerBootstrapper(graphDatabase, config);
bootstrapper.start();
neoServer = bootstrapper.getServer();
}
use of org.neo4j.server.configuration.ThirdPartyJaxRsPackage in project neo4j by neo4j.
the class ThirdPartyJAXRSModule method start.
@Override
public void start() {
this.packages = config.get(ServerSettings.third_party_packages);
for (ThirdPartyJaxRsPackage tpp : packages) {
List<String> packageNames = packagesFor(tpp);
webServer.addJAXRSPackages(packageNames, tpp.getMountPoint(), null);
log.info("Mounted unmanaged extension [%s] at [%s]", tpp.getPackageName(), tpp.getMountPoint());
}
}
use of org.neo4j.server.configuration.ThirdPartyJaxRsPackage in project neo4j by neo4j.
the class AbstractInProcessServerBuilder method toStringForThirdPartyPackageProperty.
private static String toStringForThirdPartyPackageProperty(List<ThirdPartyJaxRsPackage> extensions) {
String propertyString = "";
int packageCount = extensions.size();
if (packageCount == 0) {
return propertyString;
} else {
ThirdPartyJaxRsPackage jaxRsPackage;
for (int i = 0; i < packageCount - 1; i++) {
jaxRsPackage = extensions.get(i);
propertyString += jaxRsPackage.getPackageName() + "=" + jaxRsPackage.getMountPoint() + Settings.SEPARATOR;
}
jaxRsPackage = extensions.get(packageCount - 1);
propertyString += jaxRsPackage.getPackageName() + "=" + jaxRsPackage.getMountPoint();
return propertyString;
}
}
use of org.neo4j.server.configuration.ThirdPartyJaxRsPackage in project neo4j by neo4j.
the class ThirdPartyJAXRSModuleTest method shouldReportThirdPartyPackagesAtSpecifiedMount.
@Test
void shouldReportThirdPartyPackagesAtSpecifiedMount() throws Exception {
// Given
WebServer webServer = mock(WebServer.class);
CommunityNeoWebServer neoServer = mock(CommunityNeoWebServer.class);
when(neoServer.getBaseUri()).thenReturn(new URI("http://localhost:7575"));
when(neoServer.getWebServer()).thenReturn(webServer);
Config config = mock(Config.class);
List<ThirdPartyJaxRsPackage> jaxRsPackages = new ArrayList<>();
String path = "/third/party/package";
jaxRsPackages.add(new ThirdPartyJaxRsPackage("org.example.neo4j", path));
when(config.get(ServerSettings.third_party_packages)).thenReturn(jaxRsPackages);
// When
ThirdPartyJAXRSModule module = new ThirdPartyJAXRSModule(webServer, config, NullLogProvider.getInstance());
module.start();
// Then
verify(webServer).addJAXRSPackages(any(List.class), anyString(), any());
}
Aggregations