Search in sources :

Example 1 with CommunityNeoWebServer

use of org.neo4j.server.CommunityNeoWebServer in project neo4j by neo4j.

the class DBMSModuleTest method shouldRegisterAtRootByDefault.

@Test
public void shouldRegisterAtRootByDefault() throws Exception {
    WebServer webServer = mock(WebServer.class);
    Config config = mock(Config.class);
    CommunityNeoWebServer neoServer = mock(CommunityNeoWebServer.class);
    when(neoServer.getBaseUri()).thenReturn(new URI("http://localhost:7575"));
    when(neoServer.getWebServer()).thenReturn(webServer);
    when(config.get(GraphDatabaseSettings.auth_enabled)).thenReturn(true);
    when(config.get(ServerSettings.http_paths_blacklist)).thenReturn(emptyList());
    var module = new DBMSModule(webServer, config, () -> new DiscoverableURIs.Builder().build(), NullLogProvider.getInstance());
    module.start();
    verify(webServer).addJAXRSClasses(anyList(), anyString(), isNull());
}
Also used : WebServer(org.neo4j.server.web.WebServer) CommunityNeoWebServer(org.neo4j.server.CommunityNeoWebServer) Config(org.neo4j.configuration.Config) CommunityNeoWebServer(org.neo4j.server.CommunityNeoWebServer) URI(java.net.URI) Test(org.junit.jupiter.api.Test)

Example 2 with CommunityNeoWebServer

use of org.neo4j.server.CommunityNeoWebServer 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

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