Source:
public void testAccessGroups() throws Exception { Dictionary authZProperties = null; Dictionary metacardAttributeSecurityFilterProperties = null; String testData = IOUtils.toString( IOUtils.toInputStream( getFileContent(XML_RECORD_RESOURCE_PATH + "/accessGroupTokenMetacard.xml"))); testData = testData.replace(ACCESS_GROUP_REPLACE_TOKEN, "B"); String id = CatalogTestCommons.ingest(testData, MediaType.TEXT_XML); String url = SERVICE_ROOT.getUrl() + "/catalog/query?q=" + id + "&src=local"; try { authZProperties = configureAuthZRealm( Collections.emptyList(), Collections.singletonList( "<LINK_1>"), Collections.emptyList(), getAdminConfig()); metacardAttributeSecurityFilterProperties = configureMetacardAttributeSecurityFiltering( Collections.singletonList("security.access-groups=accessGroups"), Collections.emptyList(), getAdminConfig()); configureRestForBasic(SDK_SOAP_CONTEXT); waitForSecurityHandlers(url); getSecurityPolicy().waitForBasicAuthReady(url); queryWithBasicAuth(id, TRANSFORMER_XML, A_USER, USER_PASSWORD, HttpStatus.SC_NOT_FOUND); String response = queryWithBasicAuth(id, TRANSFORMER_XML, B_USER, USER_PASSWORD); assertThat(response, containsString("Lady Liberty")); configureRestForGuest(SDK_SOAP_CONTEXT); waitForSecurityHandlers(url); getSecurityPolicy().waitForGuestAuthReady(url); query(id, TRANSFORMER_XML, HttpStatus.SC_NOT_FOUND); } finally { if (authZProperties != null) { configureAuthZRealm(authZProperties, getAdminConfig()); } if (metacardAttributeSecurityFilterProperties != null) { configureMetacardAttributeSecurityFiltering( metacardAttributeSecurityFilterProperties, getAdminConfig()); } configureRestForGuest(SDK_SOAP_CONTEXT); waitForSecurityHandlers(url); getSecurityPolicy().waitForGuestAuthReady(url); } }

Target:
public void testAccessGroups() throws Exception { Dictionary authZProperties = null; Dictionary metacardAttributeSecurityFilterProperties = null; String testData = getFileContent(XML_RECORD_RESOURCE_PATH + "/accessGroupTokenMetacard.xml"); testData = testData.replace(ACCESS_GROUP_REPLACE_TOKEN, "B"); String id = CatalogTestCommons.ingest(testData, MediaType.TEXT_XML); String url = SERVICE_ROOT.getUrl() + "/catalog/query?q=" + id + "&src=local"; try { authZProperties = configureAuthZRealm( Collections.emptyList(), Collections.singletonList( "<LINK_1>"), Collections.emptyList(), getAdminConfig()); metacardAttributeSecurityFilterProperties = configureMetacardAttributeSecurityFiltering( Collections.singletonList("security.access-groups=accessGroups"), Collections.emptyList(), getAdminConfig()); configureRestForBasic(SDK_SOAP_CONTEXT); waitForSecurityHandlers(url); getSecurityPolicy().waitForBasicAuthReady(url); queryWithBasicAuth(id, TRANSFORMER_XML, A_USER, USER_PASSWORD, HttpStatus.SC_NOT_FOUND); String response = queryWithBasicAuth(id, TRANSFORMER_XML, B_USER, USER_PASSWORD); assertThat(response, containsString("Lady Liberty")); configureRestForGuest(SDK_SOAP_CONTEXT); getSecurityPolicy().waitForGuestAuthReady(url); query(id, TRANSFORMER_XML, HttpStatus.SC_NOT_FOUND); } finally { if (authZProperties != null) { configureAuthZRealm(authZProperties, getAdminConfig()); } if (metacardAttributeSecurityFilterProperties != null) { configureMetacardAttributeSecurityFiltering( metacardAttributeSecurityFilterProperties, getAdminConfig()); } configureRestForGuest(SDK_SOAP_CONTEXT); waitForSecurityHandlers(url); getSecurityPolicy().waitForGuestAuthReady(url); } }