@Test public void testNormalizeAttribute() { OracleFullNormalizer normalizer = new OracleFullNormalizer(OracleConfigurationTest.createSystemConfiguration() .getCSSetup()); ObjectClass objectClass = ObjectClass.ACCOUNT; assertNull(normalizer.normalizeAttribute(objectClass, null)); Attribute attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build("dummy", "dummyValue")); assertNotNull(attr); assertEquals("dummyValue", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build(Name.NAME, "myName")); assertNotNull(attr); assertEquals(OracleUserAttribute.USER.getFormatting().isToUpper() ? "myName".toUpperCase() : "myName", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build(Name.NAME .toLowerCase(), "myName")); assertNotNull(attr); assertEquals(OracleUserAttribute.USER.getFormatting().isToUpper() ? "myName".toUpperCase() : "myName", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder .build(Uid.NAME, "myUid")); assertNotNull(attr); assertEquals("MYUID", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build(Uid.NAME .toLowerCase(), "myUid")); assertNotNull(attr); assertEquals("MYUID", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_GLOBAL_ATTR_NAME, "myGlobalName")); assertNotNull(attr); assertEquals("myGlobalName", AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_PROFILE_ATTR_NAME, "myProfile")); assertNotNull(attr); assertEquals("myProfile".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_PROFILE_ATTR_NAME.toLowerCase(), "myProfile")); assertNotNull(attr); assertEquals("myProfile".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_DEF_TS_ATTR_NAME, "myDefTs")); assertNotNull(attr); assertEquals("myDefTs".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_DEF_TS_ATTR_NAME.toLowerCase(), "myDefTs")); assertNotNull(attr); assertEquals("myDefTs".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_TEMP_TS_ATTR_NAME, "myTempTs")); assertNotNull(attr); assertEquals("myTempTs".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_TEMP_TS_ATTR_NAME.toLowerCase(), "myTempTs")); assertNotNull(attr); assertEquals("myTempTs".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_PRIVS_ATTR_NAME, "myPriv")); assertNotNull(attr); assertEquals("myPriv".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_PRIVS_ATTR_NAME.toLowerCase(), "myPriv")); assertNotNull(attr); assertEquals("myPriv".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_ROLES_ATTR_NAME, "myRole")); assertNotNull(attr); assertEquals("myRole".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_ROLES_ATTR_NAME.toLowerCase(), "myRole")); assertNotNull(attr); assertEquals("myRole".toUpperCase(), AttributeUtil.getSingleValue(attr)); attr = normalizer.normalizeAttribute(objectClass, AttributeBuilder.build( OracleConstants.ORACLE_ROLES_ATTR_NAME.toUpperCase(), "myRole")); assertNotNull(attr); assertEquals("myRole".toUpperCase(), AttributeUtil.getSingleValue(attr)); }
public Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute) { if (attribute == null) { return null; } String name = attribute.getName(); final OracleUserAttribute oracleUserAttribute = MAPPING.get(name); if (oracleUserAttribute == null) { return attribute; } if (attribute.getValue() == null) { return attribute; } List<Object> values = new ArrayList<Object>(); for (Object o : attribute.getValue()) { if (o instanceof String) { o = cs.normalizeToken(oracleUserAttribute, (String) o); } else if (o instanceof GuardedString) { o = cs.normalizeToken(oracleUserAttribute, (GuardedString) o); } values.add(o); } return AttributeBuilder.build(name, values); }
OracleFullNormalizer implements OracleAttributeNormalizer { public Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute) { if (attribute == null) { return null; } String name = attribute.getName(); final OracleUserAttribute oracleUserAttribute = MAPPING.get(name); if (oracleUserAttribute == null) { return attribute; } if (attribute.getValue() == null) { return attribute; } List<Object> values = new ArrayList<Object>(); for (Object o : attribute.getValue()) { if (o instanceof String) { o = cs.normalizeToken(oracleUserAttribute, (String) o); } else if (o instanceof GuardedString) { o = cs.normalizeToken(oracleUserAttribute, (GuardedString) o); } values.add(o); } return AttributeBuilder.build(name, values); } }
OracleFullNormalizer implements OracleAttributeNormalizer { public Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute) { if (attribute == null) { return null; } String name = attribute.getName(); final OracleUserAttribute oracleUserAttribute = MAPPING.get(name); if (oracleUserAttribute == null) { return attribute; } if (attribute.getValue() == null) { return attribute; } List<Object> values = new ArrayList<Object>(); for (Object o : attribute.getValue()) { if (o instanceof String) { o = cs.normalizeToken(oracleUserAttribute, (String) o); } else if (o instanceof GuardedString) { o = cs.normalizeToken(oracleUserAttribute, (GuardedString) o); } values.add(o); } return AttributeBuilder.build(name, values); } OracleFullNormalizer(OracleCaseSensitivitySetup cs); }
OracleFullNormalizer implements OracleAttributeNormalizer { public Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute) { if (attribute == null) { return null; } String name = attribute.getName(); final OracleUserAttribute oracleUserAttribute = MAPPING.get(name); if (oracleUserAttribute == null) { return attribute; } if (attribute.getValue() == null) { return attribute; } List<Object> values = new ArrayList<Object>(); for (Object o : attribute.getValue()) { if (o instanceof String) { o = cs.normalizeToken(oracleUserAttribute, (String) o); } else if (o instanceof GuardedString) { o = cs.normalizeToken(oracleUserAttribute, (GuardedString) o); } values.add(o); } return AttributeBuilder.build(name, values); } OracleFullNormalizer(OracleCaseSensitivitySetup cs); Set<Attribute> normalizeAttributes(ObjectClass objectClass,
            Class<? extends SPIOperation> op, Set<Attribute> attrs); Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute); Pair<String, GuardedString> normalizeAuthenticateEntry(String username,
            GuardedString password); }
OracleFullNormalizer implements OracleAttributeNormalizer { public Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute) { if (attribute == null) { return null; } String name = attribute.getName(); final OracleUserAttribute oracleUserAttribute = MAPPING.get(name); if (oracleUserAttribute == null) { return attribute; } if (attribute.getValue() == null) { return attribute; } List<Object> values = new ArrayList<Object>(); for (Object o : attribute.getValue()) { if (o instanceof String) { o = cs.normalizeToken(oracleUserAttribute, (String) o); } else if (o instanceof GuardedString) { o = cs.normalizeToken(oracleUserAttribute, (GuardedString) o); } values.add(o); } return AttributeBuilder.build(name, values); } OracleFullNormalizer(OracleCaseSensitivitySetup cs); Set<Attribute> normalizeAttributes(ObjectClass objectClass,
            Class<? extends SPIOperation> op, Set<Attribute> attrs); Attribute normalizeAttribute(ObjectClass oclass, Attribute attribute); Pair<String, GuardedString> normalizeAuthenticateEntry(String username,
            GuardedString password);  }