Package com.google.gdata.data.spreadsheet

Examples of com.google.gdata.data.spreadsheet.SpreadsheetEntry


public class SpreadsheetUtil {

  public static SpreadsheetEntry createSpreadsheet(String authSubToken, String[] kinds) {
    GbSpreadsheetService goboService = new GbSpreadsheetService(authSubToken);
    try {
      SpreadsheetEntry createSpreadsheet =
        goboService.createSpreadsheet(Arrays.asList(kinds));
      for (String kind : kinds) {
        List<GbProperty> testPropList1 = TestDataUtil.entities2();
        goboService.prepareWorksheet(createSpreadsheet.getKey(), kind, testPropList1);
      }
      return createSpreadsheet;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here


  }

  public static SpreadsheetEntry createAndDumpSpreadsheet(String authSubToken, String[] kinds) {
    GbSpreadsheetService goboService = new GbSpreadsheetService(authSubToken);
    try {
      SpreadsheetEntry createSpreadsheet =
        goboService.createSpreadsheet(Arrays.asList(kinds));
      int i = 0;
      for (String kind : kinds) {
        List<GbProperty> testPropList1 = TestDataUtil.entities2();
        goboService.prepareWorksheet(createSpreadsheet.getKey(), kind, testPropList1);
        List<GbEntity> list = TestDataUtil.entities(kind);
        goboService.dumpData(createSpreadsheet.getKey(), kind, String.valueOf(i++), list, false);
      }
      return createSpreadsheet;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

  }

  public static SpreadsheetEntry createBlunkSpreadsheet(String authSubToken, String[] kinds) {
    GbSpreadsheetService goboService = new GbSpreadsheetService(authSubToken);
    try {
      SpreadsheetEntry createSpreadsheet =
        goboService.createSpreadsheet(Arrays.asList(kinds));
      return createSpreadsheet;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

  @Test
  public void createSingleWorksheetTest() throws IOException, ServiceException {

    String[] kinds = new String[] { "TestKind1" };
    final SpreadsheetEntry spreadsheet = createSpreadsheet(kinds);
    try {

      List<Map<String, String>> bookList = goboService.getAllSpreadSheets();
      System.out.println(bookList);
      assertTrue(bookList.size() > 0);

      List<Map<String, String>> sheetList =
        goboService.getAllWorkSheets(spreadsheet.getKey());
      System.out.println(sheetList);
      assertThat(sheetList.size(), is(1));
      assertThat(sheetList.get(0).get("wsTitle"), is(kinds[0]));

    } finally {
View Full Code Here

  @Test
  public void createMultiWorksheetTest() throws IOException, ServiceException {

    String[] kinds = new String[] { "TestKind1", "TestKind2", "TestKind3" };
    final SpreadsheetEntry spreadsheet = createSpreadsheet(kinds);
    try {
      List<Map<String, String>> bookList = goboService.getAllSpreadSheets();
      System.out.println(bookList);
      assertTrue(bookList.size() > 0);

      List<Map<String, String>> sheetList =
        goboService.getAllWorkSheets(spreadsheet.getKey());
      System.out.println(sheetList);
      assertThat(sheetList.size(), is(3));
      assertThat(sheetList.get(0).get("wsTitle"), is(kinds[0]));
      assertThat(sheetList.get(1).get("wsTitle"), is(kinds[1]));
      assertThat(sheetList.get(2).get("wsTitle"), is(kinds[2]));
View Full Code Here

    for (int i = 0; i < 10; i++) {
      kindList.add("TestKind" + i);
    }
    String[] kinds = kindList.toArray(new String[0]);
    List<GbProperty> propList = TestDataUtil.entities2();
    final SpreadsheetEntry spreadsheet = createSpreadsheet(kinds);
    try {
      for (int i = 0; i < kinds.length; i++) {
        String tableId =
          goboService.prepareWorksheet(spreadsheet.getKey(), kinds[i], propList);
        assertThat(tableId, is(String.valueOf(i)));
      }
    } finally {
      deleteSpreadsheet(spreadsheet);
    }
View Full Code Here

  @Test
  public void updateWorksheetTwiceForRetryTest() throws Exception {

    String[] kinds = new String[] { "TestKind1" };
    List<GbProperty> propList = TestDataUtil.entities2();
    final SpreadsheetEntry spreadsheet = createSpreadsheet(kinds);
    try {

      goboService.prepareWorksheet(spreadsheet.getKey(), kinds[0], propList);
      goboService.prepareWorksheet(spreadsheet.getKey(), kinds[0], propList);

    } finally {
      deleteSpreadsheet(spreadsheet);
    }
  }
View Full Code Here

      kindList.add("TestKind" + i);
    }
    String[] kinds = kindList.toArray(new String[0]);

    List<GbProperty> propList = TestDataUtil.entities2();
    final SpreadsheetEntry spreadsheet = createSpreadsheet(kinds);
    String ssKey = spreadsheet.getKey();
    try {
      for (int i = 0; i < kinds.length; i++) {
        String tableId = goboService.prepareWorksheet(ssKey, kinds[i], propList);
        assertThat(tableId, is(String.valueOf(i)));
      }
View Full Code Here

  SpreadsheetEntry createSpreadsheet(String[] kinds) {
    goboService = new GbSpreadsheetService(authSubToken);
    List<GbProperty> entities = TestDataUtil.entities2();
    try {
      SpreadsheetEntry spreadsheet = goboService.createSpreadsheet(Arrays.asList(kinds));
      for (String kind : kinds) {
        goboService.prepareWorksheet(spreadsheet.getKey(), kind, entities);
      }
      return spreadsheet;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

    ControllerTester tester = new ControllerTester();
    HttpSession session = tester.request.getSession(true);
    session.setAttribute("token", authSubToken);

    String[] kinds = new String[] { "TestKind1" };
    final SpreadsheetEntry spreadsheet = SpreadsheetUtil.createSpreadsheet(authSubToken, kinds);
    try {
      String run = tester.start("/restore/index");
      assertNotNull(run);
      List<Map<String, Object>> list = (List) tester.request.getAttribute("list");
      assertThat(list.size(), not(0));
View Full Code Here

TOP

Related Classes of com.google.gdata.data.spreadsheet.SpreadsheetEntry

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.