Search in sources :

Example 11 with Server

use of com.nike.riposte.server.Server in project riposte by Nike-Inc.

the class VerifyResponseHttpStatusCodeHandlingRfcCorrectnessComponentTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    // The slf4j-test logger causes a huge amount of spam to be output for these tests. Disable for these tests, then re-enable in tearDown().
    logPrintLevelAtStart = TestLoggerFactory.getInstance().getPrintLevel();
    TestLoggerFactory.getInstance().setPrintLevel(Level.WARN);
    System.setProperty(StreamingAsyncHttpClient.SHOULD_LOG_BAD_MESSAGES_AFTER_REQUEST_FINISHES_SYSTEM_PROP_KEY, "true");
    int backendPort = ComponentTestUtils.findFreePort();
    backendServerConfig = new BackendServerConfig(backendPort);
    backendServer = new Server(backendServerConfig);
    backendServer.startup();
    int intermediateRouterPort = ComponentTestUtils.findFreePort();
    intermediateRouterServerConfig = new RouterServerConfig(intermediateRouterPort, backendPort);
    intermediateRouterServer = new Server(intermediateRouterServerConfig);
    intermediateRouterServer.startup();
    int edgeRouterPort = ComponentTestUtils.findFreePort();
    edgeRouterServerConfig = new RouterServerConfig(edgeRouterPort, intermediateRouterPort);
    edgeRouterServer = new Server(edgeRouterServerConfig);
    edgeRouterServer.startup();
}
Also used : Server(com.nike.riposte.server.Server) StandardEndpoint(com.nike.riposte.server.http.StandardEndpoint) Endpoint(com.nike.riposte.server.http.Endpoint) SimpleProxyRouterEndpoint(com.nike.riposte.server.http.impl.SimpleProxyRouterEndpoint) BeforeClass(org.junit.BeforeClass)

Example 12 with Server

use of com.nike.riposte.server.Server in project riposte by Nike-Inc.

the class VerifyRequestAndResponseFilteringComponentTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    serverConfig = new RequestAndResponseFilterTestConfig();
    server = new Server(serverConfig);
    server.startup();
}
Also used : Server(com.nike.riposte.server.Server) BeforeClass(org.junit.BeforeClass)

Example 13 with Server

use of com.nike.riposte.server.Server in project riposte by Nike-Inc.

the class VerifyPreEndpointExecutionWorkChainComponentTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    serverConfig = new PreEndpointExecutionWorkChainTestConfig(false);
    server = new Server(serverConfig);
    server.startup();
    downstreamServerConfig = new PreEndpointExecutionWorkChainTestConfig(false);
    downstreamServer = new Server(downstreamServerConfig);
    downstreamServer.startup();
    nonWorkChainServerConfig = new PreEndpointExecutionWorkChainTestConfig(true);
    nonWorkChainServer = new Server(nonWorkChainServerConfig);
    nonWorkChainServer.startup();
}
Also used : Server(com.nike.riposte.server.Server) BeforeClass(org.junit.BeforeClass)

Example 14 with Server

use of com.nike.riposte.server.Server in project riposte by Nike-Inc.

the class VerifyAsyncHttpClientHelperComponentTest method setup.

@BeforeClass
public static void setup() throws Exception {
    serverPort = findFreePort();
    serverConfig = new AppServerConfigForTesting(singleton(new TestEndpoint()), serverPort);
    server = new Server(serverConfig);
    server.startup();
}
Also used : Server(com.nike.riposte.server.Server) BeforeClass(org.junit.BeforeClass)

Example 15 with Server

use of com.nike.riposte.server.Server in project riposte by Nike-Inc.

the class ArchaiusServer method infrastructureInit.

/**
     * Initializes the Archaius system and configures the Netty leak detection level (if necessary).
     * DO NOT CALL THIS DIRECTLY. Use {@link #launchServer(String[])} when you're ready to start the server.
     */
protected void infrastructureInit() {
    MainClassUtils.setupJbossLoggingToUseSlf4j();
    try {
        Pair<String, String> appIdAndEnvironmentPair = MainClassUtils.getAppIdAndEnvironmentFromSystemProperties();
        ConfigurationManager.loadCascadedPropertiesFromResources(appIdAndEnvironmentPair.getLeft());
    } catch (IOException e) {
        throw new RuntimeException("Error loading Archaius properties", e);
    }
    AbstractConfiguration appConfig = ConfigurationManager.getConfigInstance();
    Function<String, Boolean> hasPropertyFunction = (propKey) -> appConfig.getProperty(propKey) != null;
    Function<String, String> propertyExtractionFunction = (propKey) -> {
        // Properties in Archaius might be a Collection or an Object.
        Object propValObj = appConfig.getProperty(propKey);
        return (propValObj instanceof Collection) ? ((Collection<?>) propValObj).stream().map(String::valueOf).collect(Collectors.joining(",")) : String.valueOf(propValObj);
    };
    Set<String> propKeys = new LinkedHashSet<>();
    appConfig.getKeys().forEachRemaining(propKeys::add);
    MainClassUtils.logApplicationPropertiesIfDebugActionsEnabled(hasPropertyFunction, propertyExtractionFunction, propKeys, false);
    MainClassUtils.setupNettyLeakDetectionLevel(hasPropertyFunction, propertyExtractionFunction);
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) MainClassUtils(com.nike.riposte.util.MainClassUtils) Collection(java.util.Collection) ConfigurationManager(com.netflix.config.ConfigurationManager) Set(java.util.Set) Server(com.nike.riposte.server.Server) IOException(java.io.IOException) Pair(com.nike.internal.util.Pair) ServerConfig(com.nike.riposte.server.config.ServerConfig) Function(java.util.function.Function) Collectors(java.util.stream.Collectors) LinkedHashSet(java.util.LinkedHashSet) LinkedHashSet(java.util.LinkedHashSet) IOException(java.io.IOException) AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) Collection(java.util.Collection)

Aggregations

Server (com.nike.riposte.server.Server)20 BeforeClass (org.junit.BeforeClass)15 ArrayList (java.util.ArrayList)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Future (java.util.concurrent.Future)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ConfigurationManager (com.netflix.config.ConfigurationManager)1 Pair (com.nike.internal.util.Pair)1 ServerConfig (com.nike.riposte.server.config.ServerConfig)1 Endpoint (com.nike.riposte.server.http.Endpoint)1 StandardEndpoint (com.nike.riposte.server.http.StandardEndpoint)1 SimpleProxyRouterEndpoint (com.nike.riposte.server.http.impl.SimpleProxyRouterEndpoint)1 MainClassUtils (com.nike.riposte.util.MainClassUtils)1 IOException (java.io.IOException)1 Collection (java.util.Collection)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)1