Skip to content

Commit

Permalink
HPCC4J-614 Code review 2
Browse files Browse the repository at this point in the history
- Adds fetch encoded key test
- Adds fetch invalid key test

Signed-off-by: Rodrigo Pastrana <rodrigo.pastrana@lexisnexisrisk.com>
  • Loading branch information
rpastrana committed Jul 12, 2024
1 parent 474a241 commit 758587c
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,26 @@ public void zz91deleteEncodedNSTest() throws Exception, ArrayOfEspExceptionWrapp
}
}

@Test
public void a3fetchInvalidKeyTest()
{
try
{
System.out.println("Fetching invalid key " + defaultEncodedStoreName + "." + defaultEncodedNS + "keys...");
String invalidKeyResponse = client.fetchValue(storename, namespace, "invalid.global.test", true);

Assert.assertNull(invalidKeyResponse);
}
catch (ArrayOfEspExceptionWrapper e)
{
Assert.fail(e.toString());
}
catch (Exception e)
{
Assert.fail(e.getLocalizedMessage());
}
}

@Test
public void b4fetchAllEncodedNSKeysTest()
{
Expand Down Expand Up @@ -461,6 +481,33 @@ public void b4fetchEncodedNSKeysAttributesTest()
}
}

@Test
public void b4fetchEncodedKeyTest()
{
Assume.assumeNotNull(encodedUserClient);
try
{
System.out.println("Fetching encoded key attributes: " + defaultEncodedStoreName + "." + defaultEncodedNS + ".encod@ble");
Properties fetchKeyMetadata = encodedUserClient.fetchKeyMetaData(defaultEncodedStoreName, defaultEncodedNS, "encod@ble", true);
Assert.assertNotNull(fetchKeyMetadata);
System.out.println("Key Metadata: " + fetchKeyMetadata.toString());

System.out.println("Fetching encoded key: " + defaultEncodedStoreName + "." + defaultEncodedNS + ".encod@ble");
String fetchedValue = encodedUserClient.fetchValue(defaultEncodedStoreName, defaultEncodedNS, "encod@ble", true);
Assert.assertNotNull(fetchedValue);
Assert.assertTrue(fetchedValue.equals("whatever"));
System.out.println("Key/value: " + fetchedValue.toString());
}
catch (ArrayOfEspExceptionWrapper e)
{
Assert.fail(e.toString());
}
catch (Exception e)
{
Assert.fail(e.getLocalizedMessage());
}
}

@Test
public void b3setEncodedTest() throws Exception, ArrayOfEspExceptionWrapper
{
Expand All @@ -470,6 +517,7 @@ public void b3setEncodedTest() throws Exception, ArrayOfEspExceptionWrapper
System.out.println("Setting " + defaultEncodedStoreName + "." + defaultEncodedNS + "." + "WsClient.global.test=\"success\"...");
Assert.assertTrue(encodedUserClient.setValue(defaultEncodedStoreName, defaultEncodedNS, "global.test", "success", true));
Assert.assertTrue(encodedUserClient.setValue(defaultEncodedStoreName, defaultEncodedNS, "a", "ddfa", true));
Assert.assertTrue(encodedUserClient.setValue(defaultEncodedStoreName, defaultEncodedNS, "encod@ble", "whatever", true));

Assert.assertTrue(encodedUserClient.setValue(defaultEncodedStoreName, defaultEncodedNS, "global.test", "success", true));
System.out.println("Setting " + defaultEncodedStoreName + "." + defaultEncodedNS + "." + "WsClient.user.test=\"success\"...");
Expand Down

0 comments on commit 758587c

Please sign in to comment.