private RevFeature fakeFeature(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (ParseException e) { throw new RuntimeException(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
private RevFeature fakeFeature(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (Exception e) { throw Throwables.propagate(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
private RevFeature fakeFeature(int i) { ObjectId forcedId = fakeId(i); // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (ParseException e) { throw new RuntimeException(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
@Test public void testLookUpPrecondition() { final ObjectId id1 = ObjectId.valueOf("0123456700000000000000000000000000000000"); final ObjectId id2 = ObjectId.valueOf("01234567abc00000000000000000000000000000"); assertTrue(db.put(featureForceId(id1, "f1"))); assertTrue(db.put(featureForceId(id2, "f2"))); final String fullId = id1.toString(); for (int i = 0; i < 7; i++) { try { String partialId = fullId.substring(0, i); db.lookUp(partialId); } catch (IllegalArgumentException e) { assertTrue(e.getMessage(), e.getMessage().contains("must be at least 8 characters long")); } } List<ObjectId> found = db.lookUp(fullId.substring(0, 9)); assertNotNull(found); assertEquals(found.toString(), 1, found.size()); assertEquals(found.toString(), id1, found.get(0)); }
private RevObject fakeObject(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (Exception e) { throw new RuntimeException(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
private RevObject fakeObject(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (Exception e) { throw new RuntimeException(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
private RevObject fakeObject(ObjectId forcedId) { // String oidString = objectId.toString(); // ObjectId treeId = ObjectId.forString("tree" + oidString); // ImmutableList<ObjectId> parentIds = ImmutableList.of(); // RevPerson author = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // RevPerson committer = new RevPersonImpl("Gabriel", "groldan@boundlessgeo.com", 1000, -3); // String message = "message " + oidString; // return new RevCommitImpl(objectId, treeId, parentIds, author, committer, message); if (fakeGeom == null) { try { fakeGeom = new WKTReader().read( "MULTIPOLYGON (((-121.3647138 38.049474, -121.3646902 38.049614, -121.3646159 38.0496058, -121.3646188 38.049587, -121.3645936 38.049586, -121.3645924 38.0496222, -121.3645056 38.0496178, -121.3645321 38.0494567, -121.3647138 38.049474)))"); } catch (Exception e) { throw Throwables.propagate(e); } } return featureForceId(forcedId, fakeGeom, "Some string value " + forcedId); }
@Test public void testLookUpPrecondition() { final ObjectId id1 = ObjectId.valueOf("0123456700000000000000000000000000000000"); final ObjectId id2 = ObjectId.valueOf("01234567abc00000000000000000000000000000"); assertTrue(db.put(featureForceId(id1, "f1"))); assertTrue(db.put(featureForceId(id2, "f2"))); final String fullId = id1.toString(); for (int i = 0; i < 7; i++) { try { String partialId = fullId.substring(0, i); db.lookUp(partialId); } catch (IllegalArgumentException e) { assertTrue(e.getMessage(), e.getMessage().contains("must be at least 8 characters long")); } } List<ObjectId> found = db.lookUp(fullId.substring(0, 9)); assertNotNull(found); assertEquals(found.toString(), 1, found.size()); assertEquals(found.toString(), id1, found.get(0)); }
@Test public void testLookUp() { final ObjectId id1 = ObjectId.valueOf("0123456700000000000000000000000000000000"); final ObjectId id2 = ObjectId.valueOf("0123456780000000000000000000000000000000"); final ObjectId id3 = ObjectId.valueOf("0123456789000000000000000000000000000000"); final ObjectId id4 = ObjectId.valueOf("0123456789a00000000000000000000000000000"); final ObjectId id5 = ObjectId.valueOf("0123456789ab0000000000000000000000000000"); assertTrue(db.put(featureForceId(id1, "f1"))); assertTrue(db.put(featureForceId(id2, "f2"))); assertTrue(db.put(featureForceId(id3, "f3"))); assertTrue(db.put(featureForceId(id4, "f4"))); assertTrue(db.put(featureForceId(id5, "f5"))); HashSet<ObjectId> matches; matches = Sets.newHashSet(db.lookUp("00000000")); assertEquals(Sets.newHashSet(), matches); matches = Sets.newHashSet(db.lookUp("ffffffff")); assertEquals(Sets.newHashSet(), matches); matches = Sets.newHashSet(db.lookUp("01234567")); assertEquals(Sets.newHashSet(id1, id2, id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("012345678")); assertEquals(Sets.newHashSet(id2, id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789")); assertEquals(Sets.newHashSet(id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789a")); assertEquals(Sets.newHashSet(id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789ab")); assertEquals(Sets.newHashSet(id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789abc")); assertEquals(Sets.newHashSet(), matches); }
@Test public void testLookUp() { final ObjectId id1 = ObjectId.valueOf("0123456700000000000000000000000000000000"); final ObjectId id2 = ObjectId.valueOf("0123456780000000000000000000000000000000"); final ObjectId id3 = ObjectId.valueOf("0123456789000000000000000000000000000000"); final ObjectId id4 = ObjectId.valueOf("0123456789a00000000000000000000000000000"); final ObjectId id5 = ObjectId.valueOf("0123456789ab0000000000000000000000000000"); assertTrue(db.put(featureForceId(id1, "f1"))); assertTrue(db.put(featureForceId(id2, "f2"))); assertTrue(db.put(featureForceId(id3, "f3"))); assertTrue(db.put(featureForceId(id4, "f4"))); assertTrue(db.put(featureForceId(id5, "f5"))); HashSet<ObjectId> matches; matches = Sets.newHashSet(db.lookUp("00000000")); assertEquals(Sets.newHashSet(), matches); matches = Sets.newHashSet(db.lookUp("ffffffff")); assertEquals(Sets.newHashSet(), matches); matches = Sets.newHashSet(db.lookUp("01234567")); assertEquals(Sets.newHashSet(id1, id2, id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("012345678")); assertEquals(Sets.newHashSet(id2, id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789")); assertEquals(Sets.newHashSet(id3, id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789a")); assertEquals(Sets.newHashSet(id4, id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789ab")); assertEquals(Sets.newHashSet(id5), matches); matches = Sets.newHashSet(db.lookUp("0123456789abc")); assertEquals(Sets.newHashSet(), matches); }
RevFeature f1 = RevObjectTestSupport.featureForceId(getOID(2), wkt.read("POINT(0 0)"), "abc", "def"); RevFeature f2 = RevObjectTestSupport.featureForceId(getOID(3), wkt.read("POINT(0 0)"), "rrr", "ddd");
RevFeature f1 = RevObjectTestSupport.featureForceId(getOID(2), wkt.read("POINT(0 0)"), "abc", "def"); RevFeature f2 = RevObjectTestSupport.featureForceId(getOID(3), wkt.read("POINT(0 0)"), "rrr", "ddd");
(fr) -> RevObjectTestSupport.featureForceId(fr.getObjectId(), fr.getObjectId().toString())); db.putAll(fakeFeatures);
(fr) -> RevObjectTestSupport.featureForceId(fr.getObjectId(), fr.getObjectId().toString())); db.putAll(fakeFeatures);