DefaultObjectDirectoryMapper implements ObjectDirectoryMapper { @Override public String[] manageClass(Class<?> clazz) { EntityData entityData = getEntityData(clazz); Set<String> managedAttributeNames = new HashSet<String>(); for (Field field : entityData.metaData) { AttributeMetaData attributeMetaData = entityData.metaData.getAttribute(field); if (attributeMetaData.isTransient()) { continue; } String[] attributesOfField = attributeMetaData.getAttributes(); if (attributesOfField != null && attributesOfField.length > 0) { managedAttributeNames.addAll(Arrays.asList(attributesOfField)); } else { managedAttributeNames.add(field.getName()); } } managedAttributeNames.add(OBJECT_CLASS_ATTRIBUTE); return managedAttributeNames.toArray(new String[managedAttributeNames.size()]); } DefaultObjectDirectoryMapper(); void setConverterManager(ConverterManager converterManager); @Override String[] manageClass(Class<?> clazz); @Override void mapToLdapDataEntry(Object entry, LdapDataEntry context); @Override T mapFromLdapDataEntry(LdapDataEntry context, Class<T> clazz); @Override Name getId(Object entry); @Override void setId(Object entry, Name id); @Override Name getCalculatedId(Object entry); @Override Filter filterFor(Class<?> clazz, Filter baseFilter); @Override String attributeFor(Class<?> clazz, String fieldName);  }
@Test public void testInvalidType() { try { tested.manageClass(UnitTestPersonWithInvalidFieldType.class); } catch (InvalidEntryException expected) { assertThat(expected.getMessage()).contains("Missing converter from"); } }
@Test(expected = MetaDataException.class) public void testIndexedDnAttributesRequiresThatAllAreIndexed() { tested.manageClass(UnitTestPersonWithIndexedAndUnindexedDnAttributes.class); }