@Test public final void testReadCreateAuthAttributes() { final OracleAttributesReader reader = new OracleAttributesReader(TestHelpers.createDummyMessages()); OracleUserAttributes.Builder caAttributes = new OracleUserAttributes.Builder(); caAttributes.setUserName("testUser"); Set<Attribute> attributes = new HashSet<Attribute>(); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, OracleConstants.ORACLE_AUTH_LOCAL)); attributes.add(AttributeBuilder.buildPassword("myPassword".toCharArray())); reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.assertEquals(OracleAuthentication.LOCAL, caAttributes.getAuth()); AssertJUnit.assertNotNull("Password must not be null", caAttributes.getPassword()); attributes.clear(); caAttributes = new OracleUserAttributes.Builder(); caAttributes.setUserName("testUser"); reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); AssertJUnit.assertNull("Should not set authentication to any default value", caAttributes .getAuth()); AssertJUnit.assertNull("Password must be null", caAttributes.getPassword()); attributes.clear(); reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, "invalid authentication")); try { reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.fail("Must fail for invalid authentication"); } catch (RuntimeException e) { } attributes.clear(); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, OracleConstants.ORACLE_AUTH_GLOBAL)); try { reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.fail("Must fail for missing global name"); } catch (RuntimeException e) { } attributes.clear(); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_AUTHENTICATION_ATTR_NAME, OracleConstants.ORACLE_AUTH_GLOBAL)); attributes.add(AttributeBuilder.build(OracleConstants.ORACLE_GLOBAL_ATTR_NAME, "")); try { reader.readCreateAttributes(AttributeUtil.toMap(attributes), caAttributes); Assert.fail("Must fail for empty global name"); } catch (RuntimeException e) { } }
void readCreateAttributes(Map<String, Attribute> map, OracleUserAttributes.Builder caAttributes) { readAuthAttributes(map, caAttributes, CreateOp.class); readRestAttributes(map, caAttributes, CreateOp.class); }
OracleAttributesReader { void readCreateAttributes(Map<String, Attribute> map, OracleUserAttributes.Builder caAttributes) { readAuthAttributes(map, caAttributes, CreateOp.class); readRestAttributes(map, caAttributes, CreateOp.class); } }
OracleAttributesReader { void readCreateAttributes(Map<String, Attribute> map, OracleUserAttributes.Builder caAttributes) { readAuthAttributes(map, caAttributes, CreateOp.class); readRestAttributes(map, caAttributes, CreateOp.class); } OracleAttributesReader(ConnectorMessages messages); }
OracleAttributesReader { void readCreateAttributes(Map<String, Attribute> map, OracleUserAttributes.Builder caAttributes) { readAuthAttributes(map, caAttributes, CreateOp.class); readRestAttributes(map, caAttributes, CreateOp.class); } OracleAttributesReader(ConnectorMessages messages);  }
OracleAttributesReader { void readCreateAttributes(Map<String, Attribute> map, OracleUserAttributes.Builder caAttributes) { readAuthAttributes(map, caAttributes, CreateOp.class); readRestAttributes(map, caAttributes, CreateOp.class); } OracleAttributesReader(ConnectorMessages messages);   }