Skip to content

Commit 75e5c93

Browse files
committed
rename LdapProperty to LdapMetadata
1 parent e98234f commit 75e5c93

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @see com.redhat.lightblue.metadata.ldap.parser.LdapPropertyParser
3333
*/
34-
public class LdapProperty implements LdapFieldNameTranslator{
34+
public class LdapMetadata implements LdapFieldNameTranslator{
3535

3636
private final Map<String, String> fieldsToAttributes = new HashMap<String, String>();
3737

@@ -64,7 +64,7 @@ public String translateAttributeName(String attributeName){
6464
}
6565

6666
/**
67-
* Adds a {@link FieldAttributeMapping} to this {@link LdapProperty}.
67+
* Adds a {@link FieldAttributeMapping} to this {@link LdapMetadata}.
6868
* @param fieldAttributeMapping - {@link FieldAttributeMapping}
6969
*/
7070
public void addFieldToAttribute(String fieldName, String attributeName){

lightblue-ldap-metadata/src/main/java/com/redhat/lightblue/metadata/ldap/parser/LdapPropertyParser.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import com.redhat.lightblue.common.ldap.LdapConstant;
2525
import com.redhat.lightblue.metadata.MetadataConstants;
26-
import com.redhat.lightblue.metadata.ldap.model.LdapProperty;
26+
import com.redhat.lightblue.metadata.ldap.model.LdapMetadata;
2727
import com.redhat.lightblue.metadata.parser.MetadataParser;
2828
import com.redhat.lightblue.metadata.parser.PropertyParser;
2929
import com.redhat.lightblue.util.Error;
@@ -40,37 +40,37 @@ public class LdapPropertyParser <T> extends PropertyParser<T> {
4040
private static final String ATTRIBUTE = "attribute";
4141

4242
@Override
43-
public com.redhat.lightblue.metadata.ldap.model.LdapProperty parse(String name, MetadataParser<T> p, T node) {
43+
public com.redhat.lightblue.metadata.ldap.model.LdapMetadata parse(String name, MetadataParser<T> p, T node) {
4444
if (!LdapConstant.BACKEND.equals(name)) {
4545
throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, name);
4646
}
4747

48-
LdapProperty ldapProperty = new LdapProperty();
48+
LdapMetadata ldapMetadata = new LdapMetadata();
4949

5050
List<T> fieldsToAttributesNode = p.getObjectList(node, FIELDS_TO_ATTRIBUTES);
5151
if(fieldsToAttributesNode != null){
5252
for(T fieldToAttributeNode : fieldsToAttributesNode){
53-
ldapProperty.addFieldToAttribute(
53+
ldapMetadata.addFieldToAttribute(
5454
p.getRequiredStringProperty(fieldToAttributeNode, FIELD),
5555
p.getRequiredStringProperty(fieldToAttributeNode, ATTRIBUTE));
5656
}
5757
}
5858

59-
return ldapProperty;
59+
return ldapMetadata;
6060
}
6161

6262
@Override
6363
public void convert(MetadataParser<T> p, T emptyNode, Object object) {
64-
if(!(object instanceof LdapProperty)){
64+
if(!(object instanceof LdapMetadata)){
6565
throw new IllegalArgumentException("Source type " + object.getClass() + " is not supported.");
6666
}
6767

68-
LdapProperty ldapProperty = (LdapProperty) object;
68+
LdapMetadata ldapMetadata = (LdapMetadata) object;
6969

70-
if(!ldapProperty.getFieldsToAttributes().isEmpty()){
70+
if(!ldapMetadata.getFieldsToAttributes().isEmpty()){
7171
Object fieldsToAttributesNode = p.newArrayField(emptyNode, FIELDS_TO_ATTRIBUTES);
7272

73-
for(Entry<String, String> entry : ldapProperty.getFieldsToAttributes().entrySet()){
73+
for(Entry<String, String> entry : ldapMetadata.getFieldsToAttributes().entrySet()){
7474
T fieldToAttributeNode = p.newNode();
7575
p.putString(fieldToAttributeNode, FIELD, entry.getKey());
7676
p.putString(fieldToAttributeNode, ATTRIBUTE, entry.getValue());
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727

2828
import org.junit.Test;
2929

30-
public class LdapPropertyTest {
30+
public class LdapMetadataTest {
3131

3232
@Test
3333
public void testTranslateFieldName(){
3434
String fieldName = "fakeFieldName";
3535
String attributeName = "fakeAttributeName";
3636

37-
LdapProperty property = new LdapProperty();
37+
LdapMetadata property = new LdapMetadata();
3838
property.addFieldToAttribute(fieldName, attributeName);
3939
property.addFieldToAttribute("anotherField", "anotherAttribute");
4040

@@ -45,15 +45,15 @@ public void testTranslateFieldName(){
4545
public void testTranslateFieldName_ValueNotPresent(){
4646
String fieldName = "fakeFieldName";
4747

48-
assertEquals(fieldName, new LdapProperty().translateFieldName(fieldName));
48+
assertEquals(fieldName, new LdapMetadata().translateFieldName(fieldName));
4949
}
5050

5151
@Test
5252
public void testTranslateAttributeName(){
5353
String fieldName = "fakeFieldName";
5454
String attributeName = "fakeAttributeName";
5555

56-
LdapProperty property = new LdapProperty();
56+
LdapMetadata property = new LdapMetadata();
5757
property.addFieldToAttribute(fieldName, attributeName);
5858
property.addFieldToAttribute("anotherField", "anotherAttribute");
5959

@@ -64,12 +64,12 @@ public void testTranslateAttributeName(){
6464
public void testTranslateAttributeName_ValueNotPresent(){
6565
String attributeName = "fakeAttributeName";
6666

67-
assertEquals(attributeName, new LdapProperty().translateAttributeName(attributeName));
67+
assertEquals(attributeName, new LdapMetadata().translateAttributeName(attributeName));
6868
}
6969

7070
@Test
7171
public void testGetFieldsToAttributes_AssertImmutable(){
72-
LdapProperty property = new LdapProperty();
72+
LdapMetadata property = new LdapMetadata();
7373
property.addFieldToAttribute("anotherField", "anotherAttribute");
7474

7575
Map<String, String> fieldsToAttributes = property.getFieldsToAttributes();

lightblue-ldap-metadata/src/test/java/com/redhat/lightblue/metadata/ldap/parser/LdapPropertyParserTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
import com.fasterxml.jackson.databind.JsonNode;
3939
import com.redhat.lightblue.common.ldap.LdapConstant;
40-
import com.redhat.lightblue.metadata.ldap.model.LdapProperty;
40+
import com.redhat.lightblue.metadata.ldap.model.LdapMetadata;
4141
import com.redhat.lightblue.test.MetadataUtil;
4242

4343
public class LdapPropertyParserTest {
@@ -47,14 +47,14 @@ public class LdapPropertyParserTest {
4747

4848
@Test
4949
public void testParse() throws IOException{
50-
com.redhat.lightblue.metadata.ldap.model.LdapProperty ldapProperty = new LdapPropertyParser<JsonNode>().parse(
50+
LdapMetadata ldapMetadata = new LdapPropertyParser<JsonNode>().parse(
5151
LdapConstant.BACKEND,
5252
MetadataUtil.createJSONMetadataParser(LdapConstant.BACKEND, null),
5353
loadJsonNode("./ldap-segment-metadata.json").get("ldap"));
5454

55-
assertNotNull(ldapProperty);
55+
assertNotNull(ldapMetadata);
5656

57-
Map<String, String> fieldsToAttributes = ldapProperty.getFieldsToAttributes();
57+
Map<String, String> fieldsToAttributes = ldapMetadata.getFieldsToAttributes();
5858
assertNotNull(fieldsToAttributes);
5959
assertEquals(2, fieldsToAttributes.size());
6060

@@ -66,14 +66,14 @@ public void testParse() throws IOException{
6666

6767
@Test
6868
public void testParse_NoProperties() throws IOException{
69-
LdapProperty ldapProperty = new LdapPropertyParser<JsonNode>().parse(
69+
LdapMetadata ldapMetadata = new LdapPropertyParser<JsonNode>().parse(
7070
LdapConstant.BACKEND,
7171
MetadataUtil.createJSONMetadataParser(LdapConstant.BACKEND, null),
7272
json("{\"ldap\": {}}").get("ldap"));
7373

74-
assertNotNull(ldapProperty);
74+
assertNotNull(ldapMetadata);
7575

76-
assertTrue(ldapProperty.getFieldsToAttributes().isEmpty());
76+
assertTrue(ldapMetadata.getFieldsToAttributes().isEmpty());
7777
}
7878

7979
@Test
@@ -86,31 +86,31 @@ public void testParse_IncorrectBackend(){
8686

8787
@Test
8888
public void testConvert() throws IOException, JSONException{
89-
LdapProperty ldapProperty = new LdapProperty();
90-
ldapProperty.addFieldToAttribute("firstName", "givenName");
91-
ldapProperty.addFieldToAttribute("lastName", "sn");
89+
LdapMetadata ldapMetadata = new LdapMetadata();
90+
ldapMetadata.addFieldToAttribute("firstName", "givenName");
91+
ldapMetadata.addFieldToAttribute("lastName", "sn");
9292

9393
JsonNode node = json("{}");
9494

9595
new LdapPropertyParser<JsonNode>().convert(
9696
MetadataUtil.createJSONMetadataParser(LdapConstant.BACKEND, null),
9797
node,
98-
ldapProperty);
98+
ldapMetadata);
9999

100100
JSONAssert.assertEquals("{\"fieldsToAttributes\":[{\"field\":\"lastName\",\"attribute\":\"sn\"},{\"field\":\"firstName\",\"attribute\":\"givenName\"}]}",
101101
node.toString(), false);
102102
}
103103

104104
@Test
105105
public void testConvert_NoMappings() throws IOException, JSONException{
106-
LdapProperty ldapProperty = new LdapProperty();
106+
LdapMetadata ldapMetadata = new LdapMetadata();
107107

108108
JsonNode node = json("{}");
109109

110110
new LdapPropertyParser<JsonNode>().convert(
111111
MetadataUtil.createJSONMetadataParser(LdapConstant.BACKEND, null),
112112
node,
113-
ldapProperty);
113+
ldapMetadata);
114114

115115
JSONAssert.assertEquals("{}",
116116
node.toString(), true);

0 commit comments

Comments
 (0)