@Test public void anonymizeRoleForTwoContractsWithNames() throws Exception { callMain2("-create", rootPath + "TokenDSLTemplate.yml", "--output", basePath + "forRoleAnonymizing1.unicon", "-k", rootPath + "_xer0yfe2nn1xthc.private.unikey"); callMain2("-create", rootPath + "TokenDSLTemplate.yml", "--output", basePath + "forRoleAnonymizing2.unicon", "-k", rootPath + "_xer0yfe2nn1xthc.private.unikey"); assertTrue (new File(basePath + "forRoleAnonymizing1.unicon").exists()); assertTrue (new File(basePath + "forRoleAnonymizing2.unicon").exists()); callMain("-anonymize", basePath + "forRoleAnonymizing1.unicon", basePath + "forRoleAnonymizing2.unicon", "-role", "issuer", "--output", basePath + "myAnon1.unicon", "--output", basePath + "myAnon2.unicon"); assertTrue (new File(basePath + "myAnon1.unicon").exists()); assertTrue (new File(basePath + "myAnon2.unicon").exists()); System.out.println(output); PrivateKey key = new PrivateKey(Do.read(rootPath + "_xer0yfe2nn1xthc.private.unikey")); Contract contract1 = CLIMain.loadContract(basePath + "myAnon1.unicon", true); assertFalse(contract1.getIssuer().getKeys().contains(key.getPublicKey())); Contract anonPublishedContract1 = new Contract(contract1.getLastSealedBinary()); assertFalse(anonPublishedContract1.getIssuer().getKeys().contains(key.getPublicKey())); assertFalse(anonPublishedContract1.getSealedByKeys().contains(key.getPublicKey())); Contract contract2 = CLIMain.loadContract(basePath + "myAnon2.unicon", true); assertFalse(contract2.getIssuer().getKeys().contains(key.getPublicKey())); Contract anonPublishedContract2 = new Contract(contract2.getLastSealedBinary()); assertFalse(anonPublishedContract2.getIssuer().getKeys().contains(key.getPublicKey())); assertFalse(anonPublishedContract2.getSealedByKeys().contains(key.getPublicKey())); }
public static Contract loadContract(String fileName, Boolean fromPackedTransaction) throws IOException { Contract contract = null; File pathFile = new File(fileName); if (pathFile.exists()) { Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); try { if (fromPackedTransaction) { contract = Contract.fromPackedTransaction(data); } else { contract = new Contract(data); } } catch (Quantiser.QuantiserException e) { addError("QUANTIZER_COST_LIMIT", fileName, e.toString()); } } else { addError(Errors.NOT_FOUND.name(), fileName, "Path " + fileName + " does not exist"); } return contract; }
CLIMain { public static Contract loadContract(String fileName, Boolean fromPackedTransaction) throws IOException { Contract contract = null; File pathFile = new File(fileName); if (pathFile.exists()) { Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); try { if (fromPackedTransaction) { contract = Contract.fromPackedTransaction(data); } else { contract = new Contract(data); } } catch (Quantiser.QuantiserException e) { addError("QUANTIZER_COST_LIMIT", fileName, e.toString()); } } else { addError(Errors.NOT_FOUND.name(), fileName, "Path " + fileName + " does not exist"); } return contract; } }
CLIMain { public static Contract loadContract(String fileName, Boolean fromPackedTransaction) throws IOException { Contract contract = null; File pathFile = new File(fileName); if (pathFile.exists()) { Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); try { if (fromPackedTransaction) { contract = Contract.fromPackedTransaction(data); } else { contract = new Contract(data); } } catch (Quantiser.QuantiserException e) { addError("QUANTIZER_COST_LIMIT", fileName, e.toString()); } } else { addError(Errors.NOT_FOUND.name(), fileName, "Path " + fileName + " does not exist"); } return contract; }  }
CLIMain { public static Contract loadContract(String fileName, Boolean fromPackedTransaction) throws IOException { Contract contract = null; File pathFile = new File(fileName); if (pathFile.exists()) { Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); try { if (fromPackedTransaction) { contract = Contract.fromPackedTransaction(data); } else { contract = new Contract(data); } } catch (Quantiser.QuantiserException e) { addError("QUANTIZER_COST_LIMIT", fileName, e.toString()); } } else { addError(Errors.NOT_FOUND.name(), fileName, "Path " + fileName + " does not exist"); } return contract; }  static void main(String[] args); static PrivateKey getPrivateKey(); static BasicHttpClientSession getSession(int nodeNumber); static void breakSession(int nodeNumber); static void clearSession(); static void clearSession(boolean full); static void saveSession(); static void setVerboseMode(boolean verboseMode); static Contract loadContract(String fileName, Boolean fromPackedTransaction); static Parcel loadParcel(String fileName); static Contract loadContract(String fileName); static void exportContract(Contract contract, String fileName, String format, Boolean jsonPretty); static boolean saveContract(Contract contract, String fileName, Boolean fromPackedTransaction, Boolean addSigners); static boolean saveContract(Contract contract, String fileName, Boolean fromPackedTransaction, Boolean addSigners, Set<Contract> referencedItems); static boolean saveParcel(Parcel parcel, String fileName); static void saveContract(Contract contract, String fileName); static List<Wallet> findWallets(String path); static HashMap<String, Contract> findContracts(String path); static HashMap<String, Contract> findContracts(String path, Boolean recursively); static List<File> findFiles(String path, Boolean recursively); static Contract downloadContract(String url); static Parcel revokeContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment, PrivateKey... key); @Deprecated static Contract revokeContract(Contract contract, PrivateKey... key); @Deprecated static void registerContract(Contract contract, int waitTime, Boolean fromPackedTransaction); static Parcel prepareForRegisterContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment); static Parcel prepareForRegisterPayingParcel(Contract contract, Contract u, int amount, int amountStorage, Set<PrivateKey> uKeys, boolean withTestPayment); static ItemResult registerParcel(Parcel parcel, int waitTime); static void registerContract(Contract contract); static void registerContract(Contract contract, int waitTime); static void setTestMode(); static void setTestRootPath(String rootPath); static void setNodeNumber(int number); static void setNodeUrl(String url); static void setTopologyFileName(String filename); static void setPrivateKey(PrivateKey key); static Reporter getReporter(); static synchronized ClientNetwork getClientNetwork(); static synchronized Map<String, PrivateKey> keysMap(); static synchronized Map<String, PrivateKey> keysMapContract(); }
CLIMain { public static Contract loadContract(String fileName, Boolean fromPackedTransaction) throws IOException { Contract contract = null; File pathFile = new File(fileName); if (pathFile.exists()) { Path path = Paths.get(fileName); byte[] data = Files.readAllBytes(path); try { if (fromPackedTransaction) { contract = Contract.fromPackedTransaction(data); } else { contract = new Contract(data); } } catch (Quantiser.QuantiserException e) { addError("QUANTIZER_COST_LIMIT", fileName, e.toString()); } } else { addError(Errors.NOT_FOUND.name(), fileName, "Path " + fileName + " does not exist"); } return contract; }  static void main(String[] args); static PrivateKey getPrivateKey(); static BasicHttpClientSession getSession(int nodeNumber); static void breakSession(int nodeNumber); static void clearSession(); static void clearSession(boolean full); static void saveSession(); static void setVerboseMode(boolean verboseMode); static Contract loadContract(String fileName, Boolean fromPackedTransaction); static Parcel loadParcel(String fileName); static Contract loadContract(String fileName); static void exportContract(Contract contract, String fileName, String format, Boolean jsonPretty); static boolean saveContract(Contract contract, String fileName, Boolean fromPackedTransaction, Boolean addSigners); static boolean saveContract(Contract contract, String fileName, Boolean fromPackedTransaction, Boolean addSigners, Set<Contract> referencedItems); static boolean saveParcel(Parcel parcel, String fileName); static void saveContract(Contract contract, String fileName); static List<Wallet> findWallets(String path); static HashMap<String, Contract> findContracts(String path); static HashMap<String, Contract> findContracts(String path, Boolean recursively); static List<File> findFiles(String path, Boolean recursively); static Contract downloadContract(String url); static Parcel revokeContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment, PrivateKey... key); @Deprecated static Contract revokeContract(Contract contract, PrivateKey... key); @Deprecated static void registerContract(Contract contract, int waitTime, Boolean fromPackedTransaction); static Parcel prepareForRegisterContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment); static Parcel prepareForRegisterPayingParcel(Contract contract, Contract u, int amount, int amountStorage, Set<PrivateKey> uKeys, boolean withTestPayment); static ItemResult registerParcel(Parcel parcel, int waitTime); static void registerContract(Contract contract); static void registerContract(Contract contract, int waitTime); static void setTestMode(); static void setTestRootPath(String rootPath); static void setNodeNumber(int number); static void setNodeUrl(String url); static void setTopologyFileName(String filename); static void setPrivateKey(PrivateKey key); static Reporter getReporter(); static synchronized ClientNetwork getClientNetwork(); static synchronized Map<String, PrivateKey> keysMap(); static synchronized Map<String, PrivateKey> keysMapContract(); static String DEFAULT_WALLET_PATH; static final String AMOUNT_FIELD_NAME; }