@BeforeClass public static void setUp() throws Exception { LangExecutionUtil.setUp(TEST_CONFIG_FILE_NAME, testExecutor); final NodeControllerService[] ncs = ExecutionTestUtil.integrationUtil.ncs; final Map<String, InetSocketAddress> ncEndPoints = new HashMap<>(); final String ip = InetAddress.getLoopbackAddress().getHostAddress(); for (NodeControllerService nc : ncs) { final String nodeId = nc.getId(); final INcApplicationContext appCtx = (INcApplicationContext) nc.getApplicationContext(); int apiPort = appCtx.getExternalProperties().getNcApiPort(); ncEndPoints.put(nodeId, InetSocketAddress.createUnresolved(ip, apiPort)); } testExecutor.setNcEndPoints(ncEndPoints); }
@Before public void before() throws Exception { LangExecutionUtil.setUp(TEST_CONFIG_FILE_NAME, testExecutor); if (!configured) { final NodeControllerService[] ncs = ExecutionTestUtil.integrationUtil.ncs; Map<String, InetSocketAddress> ncEndPoints = new HashMap<>(); Map<String, InetSocketAddress> replicationAddress = new HashMap<>(); final String ip = InetAddress.getLoopbackAddress().getHostAddress(); for (NodeControllerService nc : ncs) { final String nodeId = nc.getId(); final INcApplicationContext appCtx = (INcApplicationContext) nc.getApplicationContext(); int apiPort = appCtx.getExternalProperties().getNcApiPort(); int replicationPort = (int) appCtx.getServiceContext().getAppConfig().get(NCConfig.Option.REPLICATION_LISTEN_PORT); ncEndPoints.put(nodeId, InetSocketAddress.createUnresolved(ip, apiPort)); replicationAddress.put(nodeId, InetSocketAddress.createUnresolved(ip, replicationPort)); } testExecutor.setNcEndPoints(ncEndPoints); testExecutor.setNcReplicationAddress(replicationAddress); configured = true; } }
@Before public void before() throws Exception { TestUtils.redirectLoggingToConsole(); LangExecutionUtil.setUp(TEST_CONFIG_FILE_NAME, testExecutor); if (!configured) { final NodeControllerService[] ncs = ExecutionTestUtil.integrationUtil.ncs; Map<String, InetSocketAddress> ncEndPoints = new HashMap<>(); Map<String, InetSocketAddress> replicationAddress = new HashMap<>(); final String ip = InetAddress.getLoopbackAddress().getHostAddress(); for (NodeControllerService nc : ncs) { final String nodeId = nc.getId(); final INcApplicationContext appCtx = (INcApplicationContext) nc.getApplicationContext(); int apiPort = appCtx.getExternalProperties().getNcApiPort(); int replicationPort = (int) appCtx.getServiceContext().getAppConfig().get(NCConfig.Option.REPLICATION_LISTEN_PORT); ncEndPoints.put(nodeId, InetSocketAddress.createUnresolved(ip, apiPort)); replicationAddress.put(nodeId, InetSocketAddress.createUnresolved(ip, replicationPort)); } testExecutor.setNcEndPoints(ncEndPoints); testExecutor.setNcReplicationAddress(replicationAddress); configured = true; } }
protected void configureServers() throws Exception { final ExternalProperties externalProperties = getApplicationContext().getExternalProperties(); final HttpServerConfig config = HttpServerConfigBuilder.custom().setMaxRequestSize(externalProperties.getMaxWebRequestSize()).build(); HttpServer apiServer = new HttpServer(webManager.getBosses(), webManager.getWorkers(), externalProperties.getNcApiPort(), config); apiServer.setAttribute(ServletConstants.SERVICE_CONTEXT_ATTR, ncServiceCtx); apiServer.addServlet(new StorageApiServlet(apiServer.ctx(), getApplicationContext(), Servlets.STORAGE)); apiServer.addServlet( new NetDiagnosticsApiServlet(apiServer.ctx(), getApplicationContext(), Servlets.NET_DIAGNOSTICS)); webManager.add(apiServer); }