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


Java State类代码示例

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


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

示例1: testGetDocContentNotFound

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentNotFound() throws Exception {
  MockUserProfileServiceFactoryImpl serviceFactory =
      new MockUserProfileServiceFactoryImpl(null);
  adaptor = new SharePointUserProfileAdaptor(serviceFactory,
      authenticationFactory);

  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  adaptor.init(new MockAdaptorContext(config, pusher));
  
  DocRequest request = new DocRequest(
      new DocId(SharePointUserProfileAdaptor.SOCIAL_ID_PREFIX + "user1"));
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:17,代码来源:SharePointUserProfileAdaptorTest.java

示例2: testGetDocContentInvalidDocId

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentInvalidDocId() throws Exception {
  MockUserProfileServiceFactoryImpl serviceFactory =
      new MockUserProfileServiceFactoryImpl(null);
  ArrayOfPropertyData profile = new ArrayOfPropertyData();
  populateProfileProperties(profile,
      SharePointUserProfileAdaptor.PROFILE_ACCOUNTNAME_PROPERTY,
      new String[] {"user1"});
  serviceFactory.addUserProfileToCollection(1, 2, "user1", profile, null);
  adaptor = new SharePointUserProfileAdaptor(serviceFactory,
      authenticationFactory);

  RecordingDocIdPusher pusher = new RecordingDocIdPusher();
  adaptor.init(new MockAdaptorContext(config, pusher));

  DocRequest request = new DocRequest(
      new DocId("user1"));
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:22,代码来源:SharePointUserProfileAdaptorTest.java

示例3: testGetDocContentWrongServer

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentWrongServer() throws Exception {
  SoapFactory siteDataFactory = MockSoapFactory.blank()        
      .endpoint(VS_ENDPOINT, MockSiteData.blank()
          .register(VS_CONTENT_EXCHANGE)
          .register(CD_CONTENT_EXCHANGE)
          .register(ROOT_SITE_SAW_EXCHANGE)
          .register(new SiteAndWebExchange(
              "http://wronghost:1/", 1, null, null)));

  adaptor = new SharePointAdaptor(siteDataFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  adaptor.init(new MockAdaptorContext(config, pusher));
  DocRequest request = new DocRequest(
      new DocId("http://wronghost:1/"));
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:22,代码来源:SharePointAdaptorTest.java

示例4: testGetDocContentWrongPage

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentWrongPage() throws Exception {
  final String wrongPage = "http://localhost:1/wrongPage";
  SoapFactory siteDataFactory = MockSoapFactory.blank()
      .endpoint(VS_ENDPOINT, MockSiteData.blank()
          .register(VS_CONTENT_EXCHANGE)
          .register(CD_CONTENT_EXCHANGE)
          .register(ROOT_SITE_SAW_EXCHANGE)
          .register(new SiteAndWebExchange(
              wrongPage, 0, "http://localhost:1", "http://localhost:1"))
          .register(new URLSegmentsExchange(
              wrongPage, false, null, null, null, null)));

  adaptor = new SharePointAdaptor(siteDataFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  adaptor.init(new MockAdaptorContext(config, pusher));
  DocRequest request = new DocRequest(new DocId(wrongPage));
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:24,代码来源:SharePointAdaptorTest.java

示例5: testGetDocContentSiteCollectionNoIndex

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
public void testGetDocContentSiteCollectionNoIndex() throws Exception {
  SoapFactory siteDataFactory = MockSoapFactory.blank()
      .endpoint(VS_ENDPOINT, MockSiteData.blank()
          .register(SITES_SITECOLLECTION_SAW_EXCHANGE)
          .register(ROOT_SITE_SAW_EXCHANGE))
      .endpoint(SITES_SITECOLLECTION_ENDPOINT, MockSiteData.blank()
          .register(SITES_SITECOLLECTION_URLSEG_EXCHANGE)
          .register(SITES_SITECOLLECTION_S_CONTENT_EXCHANGE
            .replaceInContent("NoIndex=\"False\"", "NoIndex=\"True\"")));

  adaptor = new SharePointAdaptor(siteDataFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  adaptor.init(new MockAdaptorContext(config, pusher));
  DocRequest request = new DocRequest(
      new DocId("http://localhost:1/sites/SiteCollection"));
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:22,代码来源:SharePointAdaptorTest.java

示例6: testGetDocContentListNoIndex

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentListNoIndex() throws Exception {
  SiteDataSoap siteData = MockSiteData.blank()
      .register(SITES_SITECOLLECTION_S_CONTENT_EXCHANGE)
      .register(SITES_SITECOLLECTION_LISTS_CUSTOMLIST_URLSEG_EXCHANGE)
      .register(SITES_SITECOLLECTION_LISTS_CUSTOMLIST_L_CONTENT_EXCHANGE
        .replaceInContent("NoIndex=\"False\"", "NoIndex=\"True\""));

  adaptor = new SharePointAdaptor(initableSoapFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  adaptor.init(new MockAdaptorContext(config, pusher));
  DocRequest request = new DocRequest(
      new DocId("http://localhost:1/sites/SiteCollection/Lists/Custom List/"
        + "AllItems.aspx"));
  RecordingResponse response = new RecordingResponse();
  adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
        "http://localhost:1/sites/SiteCollection", siteData,
        new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
        new UnsupportedCallable<MemberIdMapping>(),
        new UnsupportedCallable<MemberIdMapping>())
      .getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:26,代码来源:SharePointAdaptorTest.java

示例7: testGetDocContentListNonDefaultView

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentListNonDefaultView() throws Exception {
  SiteDataSoap siteData = MockSiteData.blank()
      .register(SITES_SITECOLLECTION_S_CONTENT_EXCHANGE)       
      .register(new URLSegmentsExchange(
        "http://localhost:1/sites/SiteCollection/Lists/Custom List"
        + "/NonDefault.aspx", false, null, null, null, null))
      .register(SITES_SITECOLLECTION_LISTS_CUSTOMLIST_L_CONTENT_EXCHANGE);
  adaptor = new SharePointAdaptor(initableSoapFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  adaptor.init(new MockAdaptorContext(config, pusher));
  DocRequest request = new DocRequest(
      new DocId("http://localhost:1/sites/SiteCollection/Lists/Custom List/"
        + "NonDefault.aspx"));
  RecordingResponse response = new RecordingResponse();
  adaptor.new SiteAdaptor("http://localhost:1/sites/SiteCollection",
        "http://localhost:1/sites/SiteCollection", siteData,
        new UnsupportedUserGroupSoap(), new UnsupportedPeopleSoap(),
        new UnsupportedCallable<MemberIdMapping>(),
        new UnsupportedCallable<MemberIdMapping>())
      .getDocContent(request, response);
  assertEquals(State.NOT_FOUND, response.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:26,代码来源:SharePointAdaptorTest.java

示例8: assertDocContent

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
private void assertDocContent(ByteArrayOutputStream boas,
    RecordingResponse response, Date lastModified,
    String mimeType, String content, boolean expectNoContent)
    throws IOException {
  // Our mocks, like Documentum, only store seconds, not milliseconds.
  assertEquals(new Date((lastModified.getTime() / 1000) * 1000),
      response.getLastModified());
  assertFalse(response.getState() == State.NOT_MODIFIED);
  assertFalse(response.getMetadata().isEmpty());
  assertNotNull(response.getAcl());
  if (expectNoContent) {
    assertEquals(State.NO_CONTENT, response.getState());
    assertEquals(null, response.getContentType());
    assertEquals("", boas.toString(UTF_8.name()));
  } else {
    assertEquals(State.SEND_BODY, response.getState());
    assertEquals(mimeType, response.getContentType());
    assertEquals(content, boas.toString(UTF_8.name()));
  }
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:21,代码来源:DocumentumAdaptorTest.java

示例9: testGetDocContent_invalidChronicleId

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContent_invalidChronicleId() throws Exception {
  String name = "aaa";
  String path = START_PATH + "/" + name + ":" + DOCUMENT.pad("ccc");

  AdaptorContext context = ProxyAdaptorContext.getInstance();
  DocumentumAdaptor adaptor = getObjectUnderTest(context);
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(new MockRequest(docIdFromPath(path)), response);

  assertTrue(response.getState() == State.NOT_FOUND);

  ProxyAdaptorContext.MockAsyncDocIdPusher asyncPusher =
      (ProxyAdaptorContext.MockAsyncDocIdPusher) context
          .getAsyncDocIdPusher();
  assertNull(asyncPusher.getDocId());
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:18,代码来源:DocumentumAdaptorTest.java

示例10: testGetDocContent_missingChronicleId

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContent_missingChronicleId() throws Exception {
  String name = "aaa";
  String path = START_PATH + "/" + name;
  insertDocument(path);

  AdaptorContext context = ProxyAdaptorContext.getInstance();
  DocumentumAdaptor adaptor = getObjectUnderTest(context);
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(new MockRequest(docIdFromPath(path), new Date()),
      response);

  assertTrue(response.getState() == State.NOT_FOUND);
  ProxyAdaptorContext.MockAsyncDocIdPusher asyncPusher =
      (ProxyAdaptorContext.MockAsyncDocIdPusher) context
          .getAsyncDocIdPusher();
  assertEquals(docIdFromPath(path, DOCUMENT.pad(name)),
      asyncPusher.getDocId());
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:20,代码来源:DocumentumAdaptorTest.java

示例11: testGetDocContent_pathMismatch

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContent_pathMismatch() throws Exception {
  String name = "aaa";
  String path = START_PATH + "/" + name;
  insertDocument(path);

  AdaptorContext context = ProxyAdaptorContext.getInstance();
  DocumentumAdaptor adaptor = getObjectUnderTest(context);
  RecordingResponse response = new RecordingResponse();
  adaptor.getDocContent(new MockRequest(docIdFromPath("/Cab0/FFF1", name,
      DOCUMENT.pad(name))), response);

  assertTrue(response.getState() == State.NOT_FOUND);

  ProxyAdaptorContext.MockAsyncDocIdPusher asyncPusher =
      (ProxyAdaptorContext.MockAsyncDocIdPusher) context
          .getAsyncDocIdPusher();
  assertNull(asyncPusher.getDocId());
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:20,代码来源:DocumentumAdaptorTest.java

示例12: testStartPathDocContent

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testStartPathDocContent() throws Exception {
  insertCabinets("Cab0");

  String startFolder = START_PATH.substring(START_PATH.lastIndexOf("/") + 1);
  StringBuilder expected = new StringBuilder();
  expected.append("<!DOCTYPE html>\n<html><head><title>");
  expected.append("Folder ").append(startFolder);
  expected.append("</title></head><body><h1>");
  expected.append("Folder ").append(startFolder);
  expected.append("</h1></body></html>");

  ByteArrayOutputStream boas = new ByteArrayOutputStream();
  RecordingResponse response = getDocContent(
      boas,
      ImmutableMap.of("documentum.src", START_PATH),
      new MockRequest(docIdFromPath(START_PATH, FOLDER.pad(startFolder))));

  assertFalse(response.getState() == State.NOT_FOUND);
  assertEquals("text/html; charset=UTF-8", response.getContentType());
  assertEquals(expected.toString(), boas.toString(UTF_8.name()));
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:23,代码来源:DocumentumAdaptorTest.java

示例13: testGetDocContentMultipleSCExcludeRootSC

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentMultipleSCExcludeRootSC() 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", "administrator",
      SPPrincipalType.USER);
  SoapFactory siteDataFactory = MockSoapFactory.blank()
      .endpoint(VS_ENDPOINT, MockSiteData.blank()
          .register(SITES_SITECOLLECTION_SAW_EXCHANGE)
          .register(new SiteAndWebExchange(
              "http://localhost:1/web", 0,
              "http://localhost:1",
              "http://localhost:1/web"))
          .register(VS_CONTENT_EXCHANGE)
          .register(CD_CONTENT_EXCHANGE
              .replaceInContent("</Sites>", "<Site "
                  + "URL=\"http://localhost:1/sites/SiteCollectionOneMore\" "
                  + "ID=\"{5cbcd3b1-fca9-48b2-92db-OneMore}\" />"
                  + "</Sites>"))
          .register(ROOT_SITE_SAW_EXCHANGE))
      .endpoint("http://localhost:1/_vti_bin/People.asmx", mockPeople);

  adaptor = new SharePointAdaptor(siteDataFactory,
      new UnsupportedHttpClient(), executorFactory,
      new MockAuthenticationClientFactoryForms(),
      new UnsupportedActiveDirectoryClientFactory());
  config.overrideKey("sharepoint.server", "http://localhost:1/");
  config.overrideKey("sharepoint.siteCollectionsToInclude",
      "http://localhost:1/sites/SiteCollectionOneMore,");
  adaptor.init(new MockAdaptorContext(config, pusher));

  RecordingResponse response = new RecordingResponse();
  DocRequest requestOtherSC = new DocRequest(
      new DocId("http://localhost:1/web"));
  RecordingResponse responseOtherSC = new RecordingResponse();
  adaptor.getDocContent(requestOtherSC, responseOtherSC);
  assertEquals(State.NOT_FOUND, responseOtherSC.getState());
}
 
开发者ID:googlegsa,项目名称:sharepoint,代码行数:41,代码来源:SharePointAdaptorTest.java

示例14: testSlashInNameDocContent

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testSlashInNameDocContent() throws Exception {
  // Insert two documents with a "path" of START_PATH + "/aaa/bbb".
  // If the slash in the name is interpreted as a path separator,
  // we will try to crawl this document.
  String folder = START_PATH + "/aaa";
  insertFolder(getNowPlusMinutes(0), FOLDER.pad("aaa"), folder);
  String mimeType = "text/plain";
  String wrongName = "bbb";
  String wrongId = DOCUMENT.pad(wrongName);
  insertDocument(new Date(), wrongId, wrongId,
      folder + "/" + wrongName, wrongName, mimeType, "Wrong Document");

  // The correct document, with an embedded slash in the file name.
  String name = "aaa/bbb";
  String path = START_PATH + "/" + name;
  String content = "Right Document";
  String id = DOCUMENT.pad("ccc");
  insertDocument(new Date(), id, id, path, name, mimeType, content);

  // First try a DocId with an unencoded slash in the path.
  ByteArrayOutputStream boas = new ByteArrayOutputStream();
  RecordingResponse response = getDocContent(
      boas,
      ImmutableMap.<String, String>of(),
      new MockRequest(docIdFromPath(path, id)));
  assertTrue(response.getState() == State.NOT_FOUND);

  // Now try a DocId with encoded slash in the name.
  response = getDocContent(boas, ImmutableMap.<String, String>of(),
      new MockRequest(docIdFromPath(START_PATH, name, id)));
  assertFalse(response.getState() == State.NOT_FOUND);
  assertEquals(mimeType, response.getContentType());
  assertEquals(content, boas.toString(UTF_8.name()));
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:36,代码来源:DocumentumAdaptorTest.java

示例15: testGetDocContentNotFound

import com.google.enterprise.adaptor.testing.RecordingResponse.State; //导入依赖的package包/类
@Test
public void testGetDocContentNotFound() throws Exception {
  String path = START_PATH + "/aaa404";
  ByteArrayOutputStream boas = new ByteArrayOutputStream();
  assertEquals(State.NOT_FOUND,
      getDocContent(boas, DOCUMENT, path).getState());
}
 
开发者ID:googlegsa,项目名称:documentum,代码行数:8,代码来源:DocumentumAdaptorTest.java


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