test_class.file: pross-server/src/test/java/com/ibm/pross/server/configuration/permissions/ClientPermissionsTest.java
test_class.identifier: ClientPermissionsTest
test_case.body: @Test
  	public void testRemovePermission() {
  		ClientPermissions clientPermission = new ClientPermissions();
  
  		final String secret1 = "test1";
  		final String secret2 = "test2";
  		final String secret3 = "test3";
  		clientPermission.addPermission(secret1, Permissions.GENERATE);
  		Assert.assertEquals(1, clientPermission.getSecrets().size());
  
  		// Ensure only one permission impacted
  		Assert.assertTrue(clientPermission.hasPermission(secret1, Permissions.GENERATE));
  		Assert.assertFalse(clientPermission.hasPermission(secret2, Permissions.GENERATE));
  
  		// Ensure no other permissions impacted
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.DELETE));
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.DISABLE));
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.ENABLE));
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.EXPONENTIATE));
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.INFO));
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.READ));
  
  		// Test remove never-referenced secret
  		clientPermission.removePermission(secret3, Permissions.GENERATE);
  		Assert.assertFalse(clientPermission.hasPermission(secret3, Permissions.GENERATE));
  		Assert.assertEquals(1, clientPermission.getSecrets().size());
  
  		// Test remove non-existent secret
  		clientPermission.removePermission(secret2, Permissions.GENERATE);
  		Assert.assertFalse(clientPermission.hasPermission(secret2, Permissions.GENERATE));
  		Assert.assertEquals(1, clientPermission.getSecrets().size());
  
  		// Test remove non-existent permission
  		clientPermission.removePermission(secret1, Permissions.INFO);
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.INFO));
  		Assert.assertEquals(1, clientPermission.getSecrets().size());
  
  		// Test remove existing permission
  		Assert.assertTrue(clientPermission.hasPermission(secret1, Permissions.GENERATE));
  		clientPermission.removePermission(secret1, Permissions.GENERATE);
  		Assert.assertEquals(0, clientPermission.getSecrets().size());
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.GENERATE));
  
  		// Test double remove
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.GENERATE));
  		clientPermission.removePermission(secret1, Permissions.GENERATE);
  		Assert.assertEquals(0, clientPermission.getSecrets().size());
  		Assert.assertFalse(clientPermission.hasPermission(secret1, Permissions.GENERATE));
  	}
test_case.class_method_signature: ClientPermissionsTest.testRemovePermission()
test_case.full_signature: @Test public void testRemovePermission()
test_case.identifier: testRemovePermission
test_case.invocations: addPermission assertEquals size getSecrets assertTrue hasPermission assertFalse hasPermission assertFalse hasPermission assertFalse hasPermission assertFalse hasPermission assertFalse hasPermission assertFalse hasPermission assertFalse hasPermission removePermission assertFalse hasPermission assertEquals size getSecrets removePermission assertFalse hasPermission assertEquals size getSecrets removePermission assertFalse hasPermission assertEquals size getSecrets assertTrue hasPermission removePermission assertEquals size getSecrets assertFalse hasPermission assertFalse hasPermission removePermission assertEquals size getSecrets assertFalse hasPermission
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRemovePermission()
focal_class.declarator: secretPermissions
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, Integer> secretPermissions;
focal_class.type: ConcurrentMap<String, Integer>
focal_class.var_name: secretPermissions
focal_class.file: pross-server/src/main/java/com/ibm/pross/server/configuration/permissions/ClientPermissions.java
focal_class.identifier: ClientPermissions
focal_class.class_method_signature: ClientPermissions.ClientPermissions()
focal_class.full_signature: public  ClientPermissions()
focal_class.identifier: ClientPermissions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  ClientPermissions()
focal_class.class_method_signature: ClientPermissions.ClientPermissions(final Map<String, Integer> secretPermissions)
focal_class.full_signature: public  ClientPermissions(final Map<String, Integer> secretPermissions)
focal_class.identifier: ClientPermissions
focal_class.modifiers: public
focal_class.parameters: (final Map<String, Integer> secretPermissions)
focal_class.signature:  ClientPermissions(final Map<String, Integer> secretPermissions)
focal_class.class_method_signature: ClientPermissions.addPermission(final String secretName, final Permissions permission)
focal_class.full_signature: public void addPermission(final String secretName, final Permissions permission)
focal_class.identifier: addPermission
focal_class.modifiers: public
focal_class.parameters: (final String secretName, final Permissions permission)
focal_class.return: void
focal_class.signature: void addPermission(final String secretName, final Permissions permission)
focal_class.class_method_signature: ClientPermissions.removePermission(final String secretName, final Permissions permission)
focal_class.full_signature: public void removePermission(final String secretName, final Permissions permission)
focal_class.identifier: removePermission
focal_class.modifiers: public
focal_class.parameters: (final String secretName, final Permissions permission)
focal_class.return: void
focal_class.signature: void removePermission(final String secretName, final Permissions permission)
focal_class.class_method_signature: ClientPermissions.hasPermission(final String secretName, final Permissions permission)
focal_class.full_signature: public boolean hasPermission(final String secretName, final Permissions permission)
focal_class.identifier: hasPermission
focal_class.modifiers: public
focal_class.parameters: (final String secretName, final Permissions permission)
focal_class.return: boolean
focal_class.signature: boolean hasPermission(final String secretName, final Permissions permission)
focal_class.class_method_signature: ClientPermissions.clearPermission(final String secretName)
focal_class.full_signature: public void clearPermission(final String secretName)
focal_class.identifier: clearPermission
focal_class.modifiers: public
focal_class.parameters: (final String secretName)
focal_class.return: void
focal_class.signature: void clearPermission(final String secretName)
focal_class.class_method_signature: ClientPermissions.clearAllPermissions()
focal_class.full_signature: public void clearAllPermissions()
focal_class.identifier: clearAllPermissions
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearAllPermissions()
focal_class.class_method_signature: ClientPermissions.getSecrets()
focal_class.full_signature: protected Set<String> getSecrets()
focal_class.identifier: getSecrets
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: Set<String>
focal_class.signature: Set<String> getSecrets()
focal_method.body: public void removePermission(final String secretName, final Permissions permission) {
  		synchronized (this.secretPermissions) {
  			// Get the previous value (if any)
  			final Integer previous = this.secretPermissions.get(secretName);
  
  			// We need to update the existing value
  			if (previous != null) {
  				final Integer updated = (previous & ~permission.getCode()); // mask the bits with and of not
  
  				if (updated == 0) {
  					this.secretPermissions.remove(secretName);
  				} else {
  					this.secretPermissions.put(secretName, updated);
  				}
  			}
  		}
  	}
focal_method.class_method_signature: ClientPermissions.removePermission(final String secretName, final Permissions permission)
focal_method.full_signature: public void removePermission(final String secretName, final Permissions permission)
focal_method.identifier: removePermission
focal_method.invocations: get getCode remove put
focal_method.modifiers: public
focal_method.parameters: (final String secretName, final Permissions permission)
focal_method.return: void
focal_method.signature: void removePermission(final String secretName, final Permissions permission)