/** * Assert that the attributes returned from the data connector match the provided attributes. * * @param dataConnectorName the data connector name * @param principalName the principalName * @param correctMap the correct attributes */ private void runAttributeDefinitionTest( String dataConnectorName, String principalName, AttributeMap correctMap, String attributeDefinitionName) { try { GenericApplicationContext gContext = BaseDataConnectorTest.createSpringContext(RESOLVER_CONFIG); ShibbolethResolutionContext ctx = getShibContext(principalName); // resolve data connector dependency GroupDataConnector gdc = (GroupDataConnector) gContext.getBean(dataConnectorName); gdc.resolve(ctx); ctx.getResolvedPlugins().put(gdc.getId(), gdc); // resolve attribute definition AttributeDefinition ad = (AttributeDefinition) gContext.getBean(attributeDefinitionName); BaseAttribute attr = ad.resolve(ctx); // assert equality AttributeMap currentMap = new AttributeMap(); currentMap.setAttribute(attr); LOG.debug("correctMap\n{}", correctMap); LOG.debug("currentMap\n{}", currentMap); assertEquals(correctMap, currentMap); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } }