use of suite.ExecutionContext in project tessera by ConsenSys.
the class ConfigGenerator method main.
public static void main(String[] args) throws Exception {
System.setProperty("jakarta.xml.bind.JAXBContextFactory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
System.setProperty("jakarta.xml.bind.context.factory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
ExecutionContext executionContext = ExecutionContext.Builder.create().with(CommunicationType.REST).with(DBType.H2).with(SocketType.UNIX).with(EnclaveType.LOCAL).prefix("p2p").build();
Path path = ConfigGenerator.calculatePath(executionContext);
List<Config> configs = new ConfigGenerator().createConfigs(executionContext);
for (int i = 1; i <= configs.size(); i++) {
String filename = String.format("config%d.json", i);
Path outputFile = path.resolve(filename);
System.out.println(outputFile);
}
}
use of suite.ExecutionContext in project tessera by ConsenSys.
the class SendRawIT method sendUnknownPublicKey.
/**
* Quorum sends transaction with unknown public key
*/
@Test
public void sendUnknownPublicKey() {
ExecutionContext executionContext = ExecutionContext.currentContext();
final String unknownkey = generateValidButUnknownPublicKey(executionContext.getEncryptorType()).encodeToBase64();
final Response response = client.target(sender.getQ2TUri()).path(SEND_PATH).request().header(SENDER, sender.getPublicKey()).header(RECIPIENTS, unknownkey).post(Entity.entity(TXN_DATA, MediaType.APPLICATION_OCTET_STREAM));
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(404);
}
use of suite.ExecutionContext in project tessera by ConsenSys.
the class SendIT method sendToUnknownPublicKey.
/**
* Quorum sends transaction to unknown public key
*/
@Test
public void sendToUnknownPublicKey() {
Party sendingParty = partyHelper.getParties().findAny().get();
byte[] transactionData = utils.createTransactionData();
final SendRequest sendRequest = new SendRequest();
sendRequest.setFrom(sendingParty.getPublicKey());
ExecutionContext executionContext = ExecutionContext.currentContext();
final String unknownkey = generateValidButUnknownPublicKey(executionContext.getEncryptorType()).encodeToBase64();
sendRequest.setTo(unknownkey);
sendRequest.setPayload(transactionData);
final Response response = sendingParty.getRestClient().target(sendingParty.getQ2TUri()).path(SEND_PATH).request().post(Entity.entity(sendRequest, MIME_TYPE_JSON_2_1));
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(404);
}
use of suite.ExecutionContext in project tessera by ConsenSys.
the class ConfigBuilder method main.
public static void main(String... args) throws Exception {
System.setProperty("jakarta.xml.bind.JAXBContextFactory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
System.setProperty("jakarta.xml.bind.context.factory", "org.eclipse.persistence.jaxb.JAXBContextFactory");
ExecutionContext executionContext = ExecutionContext.Builder.create().with(CommunicationType.REST).with(DBType.H2).with(SocketType.UNIX).with(EnclaveType.REMOTE).build();
Config config = new ConfigBuilder().withExecutionContext(executionContext).withNodeId("mynode").withNodeNumber(1).withPeer("http://localhost:999").withKeys("/+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc=", "yAWAJjwPqUtNVlqGjSrBmr1/iIkghuOh1803Yzx9jLM=").withQt2Port(999).withP2pPort(888).withEnclavePort(989).build();
JaxbUtil.marshalWithNoValidation(config, System.out);
}
use of suite.ExecutionContext in project tessera by ConsenSys.
the class SendIT method sendUnknownPublicKey.
/**
* Quorum sends transaction with unknown public key
*/
@Test
public void sendUnknownPublicKey() {
Party sendingParty = partyHelper.getParties().findAny().get();
byte[] transactionData = utils.createTransactionData();
final SendRequest sendRequest = new SendRequest();
sendRequest.setFrom(sendingParty.getPublicKey());
ExecutionContext executionContext = ExecutionContext.currentContext();
final String unknownkey = generateValidButUnknownPublicKey(executionContext.getEncryptorType()).encodeToBase64();
sendRequest.setTo(unknownkey);
sendRequest.setPayload(transactionData);
final Response response = sendingParty.getRestClient().target(sendingParty.getQ2TUri()).path(SEND_PATH).request().post(Entity.entity(sendRequest, MediaType.APPLICATION_JSON));
assertThat(response).isNotNull();
assertThat(response.getStatus()).isEqualTo(404);
}
Aggregations