@Test public void testPermanetModeSearchTags() throws Exception { List<Main> mm = new ArrayList<>(); for (int i = 0; i < 4; i++) mm.add(createMain("node" + (i + 1), "_permanet", false)); Main main = mm.get(0); main.config.setIsFreeRegistrationsAllowedFromYaml(true); main.config.getKeysWhiteList().add(TestKeys.publicKey(20)); Client client = new Client(TestKeys.privateKey(20), main.myInfo, null); for (int i = 0; i < 4; i++) { mm.get(i).config.setIsFreeRegistrationsAllowedFromYaml(true); assertTrue(mm.get(i).config.isPermanetMode()); } main.config.setPermanetMode(false); assertTrue(main.config.isPermanetMode()); String value1 = HashId.createRandom().toBase64String(); String value2 = HashId.createRandom().toBase64String(); String value3 = HashId.createRandom().toBase64String(); Contract c = new Contract(TestKeys.privateKey(1)); c.getDefinition().getData().put("search_tags",Binder.of("tag1",value1,"tag2",value2,"tag3",value3)); c.seal(); assertEquals(client.register(c.getPackedTransaction(),8000).state,ItemState.APPROVED); Binder res = client.getContract(null, Binder.of("tag1", value1, "any_of", Binder.of("tag2", value2, "tag3", "AAA")), 10, 0); assertEquals(res.getListOrThrow("contractIds").size(),1); res = client.getContract(null, Binder.of("tag1", value1, "all_of", Binder.of("tag2", value2, "tag3", "AAA")), 10, 0); assertNull(res); res = client.getContract(null, Binder.of("tag1", "AAA", "all_of", Binder.of("tag2", value2, "tag3", value3)), 10, 0); assertNull(res); res = client.getContract(null, Binder.of("tag1", value1, "all_of", Binder.of("tag2", value2, "tag3", value3)), 10, 0); assertEquals(res.getListOrThrow("contractIds").size(),1); mm.forEach(x -> x.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; }