Skip to content

Commit

Permalink
FAB-8937 testGetInfo liberal check
Browse files Browse the repository at this point in the history
Change-Id: I67cb5f15aeabda3341ef7cd770f19cc4d547aec0
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Mar 17, 2018
1 parent 4c4b546 commit 6ef1bc8
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ public void testCertificateRevoke() throws Exception {
ASN1OctetString akiOc = ASN1OctetString.getInstance(extensionValue);
String aki = DatatypeConverter.printHexBinary(AuthorityKeyIdentifier.getInstance(akiOc.getOctets()).getKeyIdentifier());


int startedWithRevokes = -1;

if (!testConfig.isRunningAgainstFabric10()) {
Expand All @@ -434,7 +433,6 @@ public void testCertificateRevoke() throws Exception {
}
}


// Tests attempting to revoke a user with Null reason
@Test
public void testUserRevokeNullReason() throws Exception {
Expand Down Expand Up @@ -605,8 +603,8 @@ public void testCreateAndGetIdentity() throws Exception {
Boolean found = false;
for (Attribute attr : attrs) {
if (attr.getName().equals("testattr1")) {
found = true;
break;
found = true;
break;
}
}

Expand Down Expand Up @@ -642,7 +640,7 @@ public void testGetAllIdentity() throws Exception {
ident.create(admin);

Collection<HFCAIdentity> foundIdentities = client.getHFCAIdentities(admin);
String[] expectedIdenities = new String[]{"testuser2", "admin"};
String[] expectedIdenities = new String[] {"testuser2", "admin"};
Integer found = 0;

for (HFCAIdentity id : foundIdentities) {
Expand Down Expand Up @@ -797,7 +795,8 @@ public void testGetAllAffiliation() throws Exception {
ArrayList<String> expectedFirstLevelAffiliations = new ArrayList<String>(Arrays.asList("org2", "org1"));
int found = 0;
for (HFCAAffiliation aff : resp.getChildren()) {
for (Iterator<String> iter = expectedFirstLevelAffiliations.iterator(); iter.hasNext();) {
for (Iterator<String> iter = expectedFirstLevelAffiliations.iterator(); iter.hasNext();
) {
String element = iter.next();
if (aff.getName().equals(element)) {
iter.remove();
Expand All @@ -812,12 +811,7 @@ public void testGetAllAffiliation() throws Exception {
ArrayList<String> expectedSecondLevelAffiliations = new ArrayList<String>(Arrays.asList("org2.department1", "org1.department1", "org1.department2"));
for (HFCAAffiliation aff : resp.getChildren()) {
for (HFCAAffiliation aff2 : aff.getChildren()) {
for (Iterator<String> iter = expectedSecondLevelAffiliations.iterator(); iter.hasNext();) {
String element = iter.next();
if (aff2.getName().equals(element)) {
iter.remove();
}
}
expectedSecondLevelAffiliations.removeIf(element -> aff2.getName().equals(element));
}
}

Expand Down Expand Up @@ -1092,7 +1086,10 @@ public void testGetInfo() throws Exception {

if (!testConfig.isRunningAgainstFabric10()) {
HFCAInfo info = client.info();
assertTrue(info.getVersion().contains("1.1.0"));
assertNotNull("client.info returned null.", info);
String version = info.getVersion();
assertNotNull("client.info.getVersion returned null.", version);
assertTrue(format("Version '%s' didn't match expected pattern", version), version.matches("^\\d+\\.\\d+\\.\\d+($|-.*)"));
}

}
Expand Down

0 comments on commit 6ef1bc8

Please # to comment.