case SNAPSHOT_COMPLETE: this.objectId = original.getObjectId(); this.srclocs = new ArrayList<LocatorIF>(original.getItemIdentifiers()); this.topic = SnapshotTopic.makeSnapshot(original.getTopic(), SnapshotTopic.SNAPSHOT_REFERENCE, processed); this.value = original.getValue();
private void write(TopicNameIF basename, int number) { AttributesImpl attributes = reifier(basename); attributes.addAttribute("", "", AT_NUMBER, null, "" + number); startElement(EL_NAME, attributes); attributes.clear(); write(basename.getValue()); writeType(basename); write(basename.getScope()); Object[] variants = basename.getVariants().toArray(); Arrays.sort(variants, variantComparator); for (int ix = 0; ix < variants.length; ix++) write((VariantNameIF) variants[ix], ix + 1); writeLocators(basename.getItemIdentifiers(), EL_ITEMIDENTIFIERS); endElement(EL_NAME); }
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); assertTrue("Base name source locator is not set", bn.getItemIdentifiers().contains(URILocator.create("x:source-locator"))); assertTrue("Base name not found by source locator", topicmap.getObjectByItemIdentifier(URILocator.create("x:source-locator")).equals(bn)); } });
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); assertTrue("Base name source locator is set", !bn.getItemIdentifiers().contains(URILocator.create("x:source-locator"))); assertTrue("Base name found by source locator", topicmap.getObjectByItemIdentifier(URILocator.create("x:source-locator")) == null); } });
@Override public void run(MasterTest mt) { TopicNameIF bn = (TopicNameIF)topicmap.getObjectById(mt.objectId); assertTrue("Added base name not found", bn != null); if (testInitialProperties) { assertTrue("Source locators is set", bn.getItemIdentifiers().isEmpty()); assertTrue("Scope is set", bn.getScope().isEmpty()); assertTrue("Type is set", bn.getType() == null); assertTrue("Value is set", "".equals(bn.getValue())); assertTrue("Variants is set", bn.getVariants().isEmpty()); } } });
public void testTopicNameItemIds() throws MalformedURLException { TopicIF topic = builder.makeTopic(); TopicNameIF bn = builder.makeTopicName(topic, "test"); bn.addItemIdentifier(new URILocator("http://psi.example.org")); TopicNameIF bn2 = builder.makeTopicName(topic, "test"); bn2.addItemIdentifier(new URILocator("http://psi.example.com")); DuplicateSuppressionUtils.removeDuplicates(topic); assertTrue("duplicate base names were not removed", topic.getTopicNames().size() == 1); bn = (TopicNameIF) topic.getTopicNames().iterator().next(); assertTrue("item IDs were not merged", bn.getItemIdentifiers().size() == 2); }