本文整理汇总了Java中com.google.enterprise.adaptor.Config类的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Config类属于com.google.enterprise.adaptor包,在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetXmlSearchIdsNonNumericIds
import com.google.enterprise.adaptor.Config; //导入依赖的package包/类
@Test
public void testGetXmlSearchIdsNonNumericIds() throws Exception {
String response =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<SearchResult>"
+ " <OTLocation>"
+ " <![CDATA[2000 foo 1000]]>"
+ " </OTLocation>"
+ "</SearchResult>";
SoapFactoryMock soapFactory = new SoapFactoryMock();
OpentextAdaptor adaptor = new OpentextAdaptor(soapFactory);
AdaptorContext context = ProxyAdaptorContext.getInstance();
Config config = initConfig(adaptor, context);
adaptor.init(context);
List<String> ids = adaptor.getXmlSearchIds(parseXml(response));
assertEquals(Lists.newArrayList(), ids);
assertNull(response, adaptor.getXmlSearchDocId(parseXml(response)));
}
示例2: testSoapFactoryImplGetWebServiceAddress
import com.google.enterprise.adaptor.Config; //导入依赖的package包/类
/**
* Check that trailing slashes or the lack thereof are handled
* on the webServicesUrl property.
*/
@Test
public void testSoapFactoryImplGetWebServiceAddress() {
Config config = new Config();
config.addKey("opentext.directoryServicesUrl", "");
config.addKey("opentext.webServicesUrl", "webServicesUrl");
config.addKey("opentext.webServicesServer", "Tomcat");
SoapFactoryImpl factory = new SoapFactoryImpl();
factory.configure(config);
assertEquals("webServicesUrl/Authentication",
factory.getWebServiceAddress("Authentication"));
config.overrideKey("opentext.webServicesUrl", "webServicesUrl/");
factory.configure(config);
assertEquals("webServicesUrl/Authentication",
factory.getWebServiceAddress("Authentication"));
}
示例3: testAuthenticateUserDirectoryServices
import com.google.enterprise.adaptor.Config; //导入依赖的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);
}
示例4: testAuthenticateUserDirectoryServicesOtherError
import com.google.enterprise.adaptor.Config; //导入依赖的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);
}
示例5: testGetDocIdsMarkPublicTrue
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}
示例6: testGetNodeStartPoint
import com.google.enterprise.adaptor.Config; //导入依赖的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"))));
}
示例7: testXmlSearchDocIdEnterpriseWs
import com.google.enterprise.adaptor.Config; //导入依赖的package包/类
@Test
public void testXmlSearchDocIdEnterpriseWs() throws Exception {
String response =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<SearchResult>"
+ " <OTLocation>"
+ " <![CDATA[2000]]>"
+ " </OTLocation>"
+ " <OTLocationPath> "
+ " <LocationPathString>"
+ " Enterprise"
+ " </LocationPathString>"
+ " </OTLocationPath> "
+ "</SearchResult>";
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);
String docId = adaptor.getXmlSearchDocId(parseXml(response));
assertEquals("EnterpriseWS:2000", docId);
}
示例8: testGetDocContentMarkPublicTrue
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}
示例9: testGetDisplayUrl
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}
示例10: testGetDisplayUrlPathInfo
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}
示例11: testDoDocumentNoVersions
import com.google.enterprise.adaptor.Config; //导入依赖的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);
}
示例12: initializeAdaptor
import com.google.enterprise.adaptor.Config; //导入依赖的package包/类
private void initializeAdaptor(DocumentumAdaptor adaptor, String src,
String separator) throws DfException {
AdaptorContext context = ProxyAdaptorContext.getInstance();
Config config = context.getConfig();
adaptor.initConfig(config);
config.overrideKey("documentum.username", "testuser");
config.overrideKey("documentum.password", "testpwd");
config.overrideKey("documentum.docbaseName", "testdocbase");
config.overrideKey("documentum.displayUrlPattern",
"http://webtopurl/drl/{0}");
config.overrideKey("documentum.src", src);
if (separator != null) {
config.overrideKey("documentum.src.separator", separator);
}
config.overrideKey("documentum.documentTypes", "dm_document");
adaptor.init(context);
}
示例13: testDocWithExcludedNodeType
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}
示例14: testGetDocIdsRootStartPathDefaultWhereClause
import com.google.enterprise.adaptor.Config; //导入依赖的package包/类
/** @see #testGetRootContentDefaultWhereClause() */
@Test
public void testGetDocIdsRootStartPathDefaultWhereClause() throws Exception {
executeUpdate(
"CREATE TABLE dm_docbase_config (owner_name varchar)",
"INSERT INTO dm_docbase_config (owner_name) VALUES('Owner')",
"CREATE TABLE dm_server_config (r_install_owner varchar)",
"INSERT INTO dm_server_config (r_install_owner) VALUES('Installer')");
insertCabinets("Integration", "Resources", "System", "Temp");
insertCabinets("Templates", "Owner", "Installer", "dm_bof_registry");
insertCabinets("Cab1", "Cab2", "Cab3");
Config config = ProxyAdaptorContext.getInstance().getConfig();
new DocumentumAdaptor(null).initConfig(config);
testGetDocIds(
ImmutableMap.of(
"documentum.src", "/",
"documentum.cabinetWhereCondition",
config.getValue("documentum.cabinetWhereCondition")),
expectedRecordsFor(CABINET, "/Cab1", "/Cab2", "/Cab3"));
}
示例15: testDoNodeFeatures
import com.google.enterprise.adaptor.Config; //导入依赖的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());
}