Skip UserProfile_GUID property from SharePoint User profile meta data
Code Review https://codereview.appspot.com/16100044/
diff --git a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
index b01607f..37ab8a8 100644
--- a/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
+++ b/src/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptor.java
@@ -531,6 +531,10 @@
propertyName);
continue;
}
+ // Skipping UserProfile_GUID field.
+ if ("UserProfile_GUID".equals(propertyName)) {
+ continue;
+ }
List<String> values = readUserProfilePropertyValues(prop);
for (String v : values) {
response.addMetadata(propertyName, v);
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
index a997dea..5886ad3 100644
--- a/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
+++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointUserProfileAdaptorTest.java
@@ -67,14 +67,14 @@
config.overrideKey("profile.setacl", "true");
}
- private void poulateProfileProperties (
+ private void populateProfileProperties (
ArrayOfPropertyData userProfileProperties,
String property, String[] values) {
- poulateProfileProperties(
+ populateProfileProperties(
userProfileProperties, property, values, Privacy.PUBLIC);
}
- private void poulateProfileProperties (
+ private void populateProfileProperties (
ArrayOfPropertyData userProfileProperties,
String property, String[] values, Privacy privacy) {
ArrayOfValueData valueData = new ArrayOfValueData();
@@ -98,19 +98,19 @@
MockUserProfileServiceFactoryImpl serviceFactory =
new MockUserProfileServiceFactoryImpl(null);
ArrayOfPropertyData profile = new ArrayOfPropertyData();
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
new String[] {"user1"});
serviceFactory.addUserProfileToCollection(1, 2, "user1", profile, null);
profile = new ArrayOfPropertyData();
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
new String[] {"user2"});
serviceFactory.addUserProfileToCollection(2, 4, "user2", profile, null);
profile = new ArrayOfPropertyData();
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
new String[] {"user3"});
serviceFactory.addUserProfileToCollection(4, 5, "user3", profile, null);
@@ -145,22 +145,24 @@
MockUserProfileServiceFactoryImpl serviceFactory =
new MockUserProfileServiceFactoryImpl(null);
ArrayOfPropertyData profile = new ArrayOfPropertyData();
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
new String[] {"domain\\user1"});
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_PREFERRED_NAME_PROPERTY,
new String[] {"First & Last"});
String[] skills =
new String[] {"Java", "SharePoint", "C++", "Design"};
- poulateProfileProperties(profile, "SPS-Skills", skills);
- poulateProfileProperties(profile, "SP Single Value Property",
+ populateProfileProperties(profile, "SPS-Skills", skills);
+ populateProfileProperties(profile, "SP Single Value Property",
new String[] {"Value1"});
- poulateProfileProperties(profile, "SP Multi Value Property",
+ populateProfileProperties(profile, "SP Multi Value Property",
new String[] {"Value1", "Value2", "Value3"});
- poulateProfileProperties(profile, "Empty Property", null);
- poulateProfileProperties(profile, "Private Property",
+ populateProfileProperties(profile, "Empty Property", null);
+ populateProfileProperties(profile, "Private Property",
new String[] {"Private Value"}, Privacy.PRIVATE);
+ populateProfileProperties(profile, "UserProfile_GUID",
+ new String[] {"{guid}"});
ArrayOfContactData colleaguesData = new ArrayOfContactData();
ContactData cPublic = new ContactData();
@@ -214,6 +216,7 @@
"SP Multi Value Property").size());
assertFalse(response.getMetadata().getKeys().contains("Empty Property"));
assertFalse(response.getMetadata().getKeys().contains("Private Property"));
+ assertFalse(response.getMetadata().getKeys().contains("UserProfile_GUID"));
// Colleagues Verification
String xml = response.getMetadata().getOneValue(
@@ -281,7 +284,7 @@
MockUserProfileServiceFactoryImpl serviceFactory =
new MockUserProfileServiceFactoryImpl(null);
ArrayOfPropertyData profile = new ArrayOfPropertyData();
- poulateProfileProperties(profile,
+ populateProfileProperties(profile,
SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
new String[] {"user1"});
serviceFactory.addUserProfileToCollection(1, 2, "user1", profile, null);