Package com.google.enterprise.connector.sharepoint.state

Examples of com.google.enterprise.connector.sharepoint.state.GlobalState


    System.out.println("\n...Setting Up...");
    System.out.println("Initializing SPDocumentList ...");

    sharepointClientContext = TestConfiguration.initContext();

    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext, TestConfiguration.Site1_URL);

    final SiteDataHelper siteData = new SiteDataHelper(sharepointClientContext);
    List<ListState> listCollection = siteData.getNamedLists(ws);
    assertNotNull(listCollection);
    for (ListState baseList : listCollection) {
View Full Code Here


    System.out.println("[ checkpoint() ] Test Completed.");
  }

  public void testDefensiveCopyForDocumentList() {
    MockClientFactory mockClientFactory = new MockClientFactory();
    GlobalState globalState =
        new GlobalState(mockClientFactory,"temp",FeedType.CONTENT_FEED);
    List<SPDocument> mutableDocumentList = new ArrayList<SPDocument>();
    SPDocument document1 = new SPDocument(
        "LIST_ITEM_1", "http://sharepoint.example.com/List1/DispForm.aspx?ID=1",
        Calendar.getInstance(), SpiConstants.ActionType.ADD);
    mutableDocumentList.add(document1);
View Full Code Here

   * @throws SharepointException
   */
  public static GlobalState initState(
      SharepointClientContext sharepointClientContext)
      throws SharepointException {
    GlobalState globalState = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, TestConfiguration.feedType);

    if (null != Site1_URL && Site1_URL.trim().length() > 0) {
      WebState webstate1 = globalState.makeWebState(sharepointClientContext, TestConfiguration.Site1_URL);
      if (null != Site1_List1_URL && Site1_List1_URL.trim().length() > 0) {
        ListState liststate11 = new ListState(Site1_List1_GUID, "inTitle",
            SPConstants.DOC_LIB, Calendar.getInstance(), "", Site1_List1_URL,
            webstate1);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site1_List1_Item1_URL
            && Site1_List1_Item1_URL.trim().length() > 0) {
          SPDocument doc = new SPDocument("111", Site1_List1_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site1_List1_Item2_URL
            && Site1_List1_Item2_URL.trim().length() > 0) {
          SPDocument doc = new SPDocument("112", Site1_List1_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate11.setCrawlQueue(docs);
        webstate1.AddOrUpdateListStateInWebState(liststate11, new DateTime());
      }
      if (null != Site1_List2_URL && Site1_List2_URL.trim().length() > 0) {
        ListState liststate12 = new ListState(Site1_List2_GUID, "inTitle",
            SPConstants.GENERIC_LIST, Calendar.getInstance(), "",
            Site1_List2_URL, webstate1);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site1_List2_Item1_URL
            && Site1_List2_Item1_URL.trim().length() > 0) {
          SPDocument doc = new SPDocument("121", Site1_List2_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site1_List2_Item2_URL
            && Site1_List2_Item2_URL.trim().length() > 0) {
          SPDocument doc = new SPDocument("122", Site1_List2_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate12.setCrawlQueue(docs);
        webstate1.AddOrUpdateListStateInWebState(liststate12, new DateTime());
      }
    }

    if (null != Site2_URL && Site2_URL.trim().length() > 0) {
      WebState webstate2 = globalState.makeWebState(sharepointClientContext, TestConfiguration.Site2_URL);
      if (null != Site2_List1_URL && Site2_List1_URL.trim().length() > 0) {
        ListState liststate21 = new ListState(Site2_List1_GUID, "inTitle",
            SPConstants.DOC_LIB, Calendar.getInstance(), "", Site2_List1_URL,
            webstate2);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site2_List1_Item1_URL) {
          SPDocument doc = new SPDocument("211", Site2_List1_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site2_List1_Item2_URL) {
          SPDocument doc = new SPDocument("212", Site2_List1_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate21.setCrawlQueue(docs);
        webstate2.AddOrUpdateListStateInWebState(liststate21, new DateTime());
      }
      if (null != Site2_List2_URL && Site2_List2_URL.trim().length() > 0) {
        ListState liststate22 = new ListState(Site1_List2_GUID, "inTitle",
            SPConstants.GENERIC_LIST, Calendar.getInstance(), "",
            Site2_List2_URL, webstate2);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site2_List2_Item1_URL) {
          SPDocument doc = new SPDocument("221", Site2_List2_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site2_List2_Item2_URL) {
          SPDocument doc = new SPDocument("222", Site2_List2_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate22.setCrawlQueue(docs);
        webstate2.AddOrUpdateListStateInWebState(liststate22, new DateTime());
      }
    }

    if (null != Site3_URL && Site3_URL.trim().length() > 0) {
      WebState webstate3 = globalState.makeWebState(sharepointClientContext, TestConfiguration.Site3_URL);
      if (null != Site3_List1_URL && Site3_List1_URL.trim().length() > 0) {
        ListState liststate31 = new ListState(Site3_List1_GUID, "inTitle",
            SPConstants.DOC_LIB, Calendar.getInstance(), "", Site3_List1_URL,
            webstate3);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site3_List1_Item1_URL) {
          SPDocument doc = new SPDocument("311", Site3_List1_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site3_List1_Item2_URL) {
          SPDocument doc = new SPDocument("312", Site3_List1_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate31.setCrawlQueue(docs);
        webstate3.AddOrUpdateListStateInWebState(liststate31, new DateTime());
      }
      if (null != Site3_List2_URL && Site3_List2_URL.trim().length() > 0) {
        ListState liststate32 = new ListState(Site3_List2_GUID, "inTitle",
            SPConstants.GENERIC_LIST, Calendar.getInstance(), "",
            Site3_List2_URL, webstate3);
        List<SPDocument> docs = new ArrayList<SPDocument>();
        if (null != Site3_List2_Item1_URL) {
          SPDocument doc = new SPDocument("321", Site3_List2_Item1_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        if (null != Site3_List2_Item2_URL) {
          SPDocument doc = new SPDocument("322", Site2_List2_Item2_URL,
              Calendar.getInstance(), ActionType.ADD);
          docs.add(doc);
        }
        liststate32.setCrawlQueue(docs);
        webstate3.AddOrUpdateListStateInWebState(liststate32, new DateTime());
      }
    }
    if (null != Site4_URL && Site4_URL.trim().length() > 0) {
      WebState webstate4 = globalState.makeWebState(sharepointClientContext, TestConfiguration.Site4_URL);
      if (null != Site4_List1_URL && Site4_List1_URL.trim().length() > 0) {
        ListState liststate41 = new ListState(Site4_List1_GUID, "inTitle",
            SPConstants.DOC_LIB, Calendar.getInstance(), "", Site4_List1_URL,
            webstate4);
        List<SPDocument> docs = new ArrayList<SPDocument>();
View Full Code Here

          + inSharepointClientContext.getSiteURL() + ", "
          + inSharepointClientContext.getGoogleConnectorWorkDir());
      sharepointClientContext = inSharepointClientContext;
      sharepointClientContextOriginal = (SharepointClientContext) inSharepointClientContext
          .clone();
      globalState = new GlobalState(clientFactory,
          inSharepointClientContext.getGoogleConnectorWorkDir(),
          inSharepointClientContext.getFeedType());
      globalState.loadState();
    } catch (final Exception e) {
      LOGGER.log(Level.WARNING, e.getMessage());
View Full Code Here

    final String workDir = sharepointClientContext.getGoogleConnectorWorkDir();
    // delete the global state.. to simulate full crawl
    GlobalState.forgetState(workDir);
    sharepointClientContext.clearExcludedURLLogs();
    sharepointClientContext.setInitialTraversal(true);
    globalState = new GlobalState(clientFactory,
        sharepointClientContext.getGoogleConnectorWorkDir(),
        sharepointClientContext.getFeedType());
    globalState.setCrawlState(CrawlState.DOC_FEED);
  }
View Full Code Here

    listsHelper = new ListsHelper(this.sharepointClientContext);

    System.out.println("Creating test List ...");
    final SiteDataHelper siteData = new SiteDataHelper(this.sharepointClientContext);

    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext, TestConfiguration.sharepointUrl);

    List<ListState> listCollection = siteData.getNamedLists(ws);
    assertNotNull(listCollection);

    for (ListState baseList : listCollection) {
View Full Code Here

    listsHelper = new ListsHelper(sharepointClientContext);

    final SiteDataHelper siteData =
        new SiteDataHelper(sharepointClientContext);

    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    final WebState ws =
        state.makeWebState(sharepointClientContext, "http://example.com");

    List<ListState> listCollection = siteData.getNamedLists(ws);
    assertNotNull(listCollection);

    // A default port of 80 will be appended to "http://example.com" by
View Full Code Here

    this.siteData = new SiteDataHelper(this.sharepointClientContext);
    assertNotNull(this.siteData);
  }

  public void testGetNamedList() throws Exception {
    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    final WebState ws = state.makeWebState(sharepointClientContext,
        TestConfiguration.sharepointUrl);
    assertNotNull(ws);
    List<ListState> items = this.siteData.getNamedLists(ws);
    assertNotNull(items);
  }
View Full Code Here

    final String webTitle = this.siteData.getTitle();
    assertNotNull(webTitle);
  }

  public void testGetSiteData() throws Exception {
    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext,
        TestConfiguration.sharepointUrl + SPConstants.DEFAULT_SITE_LANDING_PAGE);
    final SPDocument document = this.siteData.getSiteData(ws);
    assertNotNull(document);
    String author = document.getAuthor().toLowerCase();
    String objectType = document.getObjType();
View Full Code Here

    assertEquals(TestConfiguration.userNameFormat2, author);
    assertEquals("Site", objectType);
  }
 
  public void testGetSiteDataWithUtf() throws Exception {
    final GlobalState state = new GlobalState(clientFactory,
        TestConfiguration.googleConnectorWorkDir, FeedType.CONTENT_FEED);
    WebState ws = state.makeWebState(sharepointClientContext,
        TestConfiguration.UTF8SiteUrl);
    final SPDocument document = this.siteData.getSiteData(ws);
    assertNotNull(document);
    // document Type should be null. For Publishing sites it will be ACL.
    assertNull(document.getDocumentType());
View Full Code Here

TOP

Related Classes of com.google.enterprise.connector.sharepoint.state.GlobalState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.