Search in sources :

Example 1 with ThirdPartyJaxRsPackage

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();
}
Also used : EmbeddedGraphDatabase(org.neo4j.kernel.EmbeddedGraphDatabase) ServerConfigurator(org.neo4j.server.configuration.ServerConfigurator) ThirdPartyJaxRsPackage(org.neo4j.server.configuration.ThirdPartyJaxRsPackage) BeforeClass(org.junit.BeforeClass)

Example 2 with ThirdPartyJaxRsPackage

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());
    }
}
Also used : ThirdPartyJaxRsPackage(org.neo4j.server.configuration.ThirdPartyJaxRsPackage)

Example 3 with ThirdPartyJaxRsPackage

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;
    }
}
Also used : ThirdPartyJaxRsPackage(org.neo4j.server.configuration.ThirdPartyJaxRsPackage)

Example 4 with ThirdPartyJaxRsPackage

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());
}
Also used : WebServer(org.neo4j.server.web.WebServer) CommunityNeoWebServer(org.neo4j.server.CommunityNeoWebServer) CommunityNeoWebServer(org.neo4j.server.CommunityNeoWebServer) Config(org.neo4j.configuration.Config) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) URI(java.net.URI) ThirdPartyJaxRsPackage(org.neo4j.server.configuration.ThirdPartyJaxRsPackage) Test(org.junit.jupiter.api.Test)

Aggregations

ThirdPartyJaxRsPackage (org.neo4j.server.configuration.ThirdPartyJaxRsPackage)4 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 Config (org.neo4j.configuration.Config)1 EmbeddedGraphDatabase (org.neo4j.kernel.EmbeddedGraphDatabase)1 CommunityNeoWebServer (org.neo4j.server.CommunityNeoWebServer)1 ServerConfigurator (org.neo4j.server.configuration.ServerConfigurator)1 WebServer (org.neo4j.server.web.WebServer)1