@Test public void smoke() throws Exception { List<Apollo> oracles = new ArrayList<>(); for (int i = 2; i < PregenPopulation.getCardinality() + 1; i++) { ApolloConfiguration config = new ApolloConfiguration(); config.avalanche.core.alpha = 0.6; config.avalanche.core.k = 6; config.avalanche.core.beta1 = 3; config.avalanche.core.beta2 = 5; config.communications = new ApolloConfiguration.SimCommunicationsFactory(); ApolloConfiguration.ResourceIdentitySource ks = new ApolloConfiguration.ResourceIdentitySource(); ks.store = PregenPopulation.memberKeystoreResource(i); config.source = ks; oracles.add(new Apollo(config)); } long then = System.currentTimeMillis(); oracles.forEach(oracle -> { try { oracle.start(); } catch (Exception e) { throw new IllegalStateException("unable to start oracle", e); } }); Client client = RULE.client(); boolean stabilized = Utils.waitForCondition(15_000, 1_000, () -> { return oracles.stream() .map(o -> o.getView()) .map(view -> view.getLive().size() != oracles.size() + 1 ? view : null) .filter(view -> view != null) .count() == 0; }); assertTrue("View did not stabilize", stabilized); System.out.println("View stabilized across " + (oracles.size() + 1) + " members in " + (System.currentTimeMillis() - then) + " millis"); Response response = client.target(String.format("http: RULE.getLocalPort())) .request(MediaType.APPLICATION_JSON) .post(Entity.json(new String( Base64.getUrlEncoder().withoutPadding().encode("Hello World".getBytes())))); assertEquals(200, response.getStatus()); Result genesisResult = response.readEntity(Result.class); assertNotNull(genesisResult); assertFalse(genesisResult.errorMessage, genesisResult.error); response = client.target(String.format("http: .request(MediaType.APPLICATION_JSON) .post(Entity.json(new ByteTransactionApi.ByteTransaction(40_000, "Hello World".getBytes()))); assertEquals(200, response.getStatus()); TransactionResult result = response.readEntity(TransactionResult.class); assertNotNull(result); assertFalse(result.errorMessage, result.error); response = client.target(String.format("http: .request() .post(Entity.text(result.result)); assertEquals(200, response.getStatus()); String fetched = response.readEntity(String.class); assertNotNull(fetched); assertEquals("Hello World", new String(DECODER.decode(fetched))); response = client.target(String.format("http: .request() .post(Entity.text(result.result)); assertEquals(200, response.getStatus()); DagNode dagNode = response.readEntity(DagNode.class); assertNotNull(dagNode); assertNotNull(dagNode.getData()); assertEquals("Hello World", new String(DECODER.decode(dagNode.getData()))); assertNotNull(dagNode.getLinks()); assertFalse(dagNode.getLinks().isEmpty()); response = client.target(String.format("http: RULE.getLocalPort())) .request(MediaType.APPLICATION_JSON) .post(Entity.json(new ByteTransactionApi.ByteTransaction(40_000, "Hello World 2".getBytes()))); assertEquals(200, response.getStatus()); String asyncResult = response.readEntity(String.class); assertNotNull(asyncResult); assertTrue(Utils.waitForCondition(60_000, 1_000, () -> { Response r = client.target(String.format("http: .request() .post(Entity.text(asyncResult)); return r.getStatus() == 200 && r.readEntity(QueryFinalizedResult.class).isFinalized(); })); response = client.target(String.format("http: .request() .get(); assertEquals(200, response.getStatus()); System.out.println(response.readEntity(String.class)); }
public void start() { apollo.start(); }
ApolloService extends Application<ApolloServiceConfiguration> { public void start() { apollo.start(); } }
ApolloService extends Application<ApolloServiceConfiguration> { public void start() { apollo.start(); }  }
ApolloService extends Application<ApolloServiceConfiguration> { public void start() { apollo.start(); }  static void main(String[] argv); Apollo getApollo(); @Override void run(ApolloServiceConfiguration configuration, Environment environment); void start(); void stop(); }
ApolloService extends Application<ApolloServiceConfiguration> { public void start() { apollo.start(); }  static void main(String[] argv); Apollo getApollo(); @Override void run(ApolloServiceConfiguration configuration, Environment environment); void start(); void stop();  }