@Test public void testHashCommits() throws Exception { ObjectId commit1Id = hashCommand.setObject(commit1).call(); ObjectId commit2Id = hashCommand.setObject(commit2).call(); ObjectId commit1DuplicateId = hashCommand.setObject(commit1Duplicate).call(); assertNotNull(commit1Id); assertNotNull(commit2Id); assertNotNull(commit1DuplicateId); assertFalse(commit1Id.equals(commit2Id)); assertTrue(commit1Id.equals(commit1DuplicateId)); }
@Test public void testHashTags() throws Exception { ObjectId tagId = hashCommand.setObject(tag1).call(); ObjectId tagId2 = hashCommand.setObject(tag2).call(); assertNotNull(tagId); assertNotNull(tagId2); assertNotSame(tagId, tagId2); }
@Test public void testHashNullObject() throws Exception { try { hashCommand.setObject(null).call(); fail("expected IllegalStateException on null feature type"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("Object has not been set")); } }
map2.put("string", "hello"); map1.put("geom", geom("LINESTRING(1 1, 1.1 2.1, 100 1000)")); map2.put("geom", geom("LINESTRING(1 1, 1.1 2.1, 100 1000)")); Feature f1 = feature(featureType, "f1", "the name", map1); Feature f2 = feature(featureType, "f2", "the name", map2); Feature f3 = feature(featureType, "f3", "the name", map3); ObjectId oid3 = hashCommand.setObject(revFeature3).call(); assertNotNull(oid1); assertNotNull(oid2); assertNotNull(oid3); assertEquals(oid1, oid2); assertFalse(oid1.equals(oid3)); assertEquals(oid3, hashCommand.setObject(revFeature3).call());
@Test public void tesFeaturePropertyOfUnsupportedType() { TestSerializableObject serializableObject = new TestSerializableObject(); serializableObject.words = "words to serialize"; try { RevFeature.builder().addValue(1).addValue("s").addValue(serializableObject).build(); fail("Expected IAE"); } catch (IllegalArgumentException iae) { String expected = String.format( "Objects of type %s are not supported as property values (%s)", serializableObject.getClass().getName(), serializableObject); assertEquals(expected, iae.getMessage()); } }
@Test public void testHashCommitsConsistency() throws Exception { testHashCommitsConsistency(pointFeature1); testHashCommitsConsistency(featureType1); testHashCommitsConsistency(tag1); testHashCommitsConsistency(commit1); }
private void testHashCommitsConsistency(RevObject o) throws Exception { ObjectId expected = o.getId(); ObjectId actual = hashCommand.setObject(o).call(); assertEquals(expected, actual); } }
Feature coverageFeature = feature(coverageFeatureType, "TestType.Coverage.1", "StringProp1_1", null, Boolean.TRUE, Byte.valueOf("18"), new Double(100.01), new BigDecimal("1.89e1021"), new Float(12.5), new Integer(1000),
map2.put("string", "hello"); map1.put("geom", geom("LINESTRING(1 1, 1.1 2.1, 100 1000)")); map2.put("geom", geom("LINESTRING(1 1, 1.1 2.1, 100 1000)")); Feature f1 = feature(featureType, "f1", "the name", map1); Feature f2 = feature(featureType, "f2", "the name", map2); Feature f3 = feature(featureType, "f3", "the name", map3); ObjectId oid3 = hashCommand.setObject(revFeature3).call(); assertNotNull(oid1); assertNotNull(oid2); assertNotNull(oid3); assertEquals(oid1, oid2); assertFalse(oid1.equals(oid3)); assertEquals(oid3, hashCommand.setObject(revFeature3).call());
@Test public void testHashCommitsConsistency() throws Exception { testHashCommitsConsistency(pointFeature1); testHashCommitsConsistency(featureType1); testHashCommitsConsistency(tag1); testHashCommitsConsistency(commit1); }
private void testHashCommitsConsistency(RevObject o) throws Exception { ObjectId expected = o.getId(); ObjectId actual = hashCommand.setObject(o).call(); assertEquals(expected, actual); } }
spec); coverageFeature = feature(coverageFeatureType, "TestType.Coverage.1", attributeSampleValues.toArray());
@Test public void testHashCommits() throws Exception { ObjectId commit1Id = hashCommand.setObject(commit1).call(); ObjectId commit2Id = hashCommand.setObject(commit2).call(); ObjectId commit1DuplicateId = hashCommand.setObject(commit1Duplicate).call(); assertNotNull(commit1Id); assertNotNull(commit2Id); assertNotNull(commit1DuplicateId); assertFalse(commit1Id.equals(commit2Id)); assertTrue(commit1Id.equals(commit1DuplicateId)); }
@Test public void testHashNullObject() throws Exception { try { hashCommand.setObject(null).call(); fail("expected IllegalStateException on null feature type"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("Object has not been set")); } }
@Test public void testHashTags() throws Exception { ObjectId tagId = hashCommand.setObject(tag1).call(); ObjectId tagId2 = hashCommand.setObject(tag2).call(); assertNotNull(tagId); assertNotNull(tagId2); assertNotSame(tagId, tagId2); }
@Test public void testHashFeatures() throws Exception { ObjectId feature1Id = hashCommand.setObject(pointFeature1).call(); ObjectId feature2Id = hashCommand.setObject(pointFeature2).call(); ObjectId coverageFeatureId = hashCommand.setObject(coverageRevFeature).call(); ObjectId feature1DuplicateId = hashCommand.setObject(pointFeature1Duplicate).call(); assertNotNull(feature1Id); assertNotNull(feature2Id); assertNotNull(coverageFeatureId); assertNotNull(feature1DuplicateId); assertFalse(feature1Id.equals(feature2Id)); assertFalse(feature1Id.equals(coverageFeatureId)); assertFalse(feature2Id.equals(coverageFeatureId)); assertTrue(feature1Id.equals(feature1DuplicateId)); }
@Test public void tesFeaturePropertyOfUnsupportedType() { TestSerializableObject serializableObject = new TestSerializableObject(); serializableObject.words = "words to serialize"; try { RevFeatureBuilder.builder().addValue(1).addValue("s").addValue(serializableObject) .build(); fail("Expected IAE"); } catch (IllegalArgumentException iae) { String expected = "Objects of class " + serializableObject.getClass().getName() + " are not supported as RevFeature attributes"; assertTrue(iae.getMessage(), iae.getMessage().startsWith(expected)); } }
@Test public void testHashFeatureTypes() throws Exception { ObjectId featureType1Id = hashCommand.setObject(featureType1).call(); ObjectId featureType2Id = hashCommand.setObject(featureType2).call(); ObjectId coverageTypeId = hashCommand.setObject(coverageRevFeatureType).call(); ObjectId featureType1DuplicateId = hashCommand.setObject(featureType1Duplicate).call(); assertNotNull(featureType1Id); assertNotNull(featureType2Id); assertNotNull(coverageTypeId); assertNotNull(featureType1DuplicateId); assertFalse(featureType1Id.equals(featureType2Id)); assertFalse(featureType1Id.equals(coverageTypeId)); assertFalse(featureType2Id.equals(coverageTypeId)); assertTrue(featureType1Id.equals(featureType1DuplicateId)); }
@Test public void testHashFeatureTypes() throws Exception { ObjectId featureType1Id = hashCommand.setObject(featureType1).call(); ObjectId featureType2Id = hashCommand.setObject(featureType2).call(); ObjectId coverageTypeId = hashCommand.setObject(coverageRevFeatureType).call(); ObjectId featureType1DuplicateId = hashCommand.setObject(featureType1Duplicate).call(); assertNotNull(featureType1Id); assertNotNull(featureType2Id); assertNotNull(coverageTypeId); assertNotNull(featureType1DuplicateId); assertFalse(featureType1Id.equals(featureType2Id)); assertFalse(featureType1Id.equals(coverageTypeId)); assertFalse(featureType2Id.equals(coverageTypeId)); assertTrue(featureType1Id.equals(featureType1DuplicateId)); }
@Test public void testHashFeatures() throws Exception { ObjectId feature1Id = hashCommand.setObject(pointFeature1).call(); ObjectId feature2Id = hashCommand.setObject(pointFeature2).call(); ObjectId coverageFeatureId = hashCommand.setObject(coverageRevFeature).call(); ObjectId feature1DuplicateId = hashCommand.setObject(pointFeature1Duplicate).call(); assertNotNull(feature1Id); assertNotNull(feature2Id); assertNotNull(coverageFeatureId); assertNotNull(feature1DuplicateId); assertFalse(feature1Id.equals(feature2Id)); assertFalse(feature1Id.equals(coverageFeatureId)); assertFalse(feature2Id.equals(coverageFeatureId)); assertTrue(feature1Id.equals(feature1DuplicateId)); }