Esempio n. 1
0
  @Before
  public void setUp() throws IOException {
    Injector i =
        Guice.createInjector(Modules.override(new GeogitModule()).with(new JEStorageModule()));

    GeoGIT gg = new GeoGIT(i, Tests.newTmpDir("geogit", "tmp"));

    Repository repo = gg.getOrCreateRepository();
    repo.command(ConfigOp.class)
        .setAction(ConfigAction.CONFIG_SET)
        .setName("user.name")
        .setValue("Wile E Coyote")
        .call();
    repo.command(ConfigOp.class)
        .setAction(ConfigAction.CONFIG_SET)
        .setName("user.email")
        .setValue("*****@*****.**")
        .call();

    addShp(TestData.states(), repo);
    addShp(TestData.point(), repo);
    addShp(TestData.line(), repo);
    addShp(TestData.polygon(), repo);

    repo.command(BranchCreateOp.class).setName("scratch").call();
    ws = new GeoGitWorkspace(gg, null);
  }
Esempio n. 2
0
  @Test
  public void testReadAll() throws Exception {
    Set<String> names =
        Sets.newHashSet(
            Iterables.transform(
                TestData.states().cursor(new Query()),
                new Function<Feature, String>() {
                  @Override
                  public String apply(Feature input) {
                    return (String) input.get("STATE_NAME");
                  }
                }));

    assertEquals(49, names.size());
    for (Feature f : ws.get("states").cursor(new Query())) {
      names.remove(f.get("STATE_NAME"));
    }

    assertTrue(names.isEmpty());
  }