当前位置: 首页>>代码示例>>Java>>正文


Java AdaptorContext类代码示例

本文整理汇总了Java中com.google.enterprise.adaptor.AdaptorContext的典型用法代码示例。如果您正苦于以下问题:Java AdaptorContext类的具体用法?Java AdaptorContext怎么用?Java AdaptorContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdaptorContext类属于com.google.enterprise.adaptor包,在下文中一共展示了AdaptorContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAuthenticateUserDirectoryServices

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testAuthenticateUserDirectoryServices() {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  assertFalse("authenticate called before init",
      soapFactory.dsAuthenticationMock.authenticateCalled);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("opentext.directoryServicesUrl", "/otdsws/");
  adaptor.init(context);
  assertFalse("authUser called after init",
      soapFactory.authenticationMock.authenticateUserCalled);
  assertTrue("authenticate not called after init",
      soapFactory.dsAuthenticationMock.authenticateCalled);
  assertTrue("validateUser not called after init",
      soapFactory.authenticationMock.validateUserCalled);
  assertEquals("unexpected authentication token", "validation_token",
      soapFactory.authenticationMock.authenticationToken);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:20,代码来源:OpentextAdaptorTest.java

示例2: testAuthenticateUserDirectoryServicesInvalidUser

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testAuthenticateUserDirectoryServicesInvalidUser() {
  thrown.expect(InvalidConfigurationException.class);
  thrown.expectMessage("Authentication failed");

  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  assertFalse("authenticate called before init",
      soapFactory.dsAuthenticationMock.authenticateCalled);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("opentext.directoryServicesUrl", "/otdsws/");

  soapFactory.dsAuthenticationMock.faultCode =
      "AuthenticationService.Application.AuthenticationFailed";
  soapFactory.dsAuthenticationMock.message = "Authentication failed";
  adaptor.init(context);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:19,代码来源:OpentextAdaptorTest.java

示例3: testAuthenticateUserDirectoryServicesOtherError

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testAuthenticateUserDirectoryServicesOtherError() {
  thrown.expect(SOAPFaultException.class);
  thrown.expectMessage("Other failure");

  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  assertFalse("authenticate called before init",
      soapFactory.dsAuthenticationMock.authenticateCalled);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("opentext.directoryServicesUrl", "/otdsws/");

  soapFactory.dsAuthenticationMock.faultCode = "AuthenticationService.Other";
  soapFactory.dsAuthenticationMock.message = "Other failure";
  adaptor.init(context);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:18,代码来源:OpentextAdaptorTest.java

示例4: testGetDocIdsMarkPublicTrue

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetDocIdsMarkPublicTrue() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("adaptor.markAllDocsAsPublic", "true");
  adaptor.init(context);

  soapFactory.memberServiceMock.addMember(
      getMember(1000, "user1", "User"));
  soapFactory.memberServiceMock.addMember(
      getMember(2000, "group1", "Group"));
  soapFactory.memberServiceMock.addMemberToGroup(
      2000, soapFactory.memberServiceMock.getMemberById(1000));

  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  adaptor.getDocIds(pusher);
  assertTrue(pusher.getGroupDefinitions().isEmpty());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:21,代码来源:OpentextAdaptorTest.java

示例5: testGetDocIdsMarkPublicFalse

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetDocIdsMarkPublicFalse() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("adaptor.markAllDocsAsPublic", "false");
  adaptor.init(context);

  soapFactory.memberServiceMock.addMember(
      getMember(1000, "user1", "User"));
  soapFactory.memberServiceMock.addMember(
      getMember(2000, "group1", "Group"));
  soapFactory.memberServiceMock.addMemberToGroup(
      2000, soapFactory.memberServiceMock.getMemberById(1000));

  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  adaptor.getDocIds(pusher);
  Map<GroupPrincipal, List<Principal>> expected =
      new HashMap<GroupPrincipal, List<Principal>>();
  expected.put(newGroupPrincipal("group1"),
      Lists.<Principal>newArrayList(newUserPrincipal("user1")));
  assertEquals(expected, pusher.getGroupDefinitions());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:25,代码来源:OpentextAdaptorTest.java

示例6: testGetNodeStartPoint

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetNodeStartPoint() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("opentext.src", "EnterpriseWS");
  adaptor.init(context);

  DocumentManagement documentManagement =
      soapFactory.newDocumentManagement("token");
  Node node = adaptor.getNode(documentManagement,
      new OpentextDocId(new DocId("EnterpriseWS:2000")));
  assertNotNull(node);
  assertEquals(2000, node.getID());
  assertEquals("Enterprise Workspace", node.getName());

  assertNull(adaptor.getNode(documentManagement,
          new OpentextDocId(new DocId("InvalidStartPoint:1111"))));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:21,代码来源:OpentextAdaptorTest.java

示例7: testGetNodePath

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetNodePath() throws InterruptedException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);

  DocumentManagement documentManagement =
      soapFactory.newDocumentManagement("token");

  NodeMock testNode = new NodeMock(3214, "Important Document");
  testNode.setStartPointId(2000);
  testNode.setPath("folder 1", "folder 2", "Important Document");
  soapFactory.documentManagementMock.addNode(testNode);

  DocId docId =
      new DocId("EnterpriseWS/folder+1/folder+2/Important+Document:3214");
  Node node = adaptor.getNode(documentManagement, new OpentextDocId(docId));

  assertNotNull("Couldn't find test node", node);
  assertEquals(3214, node.getID());
  assertEquals("Important Document", node.getName());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:25,代码来源:OpentextAdaptorTest.java

示例8: testGetDocContentMarkPublicTrue

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetDocContentMarkPublicTrue() throws IOException {
  Member owner = getMember(1001, "testuser1", "User");
  NodeRights nodeRights = new NodeRights();
  nodeRights.setOwnerRight(getNodeRight(owner.getID(), "Owner"));
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  NodeMock node = new NodeMock(3143, "Folder Name", "Folder");
  node.setStartPointId(2000);
  node.setPath(node.getName());
  soapFactory.documentManagementMock.addNode(node);
  soapFactory.documentManagementMock
      .setNodeRights(node.getID(), nodeRights);
  soapFactory.memberServiceMock.addMember(owner);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("adaptor.markAllDocsAsPublic", "true");
  adaptor.init(context);

  RecordingResponse response = new RecordingResponse();
  Request request = new RequestMock("EnterpriseWS/Folder+Name:3143");
  adaptor.getDocContent(request, response);
  assertEquals(null, response.getAcl());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:26,代码来源:OpentextAdaptorTest.java

示例9: testGetDisplayUrl

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetDisplayUrl() throws Exception {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.addKey("opentext.displayUrl.objAction.111", "actionFor111");
  adaptor.init(context);

  URI displayUrl = adaptor.getDisplayUrl("Document", 12345);
  assertEquals("http://localhost/otcs/livelink.exe"
      + "?func=ll&objAction=overview&objId=12345", displayUrl.toString());

  displayUrl = adaptor.getDisplayUrl("UnknownType", 12345);
  assertEquals("http://localhost/otcs/livelink.exe"
      + "?func=ll&objAction=properties&objId=12345", displayUrl.toString());

  displayUrl = adaptor.getDisplayUrl("GenericNode:111", 12345);
  assertEquals("http://localhost/otcs/livelink.exe"
      + "?func=ll&objAction=actionFor111&objId=12345", displayUrl.toString());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:22,代码来源:OpentextAdaptorTest.java

示例10: testGetDisplayUrlPathInfo

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testGetDisplayUrlPathInfo() throws Exception {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.addKey(
      "opentext.displayUrl.queryString.Document", "/open/{1}");
  config.addKey(
      "opentext.displayUrl.queryString.111", "/open111/{1}");
  adaptor.init(context);

  URI displayUrl = adaptor.getDisplayUrl("Document", 12345);
  assertEquals("http://localhost/otcs/livelink.exe/open/12345",
      displayUrl.toString());
  displayUrl = adaptor.getDisplayUrl("GenericNode:111", 12345);
  assertEquals("http://localhost/otcs/livelink.exe/open111/12345",
      displayUrl.toString());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:20,代码来源:OpentextAdaptorTest.java

示例11: testDoDocumentNoVersions

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testDoDocumentNoVersions() throws IOException {
  DocId docId = new DocId("2000/Document Name:3143");
  OpentextDocId testDocId = new OpentextDocId(docId);

  thrown.expect(RuntimeException.class);
  thrown.expectMessage(
      "Document does not support versions: " + testDocId);

  SoapFactoryMock soapFactory = new SoapFactoryMock();
  NodeMock documentNode = new NodeMock(3143, "Document Name");
  documentNode.setIsVersionable(false);
  soapFactory.documentManagementMock.addNode(documentNode);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);

  Request request = new RequestMock(docId);
  RecordingResponse response = new RecordingResponse();
  DocumentManagement documentManagement =
      soapFactory.newDocumentManagement("token");
  adaptor.doDocument(documentManagement, testDocId,
      documentNode, request, response);
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:27,代码来源:OpentextAdaptorTest.java

示例12: testDocWithExcludedNodeType

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testDocWithExcludedNodeType() throws IOException {
  SoapFactoryMock soapFactory = new SoapFactoryMock();

  NodeMock documentNode =
      new NodeMock(3143, "Title of Document", "Alias");
  documentNode.setStartPointId(2000);
  documentNode.setPath(documentNode.getName());
  soapFactory.documentManagementMock.addNode(documentNode);

  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.overrideKey("opentext.excludedNodeTypes", "Alias");
  adaptor.init(context);

  RecordingResponse response = new RecordingResponse();
  Request request = new RequestMock("EnterpriseWS/Title+of+Document:3143");
  adaptor.getDocContent(request, response);
  assertEquals(RecordingResponse.State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:22,代码来源:OpentextAdaptorTest.java

示例13: testDoNodeFeatures

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testDoNodeFeatures() {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.addKey("opentext.includedNodeFeatures.NodeType",
      "Feature1,Feature2");
  adaptor.init(context);

  NodeMock node = new NodeMock(3143, "Node Name", "NodeType");
  NodeFeature feature = new NodeFeature();
  feature.setName("Feature1");
  feature.setBooleanValue(true);
  feature.setType("Boolean");
  node.getFeatures().add(feature);

  RecordingResponse response = new RecordingResponse();
  adaptor.doNodeFeatures(node, response);
  assertEquals(
      expectedMetadata(
          ImmutableMap.of("Feature1", "true")),
      response.getMetadata());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:25,代码来源:OpentextAdaptorTest.java

示例14: testDoNodeFeaturesWithDate

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testDoNodeFeaturesWithDate() {
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  config.addKey("opentext.includedNodeFeatures.NodeType",
      "Feature1,Feature2");
  adaptor.init(context);

  NodeMock node = new NodeMock(3143, "Node Name", "NodeType");
  NodeFeature feature = new NodeFeature();
  feature.setName("Feature1");
  feature.setDateValue(getXmlGregorianCalendar(2011, 01, 01, 01, 01, 01));
  feature.setType("Date");
  node.getFeatures().add(feature);

  RecordingResponse response = new RecordingResponse();
  adaptor.doNodeFeatures(node, response);
  assertEquals(
      expectedMetadata(
          ImmutableMap.of("Feature1", "2011-02-01")),
      response.getMetadata());
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:25,代码来源:OpentextAdaptorTest.java

示例15: testDoNode

import com.google.enterprise.adaptor.AdaptorContext; //导入依赖的package包/类
@Test
public void testDoNode() throws IOException {
  NodeMock node = new NodeMock(432, "Test Node");
  SoapFactoryMock soapFactory = new SoapFactoryMock();
  OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
  AdaptorContext context = ProxyAdaptorContext.getInstance();
  Config config = initConfig(adaptor, context);
  adaptor.init(context);
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  RecordingResponse response = new RecordingResponse(baos);
  adaptor.doNode(soapFactory.newDocumentManagement("token"),
      new OpentextDocId(new DocId("432:432")),
      node, response);
  String expected = "<!DOCTYPE html>\n"
      + "<html><head><title>Test Node</title></head>"
      + "<body><h1>Test Node</h1>"
      + "</body></html>";
  assertEquals(expected, baos.toString(UTF_8.name()));
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:20,代码来源:OpentextAdaptorTest.java


注:本文中的com.google.enterprise.adaptor.AdaptorContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。