use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class TagSorter method process.
/**
* {@inheritDoc}
*/
public void process(EntityContainer entityContainer) {
EntityContainer writeableContainer;
Entity entity;
Collection<Tag> sortedTags;
writeableContainer = entityContainer.getWriteableInstance();
entity = writeableContainer.getEntity();
sortedTags = sortTags(entity.getTags());
entity.getTags().clear();
entity.getTags().addAll(sortedTags);
sink.process(writeableContainer);
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class OsmWriterTest method testProcess8.
/**
* Test processing a Relation.
*/
@Test
public final void testProcess8() {
Relation testRelation;
testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0));
testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1"));
testRelation.getTags().add(new Tag("test_key1", "test_value1"));
testOsmWriter.process(new RelationContainer(testRelation));
// Nothing to assert; just expect no exception
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class OsmWriterTest method testProcess9.
/**
* Test processing a Bound after a Relation.
*/
@Test(expected = OsmosisRuntimeException.class)
public final void testProcess9() {
Relation testRelation;
testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0));
testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1"));
testRelation.getTags().add(new Tag("test_key1", "test_value1"));
testOsmWriter.process(new RelationContainer(testRelation));
testOsmWriter.process(new BoundContainer(new Bound("source")));
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class RelationWriterTest method testProcessRelationWithNoUser.
/**
* Test writing of a Relation element with no user.
*/
@Test
public final void testProcessRelationWithNoUser() {
Relation relation = new Relation(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 0));
relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
relation.getTags().add(new Tag("relationkey", "relationvalue"));
testRelationWriter.process(relation);
try {
testBufferedWriter.flush();
} catch (IOException e) {
e.printStackTrace();
fail("IOException");
}
String relationOpeningNoUserMatch = "^\\s*<relation\\s*" + "id=['\"]1234['\"]\\s*" + "version=['\"]2['\"]\\s*" + "timestamp=['\"]2013-10-07T10:24:31Z?['\"]\\s*" + ">\\s*";
String[] strArray = testWriter.toString().split("\\n", 6);
assertTrue(strArray[0].matches(relationOpeningNoUserMatch));
assertTrue(strArray[1].matches(nodeMemberMatch));
assertTrue(strArray[2].matches(wayMemberMatch));
assertTrue(strArray[3].matches(relationMemberMatch));
assertTrue(strArray[4].matches(relationTagMatch));
assertTrue(strArray[5].matches(relationClosingMatch));
}
use of org.mozilla.jss.asn1.Tag in project osmosis by openstreetmap.
the class FastXmlParser method readTag.
private Tag readTag() throws Exception {
Tag tag = new Tag(reader.getAttributeValue(null, ATTRIBUTE_NAME_KEY), reader.getAttributeValue(null, ATTRIBUTE_NAME_VALUE));
reader.nextTag();
reader.nextTag();
return tag;
}
Aggregations