Index: People.spec.wsdl
diff --git a/People.spec.wsdl b/People.spec.wsdl
new file mode 100644
index 0000000000000000000000000000000000000000..42c5ab2e589ae03bf2232504bd9e453fa1370fb7
--- /dev/null
+++ b/People.spec.wsdl
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: People.wsdl
diff --git a/People.wsdl b/People.wsdl
new file mode 100644
index 0000000000000000000000000000000000000000..48bb5f3d08021ca2f19f0f4c11f0b24d175c2b73
--- /dev/null
+++ b/People.wsdl
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: build.xml
diff --git a/build.xml b/build.xml
index f8281cbf81c76df6ef4f2af91a133236d8b4a967..732c00a20468ad99ebcfc5329167166b2e6f2226 100644
--- a/build.xml
+++ b/build.xml
@@ -165,12 +165,25 @@ lib/plexi submodule or add the the command line argument
+
+
+
+
+
+
+
+
+
+
+
+ todir="${build-generate.dir}/com/microsoft/schemas/sharepoint/soap/authentication/"/>
+
siteUserIdMappingCallable;
public SiteAdaptor(String site, String web, SiteDataSoap siteDataSoap,
- UserGroupSoap userGroupSoap,
+ UserGroupSoap userGroupSoap, PeopleSoap people,
Callable memberIdMappingCallable,
Callable siteUserIdMappingCallable) {
log.entering("SiteAdaptor", "SiteAdaptor",
@@ -593,6 +607,7 @@ public class SharePointAdaptor extends AbstractAdaptor
this.siteUrl = site;
this.webUrl = web;
this.userGroup = userGroupSoap;
+ this.people = people;
this.siteDataClient = new SiteDataClient(siteDataSoap, xmlValidation);
this.memberIdMappingCallable = memberIdMappingCallable;
this.siteUserIdMappingCallable = siteUserIdMappingCallable;
@@ -725,21 +740,40 @@ public class SharePointAdaptor extends AbstractAdaptor
List permitGroups = new ArrayList();
List denyUsers = new ArrayList();
List denyGroups = new ArrayList();
+ List policyUsers = new ArrayList();
+ for (PolicyUser policyUser : vs.getPolicies().getPolicyUser()) {
+ policyUsers.add(policyUser.getLoginName());
+ }
+ Map resolvedPolicyUsers
+ = resolvePrincipals(policyUsers);
for (PolicyUser policyUser : vs.getPolicies().getPolicyUser()) {
+ String loginName = policyUser.getLoginName();
+ PrincipalInfo p = resolvedPolicyUsers.get(loginName);
+ if (p == null || !p.isIsResolved()) {
+ log.log(Level.WARNING,
+ "Unable to resolve Policy User = {0}", loginName);
+ continue;
+ }
// TODO(ejona): special case NT AUTHORITY\LOCAL SERVICE.
- String loginName = decodeClaim(policyUser.getLoginName(),
- policyUser.getLoginName(), false);
- log.log(Level.FINER, "Policy User Login Name = {0}", loginName);
+ String accountName = decodeClaim(p.getAccountName(), p.getDisplayName(),
+ p.getPrincipalType() == SPPrincipalType.SECURITY_GROUP);
+ log.log(Level.FINER, "Policy User accountName = {0}", accountName);
long grant = policyUser.getGrantMask().longValue();
if ((necessaryPermissionMask & grant) == necessaryPermissionMask) {
- permitUsers.add(new UserPrincipal(loginName));
- permitGroups.add(new GroupPrincipal(loginName));
+ if (p.getPrincipalType() == SPPrincipalType.USER) {
+ permitUsers.add(new UserPrincipal(accountName));
+ } else {
+ permitGroups.add(new GroupPrincipal(accountName));
+ }
}
long deny = policyUser.getDenyMask().longValue();
// If at least one necessary bit is masked, then deny user.
if ((necessaryPermissionMask & deny) != 0) {
- denyUsers.add(new UserPrincipal(loginName));
- denyGroups.add(new GroupPrincipal(loginName));
+ if (p.getPrincipalType() == SPPrincipalType.USER) {
+ denyUsers.add(new UserPrincipal(accountName));
+ } else {
+ denyGroups.add(new GroupPrincipal(accountName));
+ }
}
}
response.setAcl(new Acl.Builder()
@@ -1676,14 +1710,14 @@ public class SharePointAdaptor extends AbstractAdaptor
, boolean isDomainGroup) {
if (!loginName.startsWith(IDENTITY_CLAIMS_PREFIX)
&& !loginName.startsWith(OTHER_CLAIMS_PREFIX)) {
- return isDomainGroup ? name : loginName;
+ return loginName;
}
// AD User
if (loginName.startsWith("i:0#.w|")) {
return loginName.substring(7);
// AD Group
- } else if (loginName.startsWith("c:0+.w|")) {
- return name.startsWith("c:0+.w|") ? name.substring(7) : name;
+ } else if (loginName.startsWith("c:0+.w|")) {
+ return name;
} else if (loginName.equals("c:0(.s|true")) {
return "Everyone";
} else if (loginName.equals("c:0!.s|windows")) {
@@ -1692,6 +1726,29 @@ public class SharePointAdaptor extends AbstractAdaptor
log.log(Level.WARNING, "Unsupported claims value {0}", loginName);
return null;
}
+
+ private Map resolvePrincipals(
+ List principalsToResolve) {
+ Map resolved
+ = new HashMap();
+ if (principalsToResolve.isEmpty()) {
+ return resolved;
+ }
+ ArrayOfString aos = new ArrayOfString();
+ aos.getString().addAll(principalsToResolve);
+ ArrayOfPrincipalInfo resolvePrincipals = people.resolvePrincipals(
+ aos, SPPrincipalType.ALL, false);
+ List principals = resolvePrincipals.getPrincipalInfo();
+ // using loginname from input list principalsToResolve as a key
+ // instead of returned PrincipalInfo.getAccountName() as with claims
+ // authentication PrincipalInfo.getAccountName() is always encoded.
+ // e.g. if login name from Policy is NT Authority\Local Service
+ // returned account name is i:0#.w|NT Authority\Local Service
+ for (int i = 0; i < principalsToResolve.size(); i++) {
+ resolved.put(principalsToResolve.get(i), principals.get(i));
+ }
+ return resolved;
+ }
private MemberIdMapping retrieveMemberIdMapping() throws IOException {
log.entering("SiteAdaptor", "retrieveMemberIdMapping");
@@ -1945,6 +2002,8 @@ public class SharePointAdaptor extends AbstractAdaptor
public UserGroupSoap newUserGroup(String endpoint);
public AuthenticationSoap newAuthentication(String endpoint);
+
+ public PeopleSoap newPeople(String endpoint);
}
@VisibleForTesting
@@ -1952,6 +2011,7 @@ public class SharePointAdaptor extends AbstractAdaptor
private final Service siteDataService;
private final Service userGroupService;
private final Service authenticationService;
+ private final Service peopleService;
public SoapFactoryImpl() {
this.siteDataService = SiteDataClient.createSiteDataService();
@@ -1961,6 +2021,9 @@ public class SharePointAdaptor extends AbstractAdaptor
this.authenticationService = Service.create(
AuthenticationSoap.class.getResource("Authentication.wsdl"),
new QName(XMLNS, "Authentication"));
+ this.peopleService = Service.create(
+ PeopleSoap.class.getResource("People.wsdl"),
+ new QName(XMLNS, "People"));
}
@Override
@@ -1984,6 +2047,13 @@ public class SharePointAdaptor extends AbstractAdaptor
return
authenticationService.getPort(endpointRef, AuthenticationSoap.class);
}
+
+ @Override
+ public PeopleSoap newPeople(String endpoint) {
+ EndpointReference endpointRef = new W3CEndpointReferenceBuilder()
+ .address(endpoint).build();
+ return peopleService.getPort(endpointRef, PeopleSoap.class);
+ }
}
private static class NtlmAuthenticator extends Authenticator {
@@ -2101,7 +2171,7 @@ public class SharePointAdaptor extends AbstractAdaptor
return getSiteAdaptor(site, site).retrieveSiteUserMapping();
}
}
-
+
private static class CachedThreadPoolFactory
implements Callable {
@Override
Index: test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
diff --git a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
index eef07b9ab4b9f5151366149303106c2c596d1e51..b88af1433395b6f626b9ee0d985a2b9ec2c3e400 100644
--- a/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
+++ b/test/com/google/enterprise/adaptor/sharepoint/SharePointAdaptorTest.java
@@ -31,11 +31,10 @@ import com.google.enterprise.adaptor.Metadata;
import com.google.enterprise.adaptor.UserPrincipal;
import com.google.enterprise.adaptor.sharepoint.SharePointAdaptor.SiteUserIdMappingCallable;
import com.google.enterprise.adaptor.sharepoint.SharePointAdaptor.SoapFactory;
+
import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationMode;
import com.microsoft.schemas.sharepoint.soap.authentication.AuthenticationSoap;
-import com.microsoft.schemas.sharepoint.soap.authentication.LoginErrorCode;
import com.microsoft.schemas.sharepoint.soap.authentication.LoginResult;
-
import com.microsoft.schemas.sharepoint.soap.ObjectType;
import com.microsoft.schemas.sharepoint.soap.SPContentDatabase;
import com.microsoft.schemas.sharepoint.soap.SiteDataSoap;
@@ -75,6 +74,11 @@ import com.microsoft.schemas.sharepoint.soap.directory.TrueFalseType;
import com.microsoft.schemas.sharepoint.soap.directory.User;
import com.microsoft.schemas.sharepoint.soap.directory.UserGroupSoap;
import com.microsoft.schemas.sharepoint.soap.directory.Users;
+import com.microsoft.schemas.sharepoint.soap.people.ArrayOfPrincipalInfo;
+import com.microsoft.schemas.sharepoint.soap.people.ArrayOfString;
+import com.microsoft.schemas.sharepoint.soap.people.PeopleSoap;
+import com.microsoft.schemas.sharepoint.soap.people.PrincipalInfo;
+import com.microsoft.schemas.sharepoint.soap.people.SPPrincipalType;
import org.junit.*;
import org.junit.rules.ExpectedException;
@@ -363,11 +367,18 @@ public class SharePointAdaptorTest {
@Test
public void testGetDocContentVirtualServer() throws Exception {
+ MockPeopleSoap mockPeople = new MockPeopleSoap();
+ mockPeople.addToResult("NT AUTHORITY\\LOCAL SERVICE",
+ "NT AUTHORITY\\LOCAL SERVICE", SPPrincipalType.USER);
+ mockPeople.addToResult("GDC-PSL\\spuser1", "spuser1", SPPrincipalType.USER);
+ mockPeople.addToResult("GDC-PSL\\Administrator", "dministrator",
+ SPPrincipalType.USER);
SoapFactory siteDataFactory = MockSoapFactory.blank()
.endpoint(AUTH_ENDPOINT, new MockAuthenticationSoap())
.endpoint(VS_ENDPOINT, MockSiteData.blank()
.register(VS_CONTENT_EXCHANGE)
- .register(CD_CONTENT_EXCHANGE));
+ .register(CD_CONTENT_EXCHANGE))
+ .endpoint("http://localhost:1/_vti_bin/People.asmx", mockPeople);
adaptor = new SharePointAdaptor(siteDataFactory,
new UnsupportedHttpClient(), executorFactory);
@@ -392,7 +403,58 @@ public class SharePointAdaptorTest {
assertEquals(new Acl.Builder()
.setEverythingCaseInsensitive()
.setInheritanceType(Acl.InheritanceType.PARENT_OVERRIDES)
- .setPermitUsers(users(permit)).setPermitGroups(groups(permit)).build(),
+ .setPermitUsers(users(permit)).build(), response.getAcl());
+ assertNull(response.getDisplayUrl());
+ }
+
+ @Test
+ public void testPolicyAclsWithClaims() throws Exception {
+ String claimsPolicyUsers = ""
+ + "";
+ MockPeopleSoap mockPeople = new MockPeopleSoap();
+ mockPeople.addToResult("i:0#.w|GSA-CONNECTORS\\Administrator",
+ "Administrator", SPPrincipalType.USER);
+ mockPeople.addToResult(
+ "c:0+.w|s-1-5-21-3993744865-3521423997-1479072767-513",
+ "GSA-CONNECTORS\\domain users", SPPrincipalType.SECURITY_GROUP);
+ mockPeople.addToResult("NT AUTHORITY\\LOCAL SERVICE",
+ "NT AUTHORITY\\LOCAL SERVICE", SPPrincipalType.USER);
+ mockPeople.addToResult("GDC-PSL\\spuser1", "spuser1", SPPrincipalType.USER);
+ mockPeople.addToResult("GDC-PSL\\Administrator", "dministrator",
+ SPPrincipalType.USER);
+
+ SoapFactory siteDataFactory = MockSoapFactory.blank()
+ .endpoint(AUTH_ENDPOINT, new MockAuthenticationSoap())
+ .endpoint(VS_ENDPOINT, MockSiteData.blank()
+ .register(VS_CONTENT_EXCHANGE
+ .replaceInContent("", claimsPolicyUsers))
+ .register(CD_CONTENT_EXCHANGE))
+ .endpoint("http://localhost:1/_vti_bin/People.asmx", mockPeople);
+
+ adaptor = new SharePointAdaptor(siteDataFactory,
+ new UnsupportedHttpClient(), executorFactory);
+ adaptor.init(new MockAdaptorContext(config, pusher));
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GetContentsResponse response = new GetContentsResponse(baos);
+ adaptor.getDocContent(new GetContentsRequest(new DocId("")), response);
+ String[] permitUsers = new String[] {"GDC-PSL\\Administrator",
+ "GDC-PSL\\spuser1", "NT AUTHORITY\\LOCAL SERVICE",
+ "GSA-CONNECTORS\\Administrator"};
+ String[] permitGroups= new String[] {"GSA-CONNECTORS\\domain users"};
+ assertEquals(new Acl.Builder()
+ .setEverythingCaseInsensitive()
+ .setInheritanceType(Acl.InheritanceType.PARENT_OVERRIDES)
+ .setPermitUsers(users(permitUsers))
+ .setPermitGroups(groups(permitGroups)).build(),
response.getAcl());
assertNull(response.getDisplayUrl());
}
@@ -461,11 +523,13 @@ public class SharePointAdaptorTest {
.endpoint(SITES_SITECOLLECTION_ENDPOINT, MockSiteData.blank()
.register(SITES_SITECOLLECTION_URLSEG_EXCHANGE)
.register(SITES_SITECOLLECTION_S_CONTENT_EXCHANGE
- .replaceInContent("Name=\"spuser1\"", "Name=\"GDC-PSL\\group\"")
+ .replaceInContent("LoginName=\"GDC-PSL\\spuser1\"",
+ "LoginName=\"GDC-PSL\\group\"")
.replaceInContent("IsDomainGroup=\"False\"",
"IsDomainGroup=\"True\""))
.register(SITES_SITECOLLECTION_SC_CONTENT_EXCHANGE
- .replaceInContent("Name=\"spuser1\"", "Name=\"GDC-PSL\\group\"")
+ .replaceInContent("LoginName=\"GDC-PSL\\spuser1\"",
+ "LoginName=\"GDC-PSL\\group\"")
.replaceInContent("IsDomainGroup=\"False\"",
"IsDomainGroup=\"True\"")));
@@ -630,7 +694,8 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- new UnsupportedUserGroupSoap(), Callables.returning(memberIdMapping),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
+ Callables.returning(memberIdMapping),
new UnsupportedCallable())
.getDocContent(request, response);
String responseString = new String(baos.toByteArray(), charset);
@@ -673,7 +738,7 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- new UnsupportedUserGroupSoap(),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
new UnsupportedCallable(),
new UnsupportedCallable())
.getDocContent(request, response);
@@ -716,7 +781,7 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- new UnsupportedUserGroupSoap(),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
new UnsupportedCallable(),
new UnsupportedCallable())
.getDocContent(request, response);
@@ -766,7 +831,8 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- new UnsupportedUserGroupSoap(), Callables.returning(memberIdMapping),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
+ Callables.returning(memberIdMapping),
new UnsupportedCallable())
.getDocContent(request, response);
String responseString = new String(baos.toByteArray(), charset);
@@ -880,7 +946,8 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- new UnsupportedUserGroupSoap(), Callables.returning(memberIdMapping),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
+ Callables.returning(memberIdMapping),
new UnsupportedCallable())
.getDocContent(request, response);
assertNull(response.getAcl());
@@ -940,7 +1007,8 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", siteData,
- mockUserGroupSoap, Callables.returning(memberIdMapping),
+ mockUserGroupSoap, new UnsupportedPeopleSoap(),
+ Callables.returning(memberIdMapping),
adaptor.new SiteUserIdMappingCallable(
"http://localhost:1/sites/SiteCollection"))
.getDocContent(request, response);
@@ -1004,7 +1072,7 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection",
- siteData, new UnsupportedUserGroupSoap(),
+ siteData, new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
Callables.returning(memberIdMapping),
new UnsupportedCallable())
.getDocContent(request, response);
@@ -1047,7 +1115,7 @@ public class SharePointAdaptorTest {
GetContentsResponse response = new GetContentsResponse(baos);
adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection",
- siteData, new UnsupportedUserGroupSoap(),
+ siteData, new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
Callables.returning(memberIdMapping),
new UnsupportedCallable())
.getDocContent(request, response);
@@ -1324,7 +1392,7 @@ public class SharePointAdaptorTest {
adaptor.new SiteAdaptor(
"http://localhost:1/sites/SiteCollection",
"http://localhost:1/sites/SiteCollection", new UnsupportedSiteData(),
- new UnsupportedUserGroupSoap(),
+ new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
new UnsupportedCallable(),
new UnsupportedCallable())
.getModifiedDocIds(result, pusher);
@@ -1440,6 +1508,71 @@ public class SharePointAdaptorTest {
throw new UnsupportedOperationException();
}
}
+
+ private abstract static class DelegatingPeopleSoap implements PeopleSoap {
+ protected abstract PeopleSoap delegate();
+
+ @Override
+ public boolean isClaimsMode() {
+ return delegate().isClaimsMode();
+ }
+
+ @Override
+ public ArrayOfPrincipalInfo resolvePrincipals(
+ ArrayOfString aos, SPPrincipalType sppt, boolean bln) {
+ return delegate().resolvePrincipals(aos, sppt, bln);
+ }
+
+ @Override
+ public ArrayOfPrincipalInfo searchPrincipals(
+ String string, int i, SPPrincipalType sppt) {
+ return delegate().searchPrincipals(string, i, sppt);
+ }
+ }
+
+ private static class UnsupportedPeopleSoap extends DelegatingPeopleSoap {
+ private final String endpoint;
+
+ public UnsupportedPeopleSoap() {
+ this(null);
+ }
+
+ public UnsupportedPeopleSoap(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ @Override
+ protected PeopleSoap delegate() {
+ if (endpoint == null) {
+ throw new UnsupportedOperationException();
+ } else {
+ throw new UnsupportedOperationException("Endpoint: " + endpoint);
+ }
+ }
+ }
+
+ private static class MockPeopleSoap extends UnsupportedPeopleSoap {
+ private final ArrayOfPrincipalInfo result;
+ public MockPeopleSoap() {
+ this.result = new ArrayOfPrincipalInfo();
+ }
+
+ @Override
+ public ArrayOfPrincipalInfo resolvePrincipals(
+ ArrayOfString aos, SPPrincipalType sppt, boolean bln) {
+ return result;
+ }
+
+ public void addToResult(String accountName, String dispalyName,
+ SPPrincipalType type) {
+ PrincipalInfo p = new PrincipalInfo();
+ p.setAccountName(accountName);
+ p.setDisplayName(dispalyName);
+ p.setIsResolved(true);
+ p.setPrincipalType(type);
+ result.getPrincipalInfo().add(p);
+ }
+ }
private static class MockUserGroupSoap extends UnsupportedUserGroupSoap {
final Users users;
@@ -1815,37 +1948,47 @@ public class SharePointAdaptorTest {
private final SiteDataSoap siteData;
private final UserGroupSoap userGroup;
private final AuthenticationSoap authentication;
+ private final PeopleSoap people;
private final MockSoapFactory chain;
private MockSoapFactory(String expectedEndpoint, SiteDataSoap siteData,
- UserGroupSoap userGroup, AuthenticationSoap authentication,
- MockSoapFactory chain) {
+ UserGroupSoap userGroup, PeopleSoap people,
+ AuthenticationSoap authentication, MockSoapFactory chain) {
this.expectedEndpoint = expectedEndpoint;
this.siteData = siteData;
this.userGroup = userGroup;
+ this.people = people;
// Tests will always use windows authentication.
this.authentication = authentication;
this.chain = chain;
}
public static MockSoapFactory blank() {
- return new MockSoapFactory(null, null, null, null, null);
+ return new MockSoapFactory(null, null, null, null, null, null);
}
public MockSoapFactory endpoint(String expectedEndpoint,
SiteDataSoap siteData) {
- return new MockSoapFactory(expectedEndpoint, siteData, null, null, this);
+ return new MockSoapFactory(
+ expectedEndpoint, siteData, null, null, null, this);
}
public MockSoapFactory endpoint(String expectedEndpoint,
UserGroupSoap userGroup) {
- return new MockSoapFactory(expectedEndpoint, null, userGroup, null, this);
+ return new MockSoapFactory(
+ expectedEndpoint, null, userGroup, null, null, this);
+ }
+
+ public MockSoapFactory endpoint(String expectedEndpoint,
+ PeopleSoap people) {
+ return new MockSoapFactory(
+ expectedEndpoint, null, null, people, null, this);
}
public MockSoapFactory endpoint(String expectedEndpoint,
AuthenticationSoap authentication) {
return new MockSoapFactory(
- expectedEndpoint, null, null, authentication, this);
+ expectedEndpoint, null, null, null, authentication, this);
}
@Override
@@ -1883,6 +2026,17 @@ public class SharePointAdaptorTest {
}
return chain.newUserGroup(endpoint);
}
+
+ @Override
+ public PeopleSoap newPeople(String endpoint) {
+ if (chain == null) {
+ return new UnsupportedPeopleSoap(endpoint);
+ }
+ if (expectedEndpoint.equals(endpoint) && people != null) {
+ return people;
+ }
+ return chain.newPeople(endpoint);
+ }
}
private static class ReferenceSiteData extends DelegatingSiteData {