src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
PluginForMongo implements Uml2XsdPlugin { @Override public Map<String, String> declarePrefixMappings() { final Map<String, String> pms = new HashMap<String, String>(); pms.put("sli", SliMongoConstants.NAMESPACE_SLI); return Collections.unmodifiableMap(pms); } static final boolean isUnbounded(final Occurs occurs); @Ove...
@Test public void testDeclarePrefixMappings() throws Exception { final Map<String, String> prefixMappings = pluginForMongo.declarePrefixMappings(); Assert.assertTrue(prefixMappings.containsKey("sli")); }
PluginForMongo implements Uml2XsdPlugin { @Override public QName getElementType(final String name, final boolean isAssociation) { return getTypeName(name); } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, f...
@Test public void testGetElementType() throws Exception { final QName qName = pluginForMongo.getElementType("test", false); Assert.assertEquals("test", qName.getLocalPart()); }
PluginForMongo implements Uml2XsdPlugin { @Override public QName getGraphAssociationEndName(final PsmDocument<Type> classType) { return new QName(classType.getGraphAssociationEndName().getName()); } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override ...
@Test public void testGetGraphAssociationEndName() throws Exception { final PsmDocument<Type> doc = new PsmDocument<Type>(Mockito.mock(Type.class), new PsmResource("testResource"), new PsmCollection("testCollection")); Assert.assertEquals("testResource", pluginForMongo.getGraphAssociationEndName(doc).getLocalPart()); }
PluginForMongo implements Uml2XsdPlugin { @Override public QName getElementName(final String name, final boolean isReference) { return new QName(Uml2XsdTools.camelCase(name)); } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(...
@Test public void testGetElementName() throws Exception { final PsmDocument<Type> doc = new PsmDocument<Type>(Mockito.mock(Type.class), new PsmResource("testResource"), new PsmCollection("testCollection")); Assert.assertEquals("testCollection", pluginForMongo.getElementName(doc).getLocalPart()); } @Test public void tes...
PluginForMongo implements Uml2XsdPlugin { @Override public String getTargetNamespace() { return SliMongoConstants.NAMESPACE_SLI; } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); ...
@Test public void testGetTargetNamespace() throws Exception { Assert.assertEquals(pluginForMongo.getTargetNamespace(), SliMongoConstants.NAMESPACE_SLI); }
PluginForMongo implements Uml2XsdPlugin { @Override public QName getTypeName(final String name) { return new QName(name); } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Overri...
@Test public void testGetTypeName() throws Exception { final QName test = new QName("test"); Assert.assertEquals(test, pluginForMongo.getTypeName("test")); }
PluginForMongo implements Uml2XsdPlugin { @Override public boolean isAttributeFormDefaultQualified() { return true; } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QNa...
@Test public void testIsAttributeFormDefaultQualified() throws Exception { Assert.assertTrue(pluginForMongo.isAttributeFormDefaultQualified()); }
PluginForMongo implements Uml2XsdPlugin { @Override public boolean isElementFormDefaultQualified() { return true; } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName...
@Test public void testIsElementFormDefaultQualified() throws Exception { Assert.assertTrue(pluginForMongo.isElementFormDefaultQualified()); }
OfflineTool { public static void main(String[] args) throws IOException { ApplicationContext context = new ClassPathXmlApplicationContext("spring/applicationContext.xml"); OfflineTool main = context.getBean(OfflineTool.class); main.start(args); } static void main(String[] args); void setController(ValidationController...
@Test public void testMain() throws Throwable { reset(); toolTest("zipFile/Session1.zip", "processing is complete."); Mockito.verify(messageReport, Mockito.never()).error(Mockito.any(ReportStats.class), Matchers.any(Source.class), Mockito.any(MessageCode.class)); Mockito.verify(cntlr, Mockito.times(1)).doValidation((Fi...
PluginForMongo implements Uml2XsdPlugin { @Override public boolean isEnabled(final QName name) { return false; } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName ge...
@Test public void testIsEnabled() throws Exception { Assert.assertFalse(pluginForMongo.isEnabled(new QName("test"))); }
PluginForMongo implements Uml2XsdPlugin { @Override public void writeAppInfo(final TaggedValue taggedValue, final ModelIndex lookup, final Uml2XsdPluginWriter xsw) { final TagDefinition tagDefinition = lookup.getTagDefinition(taggedValue.getTagDefinition()); xsw.appinfo(); if (SliUmlConstants.TAGDEF_NATURAL_KEY.equals(...
@Test public void testWriteAppInfo() throws Exception { final Identifier mockID = Identifier.fromString("1234"); final TaggedValue mockTaggedValue = new TaggedValue("test", mockID); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class...
PluginForMongo implements Uml2XsdPlugin { @Override public void writeAssociation(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { if (PluginHelpers.isMongoNavigable(end, model)) { final Type type = model.getType(end.getType()); xsw.element(); try { if (Plug...
@Test public void testWriteAssociation() throws Exception { final ClassType mockClass = Mockito.mock(ClassType.class); final List<TaggedValue> mockTaggedValues = new ArrayList<TaggedValue>(); final Identifier id = Identifier.random(); final Identifier testId = Identifier.fromString("1234"); mockTaggedValues.add(new Tag...
PluginForMongo implements Uml2XsdPlugin { @Override public void writeTopLevelElement(PsmDocument<Type> classType, ModelIndex model, Uml2XsdPluginWriter xsw) { xsw.element(); try { final QName name = getElementName(classType); xsw.elementName(name); final Type elementType = classType.getType(); xsw.type(getQName(element...
@Test public void testWriteTopLevelElement() throws Exception { @SuppressWarnings("unchecked") final PsmDocument<Type> classType = Mockito.mock(PsmDocument.class); final Type mockType = Mockito.mock(Type.class); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito....
PluginForMongo implements Uml2XsdPlugin { public static final boolean isUnbounded(final Occurs occurs) { return occurs.equals(Occurs.UNBOUNDED); } static final boolean isUnbounded(final Occurs occurs); @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolea...
@Test public void testIsUnbounded() { final Occurs truthy = Occurs.UNBOUNDED; Assert.assertTrue(PluginForMongo.isUnbounded(truthy)); final Occurs falsey = Occurs.ONE; Assert.assertFalse(PluginForMongo.isUnbounded(falsey)); }
EdFiSLICmdLine { public static void main(final String[] args) { String sliInputFilename = (args.length == 2) ? args[0] : DEFAULT_SLI_INPUT_FILENAME; String edfiInputFilename = (args.length == 2) ? args[1] : DEFAULT_EDFI_INPUT_FILENAME; try { final ModelIndex slim = new DefaultModelIndex(XmiReader.readModel(sliInputFile...
@Test public void testMain() { String inputSliXmiFilename = "src/test/resources/SLI.xmi"; String inputEdfiXmiFilename = "src/test/resources/Ed-Fi-Core.xmi"; String[] args = new String[]{inputSliXmiFilename, inputEdfiXmiFilename}; final StringBuffer stringBuffer = new StringBuffer(); PrintStream stdOut = System.out; Pri...
WhereUsedCmdLine { public static void main(final String[] args) { String inputFilename = (args.length == 2) ? args[0] : DEFAULT_INPUT_FILENAME; String name = (args.length == 2) ? args[1] : DEFAULT_NAME; try { final Model model = XmiReader.readModel(inputFilename); final ModelIndex index = new DefaultModelIndex(model); ...
@Test public void testMain() { String inputFilename = "src/test/resources/psm_sli.xmi"; String name = "assessmentTitle"; String[] args = new String[]{inputFilename, name}; final StringBuffer stringBuffer = new StringBuffer(); PrintStream stdOut = System.out; PrintStream myOut = new PrintStream(new OutputStream() { @Ove...
WadlComparator { public static void main(String[] args) throws IOException { if (args.length < 3 || args[0].toLowerCase().equals("h") || args[0].equals("?")) { STDOUT.println("Usage:"); STDOUT.println("java WadlComparator pathToGoldenWadl pathToGenerateWadl pathToReportFile"); System.exit(1); } pathToGoldenWadl = args[...
@Test public void testMain() throws IOException { String pathToGoldenWadl = "src/test/resources/domain_SLI.wadl"; String pathToGeneratedWadl = "src/test/resources/scaffold_eapplication.wadl"; String pathToReportFile = "WadlComparatorOutput.txt"; WadlComparator.main(new String[]{pathToGoldenWadl, pathToGeneratedWadl, pa...
Wadl2Doc { public static void main(final String[] args) { String inputFilename = (args.length == 2) ? args[0] : DEFAULT_INPUT_FILENAME; String outputFilename = (args.length == 2) ? args[1] : DEFAULT_OUTPUT_FILENAME; try { final Map<String, String> prefixMappings = new HashMap<String, String>(); final Application app = ...
@Test public void testMain() { String inputFilename = "src/test/resources/scaffold_eapplication.wadl"; String outputFilename = "cleaned_domain_SLI.wadl"; String[] args = new String[]{inputFilename, outputFilename}; Wadl2Doc.main(args); File file = new File(outputFilename); assertTrue(file.exists()); file.delete(); }
XsdSelector { public Map<String, Resource> getXsdList() { return xsdList; } Resource provideXsdResource(IngestionFileEntry xmlFile); Map<String, Resource> getXsdList(); void setXsdList(Map<String, Resource> xsdList); }
@Test public void testLoadXsds() { Map<String, Resource> resources = xsdSelector.getXsdList(); assertNotNull(resources.get("AssessmentMetadata")); assertNotNull(resources.get("EducationOrganization")); assertNotNull(resources.get("EducationOrgCalendar")); assertNotNull(resources.get("MasterSchedule")); assertNotNull(re...
WadlViewer { public static void main(final String[] args) { String inputFilename = (args.length == 1) ? args[0] : DEFAULT_INPUT_FILENAME; try { final Application app = WadlReader.readApplication(inputFilename); final WadlWalker walker = new WadlWalker(new WadlViewerHandler()); walker.walk(app); } catch (final FileNotFo...
@Test public void testMain() { final StringBuffer stringBuffer = new StringBuffer(); PrintStream stdOut = System.out; PrintStream myOut = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { stringBuffer.append((char) b); } }); System.setOut(myOut); WadlViewer.main(new String[]{"...
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host) { final List<TagDefinition> tagDefs = new LinkedList<TagDefinition>(); tagDefs.add(makeTagDefinition(SliUmlConstants.TAGDEF_COLLECTION_NAME, Occurs.ZERO, Occurs.ONE, host)); tagDef...
@Test public void testDeclareTagDefinitions() throws Exception { Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); Mockito.when(host.ensureTagDefinitionId(Matchers.anyString())).thenReturn(Identifier.random()); List<TagDefinition> tagDefinitionList = pluginForSLI.declareTagDefinitions(host); Assert.assert...
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedVa...
@Test public void testGetAssociationEndTypeName() throws Exception { ClassType classType = Mockito.mock(ClassType.class); Attribute attribute = Mockito.mock(Attribute.class); Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); TaggedValue taggedValue = Mockito.mock(TaggedValue.class); TagDefinition tagDefin...
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition ...
@Test public void testIsAssociationEnd() throws Exception { ClassType classType = Mockito.mock(ClassType.class); Attribute attribute = Mockito.mock(Attribute.class); Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); TaggedValue taggedValue = Mockito.mock(TaggedValue.class); TagDefinition tagDefinition = M...
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String nameAssociation(final AssociationEnd lhs, final AssociationEnd rhs, final Xsd2UmlHostedPlugin host) { return ""; } Xsd2UmlPluginForSLI(); @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); @Override String getAsso...
@Test public void testNameAssociation() throws Exception { AssociationEnd associationEnd = Mockito.mock(AssociationEnd.class); Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); Assert.assertTrue(pluginForSLI.nameAssociation(associationEnd, associationEnd, host.getPlugin()).isEmpty()); }
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host) { final List<TaggedValue> taggedValues = new LinkedList<TaggedValue>(); final NodeList markup = appInfo.getMarkup(); for (int i = 0; i < markup.getLength();...
@Test public void testTagsFromAppInfo() throws Exception { XmlSchemaAppInfo xmlSchemaAppInfo = Mockito.mock(XmlSchemaAppInfo.class); Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); NodeList nodeList = Mockito.mock(NodeList.class); Element node = Mockito.mock(Element.class); Mockito.when(host.ensureTagDe...
Xsd2UmlPluginGeneric extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host) { return Collections.emptyList(); } @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); @Override String getAssociat...
@Test public void testDeclareTagDefinitions() throws Exception { Assert.assertEquals(Collections.emptyList(), generic.declareTagDefinitions(host)); }
Xsd2UmlPluginGeneric extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { throw new UnsupportedOperationException(); } @Override List<TagDefinition> declareTagDefinitions(fin...
@Test(expected = UnsupportedOperationException.class) public void testGetAssociationEndTypeName() throws Exception { generic.getAssociationEndTypeName(classType, attribute, host); }
Xsd2UmlPluginGeneric extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { throw new UnsupportedOperationException(); } @Override List<TagDefinition> declareTagDefinitions(final Xsd2U...
@Test(expected = UnsupportedOperationException.class) public void testIsAssociationEnd() throws Exception { generic.isAssociationEnd(classType, attribute, host); }
XsdSelector { public Resource provideXsdResource(IngestionFileEntry xmlFile) { Resource xsdResource = xsdList.get(xmlFile.getFileType().getName()); return xsdResource; } Resource provideXsdResource(IngestionFileEntry xmlFile); Map<String, Resource> getXsdList(); void setXsdList(Map<String, Resource> xsdList); }
@Test public void testValidXmlFile() { final String xmlFileName = "SLI-InterchangeSchool.xml"; final String parentDir = "dummylz"; final String checksum = "e1e10"; final String expectedXsdResource = "SLI-Interchange-EducationOrganization.xsd"; IngestionFileEntry xmlFile = new IngestionFileEntry(parentDir, FileFormat.ED...
FileUtils { public static final File zipIngestionData(String localDataDir) throws IOException { final class OnlyIngestionFiles implements FilenameFilter { public boolean accept(File file, String name) { return (name.endsWith(".xml") || name.endsWith(".ctl")); } } File pathDir = new File(localDataDir); File output = new...
@Test public void zipFilesInDirectory() throws IOException { File directory = new File("target"); File testFile = new File(directory, "test.xml"); try { testFile.createNewFile(); } catch (IOException e) { Assert.fail("Unable to set up test preconditions."); } Assert.assertTrue("zip operation should succeed", FileUtils....
Xsd2UmlPluginGeneric extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameAssociation(AssociationEnd lhs, AssociationEnd rhs, Xsd2UmlHostedPlugin host) { throw new UnsupportedOperationException(); } @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); ...
@Test(expected = UnsupportedOperationException.class) public void testNameAssociation() throws Exception { AssociationEnd end = Mockito.mock(AssociationEnd.class); generic.nameAssociation(end, end, generic); }
Xsd2UmlPluginGeneric extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host) { throw new UnsupportedOperationException(); } @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost ...
@Test(expected = UnsupportedOperationException.class) public void testTagsFromAppInfo() throws Exception { XmlSchemaAppInfo appInfo = Mockito.mock(XmlSchemaAppInfo.class); generic.tagsFromAppInfo(appInfo, host); }
Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public final String nameFromComplexTypeExtension(final QName complexType, final QName base) { if (complexType == null) { throw new IllegalArgumentException("complexType"); } if (base == null) { throw new IllegalArgumentException("base"); } return nameFromS...
@Test public void testNameFromComplexTypeExtension() throws Exception { String extension = defaultPlugin.nameFromComplexTypeExtension(complexType, name); Assert.assertEquals("complexType extends name", extension); } @Test(expected = IllegalArgumentException.class) public void testValidateComplexType() throws Exception ...
Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameFromSchemaAttributeName(final QName name) { if (name == null) { throw new IllegalArgumentException("name"); } return name.getLocalPart(); } @Override final String nameFromComplexTypeExtension(final QName complexType, final QName base); @...
@Test public void testNameFromSchemaAttributeName() throws Exception { Assert.assertEquals("name", defaultPlugin.nameFromSchemaAttributeName(name)); } @Test(expected = IllegalArgumentException.class) public void testValidNameFromSchemaAttributeName() throws Exception { defaultPlugin.nameFromSchemaAttributeName(null); }
Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameFromSchemaElementName(final QName name) { if (name == null) { throw new IllegalArgumentException("name"); } return name.getLocalPart(); } @Override final String nameFromComplexTypeExtension(final QName complexType, final QName base); @Ov...
@Test public void testNameFromSchemaElementName() throws Exception { Assert.assertEquals("name", defaultPlugin.nameFromSchemaElementName(name)); } @Test(expected = IllegalArgumentException.class) public void testValidNameFromSchemaElementName() throws Exception { defaultPlugin.nameFromSchemaElementName(null); }
Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameFromSchemaTypeName(final QName name) { if (name == null) { throw new IllegalArgumentException("name"); } return name.getLocalPart(); } @Override final String nameFromComplexTypeExtension(final QName complexType, final QName base); @Overr...
@Test public void testNameFromSchemaTypeName() throws Exception { Assert.assertEquals("name", defaultPlugin.nameFromSchemaTypeName(name)); } @Test(expected = IllegalArgumentException.class) public void testValidNameFromSchemaTypeName() throws Exception { defaultPlugin.nameFromSchemaTypeName(null); }
Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public final String nameFromSimpleTypeRestriction(final QName simpleType, final QName base) { if (simpleType == null) { throw new IllegalArgumentException("simpleType"); } if (base == null) { throw new IllegalArgumentException("base"); } return nameFromSch...
@Test public void testNameFromSimpleTypeRestriction() throws Exception { String restriction = defaultPlugin.nameFromSimpleTypeRestriction(complexType, name); Assert.assertEquals("complexType restricts name", restriction); } @Test(expected = IllegalArgumentException.class) public void testValidNameFromSimpleTypeRestrict...
Xsd2UmlConvert { public static final Model extract(final String name, final XmlSchema schema, final Xsd2UmlHostedPlugin plugin) { return extractModel(name, 0, schema, plugin); } Xsd2UmlConvert(); static final Model extract(final String name, final XmlSchema schema, final Xsd2UmlHostedPlugin plugin); }
@Test public void test() { final QName nameQName = new QName("NAMESPACE_URI", "name", "PREFIX"); XmlSchemaSimpleType xmlSchemaSimpleType = Mockito.mock(XmlSchemaSimpleType.class); Mockito.when(xmlSchemaSimpleType.getQName()).thenReturn(nameQName); XmlSchemaElement xmlSchemaElement = Mockito.mock(XmlSchemaElement.class)...
Xsd2UmlTweakerVisitor implements Visitor { @Override public void visit(final AssociationEnd associationEnd) { throw new UnsupportedOperationException(); } Xsd2UmlTweakerVisitor(final ModelIndex model); @Override void beginPackage(final UmlPackage pkg); @Override void endPackage(final UmlPackage pkg); final List<Namespa...
@Test(expected = UnsupportedOperationException.class) public void testVisitAssociationEnd() throws Exception { visitor.visit(Mockito.mock(AssociationEnd.class)); } @Test(expected = UnsupportedOperationException.class) public void testVisitAttribute() throws Exception { visitor.visit(Mockito.mock(Attribute.class)); } @T...
ZipFileValidator implements Validator<File> { @Override public boolean isValid(File zipFile, AbstractMessageReport report, ReportStats reportStats, Source source, Map<String, Object> parameters) { boolean isValid = false; LOG.info("Validating zipFile: {}", zipFile.getAbsolutePath()); ZipFile zf = null; try { zf = new Z...
@Test public void zipFileHasPath() throws FileNotFoundException { AbstractMessageReport report = new DummyMessageReport(); ReportStats reportStats = new SimpleReportStats(); Source source = new JobSource(null); file = IngestionTest.getFile("zip/ZipWithPath.zip"); boolean isValid = zipFileValidator.isValid(file, report,...
Xsd2UmlTweakerVisitor implements Visitor { private static final ClassType transform(final ClassType classType, final ModelIndex model) { if (classType == null) { throw new IllegalArgumentException(); } final List<AssociationEnd> ends = model.getAssociationEnds(classType.getId()); final List<AssociationEnd> singletonEnd...
@Test public void testTransform() throws Exception { Method method = visitor.getClass().getDeclaredMethod("transform", ClassType.class, ModelIndex.class); method.setAccessible(true); ClassType classType = Mockito.mock(ClassType.class); ModelIndex modelIndex = Mockito.mock(ModelIndex.class); AssociationEnd lhs = Mockito...
Xsd2UmlLookup { public Identifier from(final T key) { if (key == null) { throw new IllegalArgumentException("name"); } if (data.containsKey(key)) { return data.get(key); } else { final Identifier reference = Identifier.random(); data.put(key, reference); return reference; } } Identifier from(final T key); }
@Test public void testFrom() throws Exception { ClassType classType = Mockito.mock(ClassType.class); Identifier id = testObject.from(classType); Assert.assertNotNull(id); Identifier dupId = testObject.from(classType); Assert.assertEquals(id, dupId); } @Test(expected = IllegalArgumentException.class) public void testFor...
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host) { return Collections.emptyList(); } Xsd2UmlPluginForEdFi(); @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); @Over...
@Test public void testDeclareTagDefinitions() throws Exception { Assert.assertEquals(Collections.emptyList(), pluginForEdFi.declareTagDefinitions(host)); }
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { if (attribute == null) { throw new IllegalArgumentException("attribute"); } final String attributeNam...
@Test public void testGetAssociationEndTypeName() throws Exception { Mockito.when(attribute.getName()).thenReturn("academicWeekReference"); Assert.assertEquals("AcademicWeek", pluginForEdFi.getAssociationEndTypeName(classType, attribute, host)); Mockito.when(attribute.getName()).thenReturn("accountReference"); Assert.a...
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { if (attribute == null) { throw new IllegalArgumentException("attribute"); } final String attributeName = attr...
@Test public void testIsAssociationEnd() throws Exception { Mockito.when(attribute.getName()).thenReturn("Reference"); Assert.assertTrue(pluginForEdFi.isAssociationEnd(classType, attribute, host)); Mockito.when(attribute.getName()).thenReturn("Ref"); Assert.assertFalse(pluginForEdFi.isAssociationEnd(classType, attribut...
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameAssociation(final AssociationEnd lhs, final AssociationEnd rhs, final Xsd2UmlHostedPlugin host) { return host.nameAssociation(lhs, rhs, host); } Xsd2UmlPluginForEdFi(); @Override List<TagDefinition> declareTag...
@Test public void testNameAssociation() throws Exception { AssociationEnd associationEnd = Mockito.mock(AssociationEnd.class); Mockito.when( plugin.nameAssociation(Mockito.any(AssociationEnd.class), Mockito.any(AssociationEnd.class), Mockito.any(Xsd2UmlHostedPlugin.class))).thenReturn("test"); Assert.assertEquals("test...
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameFromSchemaAttributeName(final QName name) { if (CAMEL_CASE_SCHEMA_NAMES) { return Xsd2UmlHelper.camelCase(name.getLocalPart()); } else { return super.nameFromSchemaAttributeName(name); } } Xsd2UmlPluginForEdFi...
@Test public void testNameFromSchemaAttributeName() throws Exception { QName qName = new QName(SliMongoConstants.NAMESPACE_SLI, "test"); Assert.assertEquals("test", pluginForEdFi.nameFromSchemaAttributeName(qName)); }
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public String nameFromSchemaElementName(final QName name) { if (CAMEL_CASE_SCHEMA_NAMES) { return Xsd2UmlHelper.camelCase(name.getLocalPart()); } else { return super.nameFromSchemaElementName(name); } } Xsd2UmlPluginForEdFi(); ...
@Test public void testNameFromSchemaElementName() throws Exception { QName qName = new QName(SliMongoConstants.NAMESPACE_SLI, "test"); Assert.assertEquals("test", pluginForEdFi.nameFromSchemaElementName(qName)); }
Xsd2UmlPluginForEdFi extends Xsd2UmlPluginDefault implements Xsd2UmlHostedPlugin { @Override public List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host) { throw new UnsupportedOperationException(); } Xsd2UmlPluginForEdFi(); @Override List<TagDefinition> declareTagDefinitions(f...
@Test(expected = UnsupportedOperationException.class) public void testTagsFromAppInfo() throws Exception { pluginForEdFi.tagsFromAppInfo(null, host); }
Xsd2UmlTweaker { public static Model tweak(final Model model, final Xsd2UmlHostedPlugin plugin) { final ModelIndex indexedModel = new DefaultModelIndex(model); final Xsd2UmlTweakerVisitor tweaker = new Xsd2UmlTweakerVisitor(indexedModel); model.accept(tweaker); return new Model(Identifier.random(), model.getName(), mod...
@Test public void testTweak() throws Exception { Model newModel = Xsd2UmlTweaker.tweak(model, plugin); Assert.assertNotNull(newModel); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public Collection<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host) { return Collections.emptyList(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collecti...
@Test public void testDeclareTagDefinitions() throws Exception { Collection<TagDefinition> definitions = adapter.declareTagDefinitions(host); Assert.assertEquals(definitions, Collections.emptyList()); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public Identifier ensureTagDefinitionId(final String name) { final TagDefinition tagDefinition = mapper.getTagDefinition(new QName(name)); if (null != tagDefinition) { return tagDefinition.getId(); } throw new IllegalArgumentExceptio...
@Test public void testEnsureTagDefinitionId() throws Exception { Mockito.when(tagDefinition.getId()).thenAnswer(new Answer<Identifier>() { @Override public Identifier answer(InvocationOnMock invocation) throws Throwable { return Identifier.random(); } }); Mockito.when(mapper.getTagDefinition(Matchers.any(QName.class)))...
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { throw new UnsupportedOperationException(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override X...
@Test(expected = UnsupportedOperationException.class) public void testGetAssociationEndTypeName() throws Exception { adapter.getAssociationEndTypeName(classType, attribute, host); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public TagDefinition getTagDefinition(final Identifier id) { return mapper.getTagDefinition(id); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collection<TagDefinition> decl...
@Test public void testGetTagDefinition() throws Exception { Mockito.when(mapper.getTagDefinition(Matchers.any(Identifier.class))).thenReturn(tagDefinition); Assert.assertEquals(tagDefinition, adapter.getTagDefinition(identifier)); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public Type getType(final Identifier typeId) { return mapper.getType(typeId); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collection<TagDefinition> declareTagDefinitions(f...
@Test public void testGetType() throws Exception { Mockito.when(mapper.getType(Matchers.any(Identifier.class))).thenReturn(classType); Type type = adapter.getType(identifier); Assert.assertEquals(classType, type); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { return false; } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Over...
@Test public void testIsAssociationEnd() throws Exception { Assert.assertFalse(adapter.isAssociationEnd(classType, attribute, host)); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameAssociation(final AssociationEnd lhs, final AssociationEnd rhs, final Xsd2UmlHostedPlugin host) { return lhs.getName() + "<=>" + rhs.getName(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlH...
@Test public void testNameAssociation() throws Exception { Mockito.when(lhs.getName()).thenReturn("lhs"); Mockito.when(rhs.getName()).thenReturn("rhs"); String assocEnd = adapter.nameAssociation(lhs, rhs, host.getPlugin()); Assert.assertEquals("lhs<=>rhs", assocEnd); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameFromComplexTypeExtension(final QName complexType, final QName base) { return nameFromSchemaTypeName(complexType).concat(" extends ").concat(nameFromSchemaTypeName(base)); } Xsd2UmlPluginHostAdapter(final ModelIndex ...
@Test public void testNameFromComplexTypeExtension() throws Exception { Assert.assertEquals("test extends test", adapter.nameFromComplexTypeExtension(qName, qName)); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameFromSchemaElementName(final QName name) { throw new UnsupportedOperationException(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collection<TagDefinition...
@Test(expected = UnsupportedOperationException.class) public void testNameFromSchemaElementName() throws Exception { adapter.nameFromSchemaElementName(qName); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameFromSchemaAttributeName(final QName name) { throw new UnsupportedOperationException(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collection<TagDefiniti...
@Test(expected = UnsupportedOperationException.class) public void testNameFromSchemaAttributeName() throws Exception { adapter.nameFromSchemaAttributeName(qName); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameFromSimpleTypeRestriction(final QName simpleType, final QName base) { return nameFromSchemaTypeName(simpleType).concat(" restricts ").concat(nameFromSchemaTypeName(base)); } Xsd2UmlPluginHostAdapter(final ModelIndex...
@Test public void testNameFromSimpleTypeRestriction() throws Exception { Assert.assertEquals("test restricts test", adapter.nameFromSimpleTypeRestriction(qName, qName)); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public String nameFromSchemaTypeName(final QName name) { return name.getLocalPart(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); @Override Collection<TagDefinition> declareTagDefini...
@Test public void testNameFromSchemaTypeName() throws Exception { Assert.assertEquals("test", adapter.nameFromSchemaTypeName(qName)); }
Xsd2UmlPluginHostAdapter implements Xsd2UmlPluginHost, Xsd2UmlHostedPlugin { @Override public List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host) { return Collections.emptyList(); } Xsd2UmlPluginHostAdapter(final ModelIndex mapper); @Override Xsd2UmlHostedPlugin getPlugin(); ...
@Test public void testTagsFromAppInfo() throws Exception { Assert.assertEquals(Collections.emptyList(), adapter.tagsFromAppInfo(new XmlSchemaAppInfo(), host)); }
Xsd2UmlLinker { public static Model link(final Model model, final Xsd2UmlHostedPlugin plugin) { final ModelIndex indexedModel = new DefaultModelIndex(model); final Map<String, Identifier> nameToClassTypeId = makeNameToClassTypeId(indexedModel.getClassTypes().values()); final Map<Type, Map<String, AssociationEnd>> navig...
@Test public void testLink() throws Exception { Assert.assertNotNull(Xsd2UmlLinker.link(model, plugin)); } @Test(expected = IllegalStateException.class) public void testInvalidAssociationEnd() throws Exception { when(plugin.isAssociationEnd(Mockito.any(ClassType.class), Mockito.any(Attribute.class), Mockito.any(Xsd2Uml...
ControlFileValidator implements Validator<ControlFile> { @Override public boolean isValid(ControlFile controlFile, AbstractMessageReport report, ReportStats reportStats, Source source, Map<String, Object> parameters) { Set<String> zipFileEntries = null; Map<String, Object> localParameters = (parameters == null) ? new H...
@Test public void noFileEntriesTest() { AbstractMessageReport report = new DummyMessageReport(); ReportStats reportStats = new SimpleReportStats(); Source source = new JobSource(null); boolean isValid = controlFileValidator.isValid(controlFile, report, reportStats, source, null); Assert.assertTrue(reportStats.hasErrors...
PsmConfigWriter { public static final void writeConfig(final PsmConfig<Type> documentation, final Model model, final OutputStream outstream) { final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.w...
@Test public void testWriteConfig() throws FileNotFoundException { final File out = new File("test_psm.xml"); @SuppressWarnings("unchecked") final PsmConfig<Type> documentation = mock(PsmConfig.class); final List<PsmDocument<Type>> configList = new ArrayList<PsmDocument<Type>>(); final PsmResource resource = new PsmRes...
PsmConfigReader { public static final PsmConfig<Type> readConfig(final String fileName, final ModelIndex mapper) throws FileNotFoundException { final InputStream istream = new BufferedInputStream(new FileInputStream(fileName)); try { return readConfig(istream, mapper); } finally { closeQuiet(istream); } } static final...
@Test public void testReadConfig() throws FileNotFoundException { final File docFile = new File(docUri); final PsmConfig config = PsmConfigReader.readConfig(docFile, mockIndex); asserts(config); } @Test public void testReadConfigString() throws FileNotFoundException { final File docFile = new File(docUri); final String...
PsmConfigReader { private static final <T> T assertNotNull(final T obj) { if (obj != null) { return obj; } else { throw new AssertionError(); } } static final PsmConfig<Type> readConfig(final String fileName, final ModelIndex mapper); static final PsmConfig<Type> readConfig(final File file, final ModelIndex mapper); s...
@Test public void testInitialization() { final PsmConfigReader reader = new PsmConfigReader(); assertNotNull(reader); }
PsmCreator { public static void main(final String[] args) { String inputFilename = (args.length == 2) ? args[0] : DEFAULT_INPUT_XMI_FILENAME; String outputFilename = (args.length == 2) ? args[1] : DEFAULT_OUTPUT_XML_FILENAME; try { final Model model = XmiReader.readModel(inputFilename); final PsmConfig<Type> psm = conv...
@Test public void testMain() { String inputFilename = "src/test/resources/psm_sli.xmi"; String outputFilename = "PsmCreatorOutput.xml"; PsmCreator.main(new String[]{inputFilename, outputFilename}); File file = new File(outputFilename); assertTrue(file.exists()); file.delete(); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeAttribute(final String localName, final String value) throws XMLStreamException { if (localName == null) { throw new IllegalArgumentException("localName"); } if (value == null) { throw new IllegalArgumentException("value"); } next.writeAtt...
@Test public void testWriteAttribute() throws IOException, XMLStreamException { out.writeStartElement("testElement1"); out.writeAttribute("attr1", "val1"); out.writeEndElement(); assertOutput("<testElement1 attr1=\"val1\"></testElement1>"); out.writeStartElement("testElement2"); out.writeAttribute(DEFAULT_NAMESPACE, "a...
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeCData(final String data) throws XMLStreamException { state = State.SEEN_DATA; next.writeCData(data); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getName...
@Test public void testWriteCDATA() throws IOException, XMLStreamException { out.writeCData("TestCData"); assertOutput("<![CDATA[TestCData]]>"); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeComment(final String data) throws XMLStreamException { next.writeComment(data); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Over...
@Test public void testWriteComment() throws IOException, XMLStreamException { out.writeComment("This is a comment"); assertOutput("<!--This is a comment-->"); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeCharacters(final String text) throws XMLStreamException { state = State.SEEN_DATA; next.writeCharacters(text); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceConte...
@Test public void testWriteCharacters() throws IOException, XMLStreamException { out.writeCharacters("This is string 1."); out.writeCharacters("This is string 2.".toCharArray(), 0, 7); assertOutput("This is string 1.This is"); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeDTD(final String dtd) throws XMLStreamException { next.writeDTD(dtd); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Override Strin...
@Test public void testWriteDTD() throws IOException, XMLStreamException { out.writeDTD("This is DTD"); assertOutput("This is DTD"); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void writeNamespace(final String prefix, final String namespaceURI) throws XMLStreamException { next.writeNamespace(prefix, namespaceURI); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Overr...
@Test public void testWriteNamespace() throws IOException, XMLStreamException { out.writeStartElement("element1"); out.writeDefaultNamespace(DEFAULT_NAMESPACE); out.writeEndElement(); assertOutput("<element1 xmlns=\"" + DEFAULT_NAMESPACE + "\"></element1>"); out.writeStartElement("element2"); out.writeNamespace(PREFIX,...
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public NamespaceContext getNamespaceContext() { return next.getNamespaceContext(); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Override String ge...
@Test public void testGetNamespaceContext() { NamespaceContext context = out.getNamespaceContext(); assertTrue(context.getNamespaceURI(NAMESPACE).equals(NAMESPACE)); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public String getPrefix(final String uri) throws XMLStreamException { return next.getPrefix(uri); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Ove...
@Test public void testGetPrefix() throws XMLStreamException { String prefix = out.getPrefix(DEFAULT_NAMESPACE); assertTrue(prefix.equals(DEFAULT_PREFIX)); prefix = out.getPrefix(NAMESPACE); assertTrue(prefix.equals(PREFIX)); }
IndentingXMLStreamWriter implements XMLStreamWriter { @Override public void close() throws XMLStreamException { next.close(); } IndentingXMLStreamWriter(final XMLStreamWriter next); @Override void close(); @Override void flush(); @Override NamespaceContext getNamespaceContext(); @Override String getPrefix(final String ...
@Test(expected = NullPointerException.class) public void testClose() throws XMLStreamException { out.close(); out.writeEmptyElement("test"); }
XmlTools { public static final String collapseWhitespace(final String value) { return collapseSpace(value.replace('\r', ' ').replace('\n', ' ').replace('\t', ' ').trim()); } static final String collapseWhitespace(final String value); }
@Test public void testCollapseWhitespace() { String str = XmlTools.collapseWhitespace(" this\ris\na\ttest string "); assertTrue(str.equals("this is a test string")); }
XMLStreamReaderTools { public static final void skipElement(final XMLStreamReader reader) throws XMLStreamException { final String localName = reader.getLocalName(); while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: { skipElement(reader); break; } case XML...
@Test public void testSkipElement() throws FileNotFoundException, XMLStreamException { File file = new File(getAbsPath("sample.xml")); InputStream stream = new BufferedInputStream(new FileInputStream(file)); XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(stream); while (!reader.isStartElem...
PsmCollection { public String getName() { return name; } PsmCollection(final String name); String getName(); }
@Test public void testGetName() { final PsmCollection coll = new PsmCollection("Test"); assertEquals("Test", coll.getName()); }
PsmResource { public String getName() { return name; } PsmResource(final String name); String getName(); @Override String toString(); }
@Test public void testGetName() { final PsmResource resource = new PsmResource("test"); assertEquals("test", resource.getName()); assertEquals("test", resource.toString()); } @Test public void testTrim() { final PsmResource resource = new PsmResource("test "); assertEquals("test", resource.getName()); }
PsmDocument { public TYPE getType() { return type; } PsmDocument(final TYPE type, final PsmResource graphResourceName, final PsmCollection singularResourceName); @Override String toString(); TYPE getType(); PsmResource getGraphAssociationEndName(); PsmCollection getSingularResourceName(); }
@Test public void testGetType() { assertEquals("test", doc.getType()); }
PsmDocument { public PsmResource getGraphAssociationEndName() { return graphResourceName; } PsmDocument(final TYPE type, final PsmResource graphResourceName, final PsmCollection singularResourceName); @Override String toString(); TYPE getType(); PsmResource getGraphAssociationEndName(); PsmCollection getSingularResourc...
@Test public void testGetGraphAssociationEndName() { assertEquals("test resource", doc.getGraphAssociationEndName().getName()); }
PsmDocument { public PsmCollection getSingularResourceName() { return singularResourceName; } PsmDocument(final TYPE type, final PsmResource graphResourceName, final PsmCollection singularResourceName); @Override String toString(); TYPE getType(); PsmResource getGraphAssociationEndName(); PsmCollection getSingularResou...
@Test public void testGetSingularResourceName() { assertEquals("test collection", doc.getSingularResourceName().getName()); }
PsmConfig { public List<PsmDocument<TYPE>> getDocuments() { return documents; } PsmConfig(final List<PsmDocument<TYPE>> documents); List<PsmDocument<TYPE>> getDocuments(); }
@Test public void testGetDocuments() { final List<PsmDocument<String>> documents = new ArrayList<PsmDocument<String>>(); final PsmConfig<String> config = new PsmConfig<String>(documents); assertEquals(config.getDocuments(), documents); }
DmDocument implements DmNode { @Override public String getStringValue() { throw new UnsupportedOperationException("getStringValue is not supported"); } DmDocument(final List<? extends DmNode> childAxis); @Override List<DmNode> getChildAxis(); @Override QName getName(); @Override String getStringValue(); }
@Test(expected = UnsupportedOperationException.class) public void testGetStringValue() { DmDocument dmDocument = new DmDocument(new ArrayList<DmNode>()); dmDocument.getStringValue(); }
DmElement implements DmNode { @Override public String getStringValue() { throw new UnsupportedOperationException("getStringValue() is not supported by DmElement"); } DmElement(final QName name); DmElement(final QName name, final List<? extends DmNode> childAxis); @Override List<DmNode> getChildAxis(); @Override QName ...
@Test(expected = UnsupportedOperationException.class) public void testGetStringValue() { new DmElement(new QName(""), new ArrayList<DmElement>()).getStringValue(); }
TaggedValue extends ModelElement { @Override public void accept(final Visitor visitor) { visitor.visit(this); } TaggedValue(final Identifier id, final List<TaggedValue> taggedValues, final String value, final Identifier tagDefinition); TaggedValue(final List<TaggedValue> taggedValues, final String value, f...
@Test public void testAccept() { taggedValue.accept(visitor); }
TaggedValue extends ModelElement { public Identifier getTagDefinition() { return tagDefinition; } TaggedValue(final Identifier id, final List<TaggedValue> taggedValues, final String value, final Identifier tagDefinition); TaggedValue(final List<TaggedValue> taggedValues, final String value, final Identifie...
@Test public void testGetTagDefinition() { assertEquals("TestTagDefn", taggedValue.getTagDefinition().toString()); }
TaggedValue extends ModelElement { public String getValue() { return value; } TaggedValue(final Identifier id, final List<TaggedValue> taggedValues, final String value, final Identifier tagDefinition); TaggedValue(final List<TaggedValue> taggedValues, final String value, final Identifier tagDefinition); T...
@Test public void testGetValue() { assertEquals("TestValue", taggedValue.getValue()); }
TaggedValue extends ModelElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("id: " + getId()).append(", "); sb.append("value: \"" + value + "\""); sb.append(", "); sb.append("tagDefinition: " + tagDefinition); if (!getTaggedValues().isEmpty()) { sb.app...
@Test public void testToString() { String string1 = taggedValue.toString(); String string2 = "{id: 1234, value: \"TestValue\", tagDefinition: TestTagDefn}"; assertEquals(string2, string1); }
AssociationEnd extends Feature { @Override public void accept(final Visitor visitor) { visitor.visit(this); } AssociationEnd(final Multiplicity multiplicity, final String name, final boolean isNavigable, final Identifier type, final String associatedAttributeName); AssociationEnd(final Multiplicity multipl...
@Test public void testAccept() { associationEnd.accept(visitor); }
AssociationEnd extends Feature { @Override public boolean isAttribute() { return false; } AssociationEnd(final Multiplicity multiplicity, final String name, final boolean isNavigable, final Identifier type, final String associatedAttributeName); AssociationEnd(final Multiplicity multiplicity, final String ...
@Test public void testIsAttribute() { assertEquals(associationEnd.isAttribute(), false); }
AssociationEnd extends Feature { @Override public boolean isAssociationEnd() { return true; } AssociationEnd(final Multiplicity multiplicity, final String name, final boolean isNavigable, final Identifier type, final String associatedAttributeName); AssociationEnd(final Multiplicity multiplicity, final Str...
@Test public void testIsAssociationEnd() { assertEquals(associationEnd.isAssociationEnd(), true); }
AssociationEnd extends Feature { public boolean isNavigable() { return isNavigable; } AssociationEnd(final Multiplicity multiplicity, final String name, final boolean isNavigable, final Identifier type, final String associatedAttributeName); AssociationEnd(final Multiplicity multiplicity, final String name...
@Test public void testIsNavigable() { assertEquals(associationEnd.isNavigable(), false); }
AssociationEnd extends Feature { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("id: " + getId()); sb.append(", "); sb.append("name: " + getName()); sb.append(", "); sb.append("type: " + getType()); sb.append(", "); sb.append("multiplicity: " + getMultiplici...
@Test public void testToString() { String string1 = associationEnd.toString(); String string2 = "{id: " + associationEnd.getId() + ", name: TestAssocEnd, type: " + identifier + ", multiplicity: " + TestUtils.ZERO_TO_ONE + "}"; assertEquals(string1, string2); }
EnumType extends NamespaceOwnedElement implements SimpleType { @Override public void accept(final Visitor visitor) { visitor.visit(this); } EnumType(final Identifier id, final String name, final List<EnumLiteral> literals, final List<TaggedValue> taggedValues); @Override void accept(final Visitor visitor); ...
@Test public void testAccept() { enumType.accept(visitor); }
EnumType extends NamespaceOwnedElement implements SimpleType { @Override public List<EnumLiteral> getLiterals() { return literals; } EnumType(final Identifier id, final String name, final List<EnumLiteral> literals, final List<TaggedValue> taggedValues); @Override void accept(final Visitor visitor); @Overri...
@Test public void testGetLiterals() { List<EnumLiteral> list = enumType.getLiterals(); assertNotNull(list); assertEquals(0, list.size()); }
EnumType extends NamespaceOwnedElement implements SimpleType { @Override public boolean isAbstract() { return false; } EnumType(final Identifier id, final String name, final List<EnumLiteral> literals, final List<TaggedValue> taggedValues); @Override void accept(final Visitor visitor); @Override List<EnumLi...
@Test public void testIsAbstract() { assertEquals(false, enumType.isAbstract()); }