@Test public void multipleRevisions() throws Exception { TestSpace ts = prepareTestSpace(); ts.nodes.forEach(n -> n.config.setIsFreeRegistrationsAllowedFromYaml(true)); Contract c1 = new Contract(TestKeys.privateKey(1)); c1.seal(); ts.client.register(c1.getPackedTransaction(),8000); ts.clients.forEach(cl -> { try { assertEquals(cl.getState(c1.getId()).state, ItemState.APPROVED); } catch (ClientError clientError) { clientError.printStackTrace(); assertTrue(false); } }); Contract c2 = c1.createRevision(TestKeys.privateKey(1)); c2.setOwnerKeys(TestKeys.privateKey(2).getPublicKey()); c2.getKeysToSignWith().clear(); c2.seal(); Contract c3 = c2.createRevision(TestKeys.privateKey(2)); c3.setOwnerKeys(TestKeys.privateKey(3).getPublicKey()); c3.getKeysToSignWith().clear(); c3.seal(); Contract batch = ContractsService.createBatch(Do.listOf(TestKeys.privateKey(1), TestKeys.privateKey(2), TestKeys.privateKey(3)), c2,c3); ItemResult ir = ts.client.register(batch.getPackedTransaction(), 8000); System.out.println(ir.errors); assertEquals(ir.state,ItemState.APPROVED); ts.clients.forEach(cl -> { try { assertEquals(cl.getState(c2.getId()).state, ItemState.REVOKED); assertEquals(cl.getState(c3.getId()).state, ItemState.APPROVED); } catch (ClientError clientError) { clientError.printStackTrace(); assertTrue(false); } }); ts.shutdown(); }
public void shutdown() { try { if (hookThread != null) Runtime.getRuntime().removeShutdownHook(hookThread); ledger.close(); log("shutting down"); network.shutdown(); clientHTTPServer.shutdown(); } catch (Exception e) { } synchronized (parser) { parser.notifyAll(); } try { logger.close(); } catch (Exception e) { e.printStackTrace(); } }
Main { public void shutdown() { try { if (hookThread != null) Runtime.getRuntime().removeShutdownHook(hookThread); ledger.close(); log("shutting down"); network.shutdown(); clientHTTPServer.shutdown(); } catch (Exception e) { } synchronized (parser) { parser.notifyAll(); } try { logger.close(); } catch (Exception e) { e.printStackTrace(); } } }
Main { public void shutdown() { try { if (hookThread != null) Runtime.getRuntime().removeShutdownHook(hookThread); ledger.close(); log("shutting down"); network.shutdown(); clientHTTPServer.shutdown(); } catch (Exception e) { } synchronized (parser) { parser.notifyAll(); } try { logger.close(); } catch (Exception e) { e.printStackTrace(); } } Main(String[] args); }
Main { public void shutdown() { try { if (hookThread != null) Runtime.getRuntime().removeShutdownHook(hookThread); ledger.close(); log("shutting down"); network.shutdown(); clientHTTPServer.shutdown(); } catch (Exception e) { } synchronized (parser) { parser.notifyAll(); } try { logger.close(); } catch (Exception e) { e.printStackTrace(); } } Main(String[] args); static void main(String[] args); void waitReady(); void shutdown(); void setVerboseLevel(int level); void setUDPVerboseLevel(int level); void restartUDPAdapter(); PublicKey getNodePublicKey(); }
Main { public void shutdown() { try { if (hookThread != null) Runtime.getRuntime().removeShutdownHook(hookThread); ledger.close(); log("shutting down"); network.shutdown(); clientHTTPServer.shutdown(); } catch (Exception e) { } synchronized (parser) { parser.notifyAll(); } try { logger.close(); } catch (Exception e) { e.printStackTrace(); } } Main(String[] args); static void main(String[] args); void waitReady(); void shutdown(); void setVerboseLevel(int level); void setUDPVerboseLevel(int level); void restartUDPAdapter(); PublicKey getNodePublicKey(); static final String NODE_VERSION; final Reporter reporter; final BufferedLogger logger; public NetConfig netConfig; public NetworkV2 network; final Config config; public NodeInfo myInfo; public Node node; public ItemCache cache; public ParcelCache parcelCache; public PaidOperationCache paidOperationCache; }