org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable Java Examples

The following examples show how to use org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SigningRequiredKeysTest.java    From evt4j with MIT License 6 votes vote down vote up
@Test
@EnabledIfEnvironmentVariable(named = "ENV", matches = "SigningRequiredKeysTest")
void test() {
    Assertions.assertDoesNotThrow(() -> {
        String transaction = "{\"actions\":[{\"name\":\"newdomain\"," + "\"data"
                + "\":\"4710f541def7681843650c062d0000000002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c2000000008052e74c0100000001010002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c20100000000b298e982a40100000001000001000000000094135c680100000001010002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c20100\",\"domain\":\"feitestdomainame9\",\"key\":\".create\"}],\"expiration\":\"2019-01-30T22:12:20\",\"ref_block_num\":53647,\"ref_block_prefix\":1474724499,\"max_charge\":1000000,\"payer\":\"EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND\"}";

        String[] publicKeys = new String[] { "EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND" };
        NetParams netParams = new TestNetNetParams();
        SigningRequiredKeys signingRequiredKeys = new SigningRequiredKeys();

        List<String> res = signingRequiredKeys.request(RequestParams.of(netParams, () -> {
            JSONObject json = new JSONObject();
            json.put("transaction", JSONObject.parseObject(transaction));
            json.put("available_keys", publicKeys);
            return json.toString();
        }));
        Assertions.assertEquals("EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND", res.get(0));
    });
}
 
Example #2
Source File: TransactionEstimatedChargeTest.java    From evt4j with MIT License 6 votes vote down vote up
@Test
@EnabledIfEnvironmentVariable(named = "ENV", matches = "TransactionEstimatedCharge")
void test() {
    Assertions.assertDoesNotThrow(() -> {
        String transaction = "{\"actions\":[{\"name\":\"newdomain\"," + "\"data"
                + "\":\"4710f541def7681843650c062d0000000002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c2000000008052e74c0100000001010002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c20100000000b298e982a40100000001000001000000000094135c680100000001010002c8f031561c4758c9551cff47246f2c347189fe684c04da35cf88e813f810e3c20100\",\"domain\":\"feitestdomainame9\",\"key\":\".create\"}],\"expiration\":\"2019-01-30T22:12:20\",\"ref_block_num\":53647,\"ref_block_prefix\":1474724499,\"max_charge\":1000000,\"payer\":\"EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND\"}";

        NetParams netParams = new TestNetNetParams();
        TransactionEstimatedCharge transactionEstimatedCharge = new TransactionEstimatedCharge();

        Charge res = transactionEstimatedCharge.request(RequestParams.of(netParams, () -> {
            JSONObject json = new JSONObject();
            json.put("transaction", JSONObject.parseObject(transaction));
            json.put("sign_num", 1);
            return json.toString();
        }));

        Assertions.assertTrue(res.getCharge() > 0);
    });
}
 
Example #3
Source File: RemoteAbiSerialisationProviderInterfaceTest.java    From evt4j with MIT License 5 votes vote down vote up
@Test
@Tag("Integration")
@EnabledIfEnvironmentVariable(named = "ENV", matches = "INTEGRATION")
@DisplayName("Serialize Abi via node")
void serializeViaAbi() {
    String data = "{\"action\":\"newgroup\",\"args\":{\"name\":\"testgroupcreationfei\",\"group\":{\"name\":"
            + "\"testgroupcreationfei\",\"key\":\"EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND\","
            + "\"root\":{\"threshold\":6,\"weight\":0,\"nodes\":[{\"threshold\":1,\"weight\":3,\"nodes\":"
            + "[{\"key\":\"EVT6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\",\"weight\":1},{\"key\""
            + ":\"EVT8MGU4aKiVzqMtWi9zLpu8KuTHZWjQQrX475ycSxEkLd6aBpraX\",\"weight\":1}]},{\"key\":"
            + "\"EVT8MGU4aKiVzqMtWi9zLpu8KuTHZWjQQrX475ycSxEkLd6aBpraX\",\"weight\":3},{\"threshold\":"
            + "1,\"weight\":3,\"nodes\":[{\"key\":\"EVT6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV\","
            + "\"weight\":"
            + "1},{\"key\":\"EVT8MGU4aKiVzqMtWi9zLpu8KuTHZWjQQrX475ycSxEkLd6aBpraX\",\"weight\":1}]}]}}}}";
    String newDomain = "{\"args\":\"{\"name\":\"testingTmpData\","
            + "\"creator\":\"EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND\","
            + "\"issue\":{\"name\":\"issue\",\"threshold\":1,"
            + "\"authorizers\":[{\"ref\":\"[A] EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgND\","
            + "\"weight\":1}]},\"transfer\":{\"name\":\"transfer\",\"threshold\":1,"
            + "\"authorizers\":[{\"ref\":\"[G] .OWNER\",\"weight\":1}]},"
            + "\"manage\":{\"name\":\"manage\",\"threshold\":1," + "\"authorizers\":[{\"ref\":\"[A] "
            + "EVT6Qz3wuRjyN6gaU3P3XRxpnEZnM4oPxortemaWDwFRvsv2FxgNDy\",\"weight\":1}]}}\","
            + "\"action\":\"newdomain\"}";

    Assertions.assertDoesNotThrow(() -> {
        NetParams netParams = new TestNetNetParams();
        RemoteAbiSerialisationProvider provider = new RemoteAbiSerialisationProvider(netParams);
        JSONObject.parseObject(provider.serialize(data));
    });
}
 
Example #4
Source File: InfluxDBTest.java    From influxdb-java with MIT License 5 votes vote down vote up
/**
  * Test initialize InfluxDBImpl with MessagePack format for InfluxDB versions before 1.4 will throw exception
  */
@Test
@EnabledIfEnvironmentVariable(named = "INFLUXDB_VERSION", matches = "1\\.3|1\\.2|1\\.1")
public void testMessagePackOnOldDbVersion() {
  Assertions.assertThrows(UnsupportedOperationException.class, () -> {
    InfluxDB influxDB = TestUtils.connectToInfluxDB(ResponseFormat.MSGPACK);
    influxDB.describeDatabases();
  });
}
 
Example #5
Source File: DisabledTests.java    From journaldev with MIT License 4 votes vote down vote up
@Test
@EnabledIfEnvironmentVariable(named = "USER", matches = "pankaj")
void test7() {
	assertTrue("pankaj".equals(System.getenv("USER")));
}
 
Example #6
Source File: RedisMiniServer.java    From calcite with Apache License 2.0 4 votes vote down vote up
@EnabledIfEnvironmentVariable(named = "RedisMiniServerEnabled", matches = "true")
@Test void redisServerMiniTest() {
}