src_fm_fc_ms_ff
stringlengths
43
86.8k
target
stringlengths
20
276k
Grammars extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("includes").append(" : ").append(includes); sb.append(", "); sb.append("doc").append(" : ").append(getDocumentation()); sb.append("}"); return sb.toString(); } Grammars(final List<...
@Test public void testToString() { assertTrue(!"".equals(grammars.toString())); }
Documentation { public String getTitle() { return title; } Documentation(final String title, final String language, final List<DmNode> contents); String getTitle(); String getLanguage(); List<DmNode> getContents(); @Override String toString(); }
@Test public void testGetTitle() { assertEquals(TITLE, documentation.getTitle()); }
Documentation { public String getLanguage() { return language; } Documentation(final String title, final String language, final List<DmNode> contents); String getTitle(); String getLanguage(); List<DmNode> getContents(); @Override String toString(); }
@Test public void testGetLanguage() { assertEquals(LANGUAGE, documentation.getLanguage()); }
Documentation { public List<DmNode> getContents() { return contents; } Documentation(final String title, final String language, final List<DmNode> contents); String getTitle(); String getLanguage(); List<DmNode> getContents(); @Override String toString(); }
@Test public void testGetContents() { assertEquals(CONTENTS, documentation.getContents()); }
Documentation { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("language").append(" : ").append(language); sb.append(", "); sb.append("title").append(" : ").append(title); sb.append(", "); sb.append("contents").append(" : ").append(contents); sb.append("}");...
@Test public void testToString() { assertTrue(!"".equals(documentation.toString())); }
Option extends WadlElement { public String getValue() { return value; } Option(final String value, final List<Documentation> doc); String getValue(); }
@Test public void testGetValue() { assertEquals(VALUE, option.getValue()); }
ResourceType extends WadlElement { public String getId() { return id; } ResourceType(final String id, final List<Documentation> doc, final List<Param> params, final Method method, final Resource resource); String getId(); List<Param> getParams(); Method getMethod(); Resource getResource(); }
@Test public void testGetId() { assertEquals(ID, resourceType.getId()); }
FileEntryLatch { @Handler public boolean lastFileProcessed(Exchange exchange) throws Exception { FileEntryWorkNote workNote = exchange.getIn().getBody(FileEntryWorkNote.class); String batchJobId = workNote.getBatchJobId(); TenantContext.setJobId(batchJobId); if (batchJobDAO.updateFileEntryLatch(workNote.getBatchJobId()...
@Test public void testReceive() throws Exception { Exchange exchange = new DefaultExchange(new DefaultCamelContext()); IngestionFileEntry entry = new IngestionFileEntry("/", FileFormat.EDFI_XML, FileType.XML_STUDENT_PROGRAM, "fileName", "111"); FileEntryWorkNote workNote = new FileEntryWorkNote("batchJobId", entry, fal...
ResourceType extends WadlElement { public Method getMethod() { return method; } ResourceType(final String id, final List<Documentation> doc, final List<Param> params, final Method method, final Resource resource); String getId(); List<Param> getParams(); Method getMethod(); Resource getResource(); }
@Test public void testGetMethod() { assertEquals(METHOD, resourceType.getMethod()); }
ResourceType extends WadlElement { public List<Param> getParams() { return params; } ResourceType(final String id, final List<Documentation> doc, final List<Param> params, final Method method, final Resource resource); String getId(); List<Param> getParams(); Method getMethod(); Resource getResource(); }
@Test public void testGetParams() { assertEquals(PARAMS, resourceType.getParams()); }
ResourceType extends WadlElement { public Resource getResource() { return resource; } ResourceType(final String id, final List<Documentation> doc, final List<Param> params, final Method method, final Resource resource); String getId(); List<Param> getParams(); Method getMethod(); Resource getResource(); }
@Test public void testGetResource() { assertEquals(RESOURCE, resourceType.getResource()); }
RestHelper { public static final List<Param> computeRequestTemplateParams(final Resource resource, final Stack<Resource> ancestors) { final List<Param> params = new LinkedList<Param>(); final List<Resource> rightToLeftResources = new LinkedList<Resource>(); rightToLeftResources.addAll(reverse(ancestors)); rightToLeftRe...
@Test public void testComputeRequestTemplateParamsEmptyAncestors() { Stack<Resource> resources = new Stack<Resource>(); Param r1p1 = mock(Param.class); when(r1p1.getStyle()).thenReturn(ParamStyle.TEMPLATE); when(r1p1.getId()).thenReturn(R1P1_ID); List<Param> r1Params = new ArrayList<Param>(1); r1Params.add(r1p1); Resou...
RestHelper { public static final <T> List<T> reverse(final List<T> strings) { final LinkedList<T> result = new LinkedList<T>(); for (final T s : strings) { result.addFirst(s); } return Collections.unmodifiableList(result); } static final List<Param> computeRequestTemplateParams(final Resource resource, fin...
@Test public void testReverse() { List<Integer> numbers = new ArrayList<Integer>(3); numbers.add(1); numbers.add(2); numbers.add(3); List<Integer> reversedNumbers = RestHelper.reverse(numbers); Integer crntNumber = 3; assertEquals(3, reversedNumbers.size()); for (Integer i : reversedNumbers) { assertEquals(crntNumber--...
Link extends WadlElement { public String getResourceType() { return resourceType; } Link(final String resourceType, final String rel, final String rev, final List<Documentation> doc); String getResourceType(); String getRel(); String getRev(); }
@Test public void testGetResourceType() { assertEquals(RESOURCE_TYPE, link.getResourceType()); }
Link extends WadlElement { public String getRel() { return rel; } Link(final String resourceType, final String rel, final String rev, final List<Documentation> doc); String getResourceType(); String getRel(); String getRev(); }
@Test public void testGetRelType() { assertEquals(REL, link.getRel()); }
BatchJobManager { public boolean isEligibleForDeltaPurge(Exchange exchange) { WorkNote workNote = exchange.getIn().getBody(WorkNote.class); String jobId = workNote.getBatchJobId(); String deltaMode = batchJobDAO.getDuplicateDetectionMode(jobId); if(deltaMode != null && isDeltaPurgeMode(deltaMode)) { return true; } retu...
@Test public void testPurgeDisableDeltas() throws Exception { Mockito.when(batchJobDAO.getDuplicateDetectionMode(jobId)).thenReturn(RecordHash.RECORD_HASH_MODE_DISABLE); Exchange exchange = new DefaultExchange(new DefaultCamelContext()); WorkNote workNote = new WorkNote(jobId, false); exchange.getIn().setBody(workNote)...
Link extends WadlElement { public String getRev() { return rev; } Link(final String resourceType, final String rel, final String rev, final List<Documentation> doc); String getResourceType(); String getRel(); String getRev(); }
@Test public void testGetRev() { assertEquals(REV, link.getRev()); }
Resource extends WadlElement { public String getId() { return id; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, final String reso...
@Test public void testGetId() { assertEquals(ID, resource.getId()); }
Resource extends WadlElement { public List<Method> getMethods() { return methods; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, f...
@Test public void testGetMethods() { assertEquals(METHODS, resource.getMethods()); }
Resource extends WadlElement { public List<Param> getParams() { return params; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, fina...
@Test public void testGetParams() { assertEquals(PARAMS, resource.getParams()); }
Resource extends WadlElement { public String getPath() { return path; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, final String ...
@Test public void testGetPath() { assertEquals(PATH, resource.getPath()); }
Resource extends WadlElement { public String getQueryType() { return queryType; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, fin...
@Test public void testGetQueryType() { assertEquals(QUERY_TYPE, resource.getQueryType()); }
Resource extends WadlElement { public List<Resource> getResources() { return resources; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resour...
@Test public void testGetResources() { assertEquals(RESOURCES, resource.getResources()); }
Resource extends WadlElement { public List<String> getType() { return type; } Resource(final String id, final List<String> type, final String queryType, final String path, final List<Documentation> doc, final List<Param> params, final List<Method> methods, final List<Resource> resources, final S...
@Test public void testGetType() { assertEquals(TYPE, resource.getType()); }
Resource extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("id").append(" : ").append(id); sb.append(", "); sb.append("type").append(" : ").append(type); sb.append(", "); sb.append("queryType").append(" : ").append(queryType); sb.append(",...
@Test public void testToString() { assertTrue(!"".equals(resource.toString())); }
Param extends WadlElement { public String getName() { return name; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> do...
@Test public void testGetName() { assertEquals(NAME, param.getName()); }
Param extends WadlElement { public ParamStyle getStyle() { return style; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentati...
@Test public void testGetStyle() { assertEquals(STYLE, param.getStyle()); }
Param extends WadlElement { public String getId() { return id; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> doc, f...
@Test public void testGetId() { assertEquals(ID, param.getId()); }
Param extends WadlElement { public QName getType() { return type; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> doc...
@Test public void testGetType() { assertEquals(TYPE, param.getType()); }
Param extends WadlElement { public String getDefault() { return defaultValue; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Docume...
@Test public void testGetDefault() { assertEquals(DEFAULT_VALUE, param.getDefault()); }
Param extends WadlElement { public boolean getRequired() { return required; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Document...
@Test public void testGetRequired() { assertEquals(REQUIRED, param.getRequired()); }
Param extends WadlElement { public boolean getRepeating() { return repeating; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Docume...
@Test public void testGetRepeating() { assertEquals(REPEATING, param.getRepeating()); }
Param extends WadlElement { public String getFixed() { return fixed; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> ...
@Test public void testGetFixed() { assertEquals(FIXED, param.getFixed()); }
Param extends WadlElement { public String getPath() { return path; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> do...
@Test public void testGetPath() { assertEquals(PATH, param.getPath()); }
Param extends WadlElement { public List<Option> getOptions() { return options; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Docum...
@Test public void testGetOptions() { assertEquals(OPTIONS, param.getOptions()); }
Param extends WadlElement { public Link getLink() { return link; } Param(final String name, final ParamStyle style, final String id, final QName type, final String defaultValue, final boolean required, final boolean repeating, final String fixed, final String path, final List<Documentation> doc,...
@Test public void testGetLink() { assertEquals(LINK, param.getLink()); }
Param extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("name").append(" : ").append(name); sb.append(", "); sb.append("style").append(" : ").append(style); sb.append(", "); sb.append("id").append(" : ").append(id); sb.append(", "); sb.app...
@Test public void testToString() { assertTrue(!"".equals(param.toString())); }
Method extends WadlElement { public String getId() { return id; } Method(final String id, final String verb, final List<Documentation> doc, final Request request, final List<Response> responses); String getId(); String getVerb(); Request getRequest(); List<Response> getResponses(); @Override String toString...
@Test public void testGetId() { assertEquals(ID, method.getId()); }
Method extends WadlElement { public Request getRequest() { return request; } Method(final String id, final String verb, final List<Documentation> doc, final Request request, final List<Response> responses); String getId(); String getVerb(); Request getRequest(); List<Response> getResponses(); @Override Stri...
@Test public void testGetRequest() { assertEquals(REQUEST, method.getRequest()); }
Method extends WadlElement { public List<Response> getResponses() { return responses; } Method(final String id, final String verb, final List<Documentation> doc, final Request request, final List<Response> responses); String getId(); String getVerb(); Request getRequest(); List<Response> getResponses(); @Ov...
@Test public void testGetResponses() { assertEquals(RESPONSES, method.getResponses()); }
Method extends WadlElement { public String getVerb() { return verb; } Method(final String id, final String verb, final List<Documentation> doc, final Request request, final List<Response> responses); String getId(); String getVerb(); Request getRequest(); List<Response> getResponses(); @Override String toSt...
@Test public void testGetVerb() { assertEquals(VERB, method.getVerb()); }
Method extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("id").append(" : ").append(id); sb.append(", "); sb.append("name").append(" : ").append(verb); sb.append(", "); sb.append("request").append(" : ").append(request); sb.append(", "); s...
@Test public void testToString() { assertTrue(!"".equals(method.toString())); }
Resources extends WadlElement { public String getBase() { return base; } Resources(final String base, final List<Documentation> doc, final List<Resource> resources); String getBase(); List<Resource> getResources(); @Override String toString(); }
@Test public void testGetBase() { assertEquals(BASE, resources.getBase()); }
Resources extends WadlElement { public List<Resource> getResources() { return resources; } Resources(final String base, final List<Documentation> doc, final List<Resource> resources); String getBase(); List<Resource> getResources(); @Override String toString(); }
@Test public void testGetResources() { assertEquals(RESOURCE_LIST, resources.getResources()); }
Resources extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("base").append(" : ").append(base); sb.append(", "); sb.append("resources").append(" : ").append(resources); sb.append(", "); sb.append("doc").append(" : ").append(getDocumentatio...
@Test public void testToString() { assertTrue(!"".equals(resources.toString())); }
Include extends WadlElement { public String getHref() { return href; } Include(final String href, final List<Documentation> doc); String getHref(); }
@Test public void testGetHref() { assertEquals(HREF, include.getHref()); }
ValidationController { public void doValidation(File path) { ReportStats reportStats = new SimpleReportStats(); if (path.isFile()) { if (path.getName().endsWith(".ctl")) { processControlFile(path.getParentFile().getAbsoluteFile(), path.getName(), reportStats); } else if (path.getName().endsWith(".zip")) { processZip(pa...
@Test public void testDirectory() throws NoSuchFieldException, IllegalAccessException, IOException { File ctlFile = Mockito.mock(File.class); Mockito.when(ctlFile.getName()).thenReturn("Test"); Mockito.when(ctlFile.isFile()).thenReturn(false); AbstractMessageReport messageReport = Mockito.mock(AbstractMessageReport.cla...
Application extends WadlElement { public Grammars getGrammars() { return grammars; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representation> representations, fina...
@Test public void testGetGrammars() { assertEquals(GRAMMARS, application.getGrammars()); }
Application extends WadlElement { public Resources getResources() { return resources; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representation> representations, f...
@Test public void testGetResources() { assertEquals(RESOURCES, application.getResources()); }
Application extends WadlElement { public List<ResourceType> getResourceTypes() { return resourceTypes; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representation> r...
@Test public void testGetResourceTypes() { assertEquals(RESOURCE_TYPES, application.getResourceTypes()); }
Application extends WadlElement { public List<Method> getMethods() { return methods; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representation> representations, fi...
@Test public void testGetMethods() { assertEquals(METHODS, application.getMethods()); }
Application extends WadlElement { public List<Representation> getRepresentations() { return representations; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representat...
@Test public void testGetRepresentations() { assertEquals(REPRESENTATIONS, application.getRepresentations()); }
Application extends WadlElement { public List<Representation> getFaults() { return faults; } Application(final List<Documentation> doc, final Grammars grammars, final Resources resources, final List<ResourceType> resourceTypes, final List<Method> methods, final List<Representation> representatio...
@Test public void testGetFaults() { assertEquals(REPRESENTATIONS, application.getFaults()); }
Application extends WadlElement { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("{"); sb.append("grammars").append(" : ").append(grammars); sb.append(", "); sb.append("resources").append(" : ").append(resources); sb.append(", "); sb.append("resourceTypes").append(" : ").ap...
@Test public void testToString() { assertTrue(!"".equals(application.toString())); }
SelectorDoc { public static void main(String[] args) { try { new SelectorDoc(args[0], args[1]).generateSelectorDocumentation(); } catch (IOException e) { LOG.warn(e.getMessage()); } } SelectorDoc(String inputXmiFilename, String outputXmlFilename); static void main(String[] args); static final String ATTRIBUTE; static f...
@Test public void testMain() throws IOException { SelectorDoc.main(ARGS); File file = new File(OUTPUT_FILENAME); assertTrue(file.exists()); file.delete(); }
SelectorDoc { protected boolean writeSelectorDocumentationToFile(String documentationString, Writer output) { if (documentationString == null) { return false; } try { output.write(documentationString); output.flush(); output.close(); } catch (IOException e) { LOG.warn(e.getMessage()); return false; } return true; } Sel...
@Test public void testWriteBuffer() throws IOException { Writer writer = mock(Writer.class); assertTrue(this.selectorDoc.writeSelectorDocumentationToFile("foo", writer)); }
SelectorDoc { protected void appendClassTypeAttributes(StringBuffer stringBuffer, ClassType classType) { for (Attribute attribute : classType.getAttributes()) { stringBuffer.append(String.format(FEATURE, ATTRIBUTE, attribute.getName())); } } SelectorDoc(String inputXmiFilename, String outputXmlFilename); static void ma...
@Test public void testAppendClassTypeAttributes() { this.selectorDoc.appendClassTypeAttributes(stringBuffer, CLASS_TYPE); String part1 = String.format(SelectorDoc.FEATURE, SelectorDoc.ATTRIBUTE, ATTRIBUTE1_NAME); String part2 = String.format(SelectorDoc.FEATURE, SelectorDoc.ATTRIBUTE, ATTRIBUTE2_NAME); String expectedT...
SelectorDoc { protected void appendClassTypeAssociations(StringBuffer stringBuffer, ClassType classType, ModelIndex modelIndex) { for (AssociationEnd associationEnd : modelIndex.getAssociationEnds(classType.getId())) { stringBuffer.append(String.format(FEATURE, ASSOCIATION, associationEnd.getName())); } } SelectorDoc(S...
@Test public void testAppendClassTypeAssociations() { this.selectorDoc.appendClassTypeAssociations(stringBuffer, CLASS_TYPE, MODEL_INDEX); String part1 = String.format(SelectorDoc.FEATURE, SelectorDoc.ASSOCIATION, ASSOCIATION_END1_NAME); String part2 = String.format(SelectorDoc.FEATURE, SelectorDoc.ASSOCIATION, ASSOCIA...
SelectorDoc { protected String getSelectorDocumentation(ModelIndex modelIndex) { StringBuffer stringBuffer = new StringBuffer(); Map<String, ClassType> classTypes = modelIndex.getClassTypes(); for (Entry<String, ClassType> classTypeEntry : classTypes.entrySet()) { ClassType classType = classTypeEntry.getValue(); string...
@Test public void testGetSelectorDocumentation() { String receivedResult = this.selectorDoc.getSelectorDocumentation(MODEL_INDEX); String part1 = String.format(SelectorDoc.SIMPLE_SECT_START, CLASS_TYPE_NAME) + SelectorDoc.FEATURES_START; String part2 = String.format(SelectorDoc.FEATURE, SelectorDoc.ATTRIBUTE, ATTRIBUTE...
SelectorDoc { protected ModelIndex getModelIndex(Model model) { if (model != null) { return new DefaultModelIndex(model); } else { return null; } } SelectorDoc(String inputXmiFilename, String outputXmlFilename); static void main(String[] args); static final String ATTRIBUTE; static final String ASSOCIATION; }
@Test public void testGetModelIndex() throws FileNotFoundException { Model model = this.selectorDoc.readModel(); ModelIndex modelIndex = this.selectorDoc.getModelIndex(model); assertNotNull("Expected non-null modelIndex", modelIndex); }
XsdGen { public static void main(final String[] args) { final OptionParser parser = new OptionParser(); final OptionSpec<?> helpSpec = parser.acceptsAll(ARGUMENT_HELP, "Show help"); final OptionSpec<File> documentFileSpec = optionSpec(parser, ARGUMENT_DOCUMENT_FILE, "Domain file", File.class); final OptionSpec<File> xm...
@Test public void testXsdGen() throws IOException { final File outFile = new File("test_sli.xsd"); if (!outFile.exists()) { if (!outFile.createNewFile()) { Assert.fail("failed to create temp file " + outFile.getName()); } } final String folder = getFolder(outFile); final String file = outFile.getName(); final String[] ...
Uml2XsdSyntheticHasName implements HasName { @Override public String getName() { final Occurs upperBound = end.getMultiplicity().getRange().getUpper(); final boolean plural = Occurs.UNBOUNDED.equals(upperBound); return adjustPlurality(Uml2XsdTools.camelCase(lookup.getType(end.getType()).getName()), plural); } Uml2XsdSy...
@Test public void testGetName() throws Exception { Range range; Multiplicity multiplicity; final Identifier id = Identifier.fromString("1234"); AssociationEnd mockEnd; final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Type type = Mockito.mock(Type.class); Uml2XsdSyntheticHasName test; Mockito.when(mock...
PluginForREST implements Uml2XsdPlugin { @Override public Map<String, String> declarePrefixMappings() { final Map<String, String> pms = new HashMap<String, String>(); if (TARGET_NAMESPACE.trim().length() > 0) { pms.put(TARGET_NAMESPACE_PREFIX, TARGET_NAMESPACE); } return Collections.unmodifiableMap(pms); } @Override M...
@Test public void testDeclarePrefixMappings() throws Exception { final Map<String, String> mappings = pluginForREST.declarePrefixMappings(); Assert.assertTrue(mappings.containsKey(TARGET_NAMESPACE_PREFIX)); }
PluginForREST implements Uml2XsdPlugin { @Override public QName getElementName(final String name, final boolean isReference) { return new QName(TARGET_NAMESPACE, Uml2XsdTools.camelCase(name), TARGET_NAMESPACE_PREFIX); } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String ...
@Test public void testGetElementNameQName() throws Exception { final QName expected = new QName(TARGET_NAMESPACE, "myTest", TARGET_NAMESPACE_PREFIX); Assert.assertEquals(expected, pluginForREST.getElementName("MyTest", false)); } @Test public void testGetElementName() throws Exception { final PsmDocument<Type> doc = ne...
PluginForREST implements Uml2XsdPlugin { @Override public QName getElementType(final String name, final boolean isAssociation) { return getTypeName(name); } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementTyp...
@Test public void testGetElementType() throws Exception { final QName expected = new QName(TARGET_NAMESPACE, "MyTest", TARGET_NAMESPACE_PREFIX); Assert.assertEquals(expected, pluginForREST.getElementType("MyTest", false)); }
PluginForREST implements Uml2XsdPlugin { @Override public QName getGraphAssociationEndName(final PsmDocument<Type> classType) { return new QName(TARGET_NAMESPACE, classType.getGraphAssociationEndName().getName(), TARGET_NAMESPACE_PREFIX); } @Override Map<String, String> declarePrefixMappings(); @Override QName getElem...
@Test public void testGetGraphAssociationEndName() throws Exception { final PsmDocument<Type> doc = new PsmDocument<Type>(Mockito.mock(Type.class), new PsmResource("resource"), new PsmCollection("collection")); final QName expected = new QName(TARGET_NAMESPACE, "resource", TARGET_NAMESPACE_PREFIX); Assert.assertEquals(...
ValidationController { public void processZip(File zipFile, ReportStats reportStats) { messageReport.info(reportStats, new FileSource(zipFile.getName()), ValidationMessageCode.VALIDATION_0005, zipFile.getAbsolutePath()); FileResource zipFileResource = new FileResource(zipFile.getAbsolutePath()); String ctlFile = zipFil...
@SuppressWarnings("unchecked") @Test public void testProcessZip() throws IOException, NoSuchFieldException, IllegalAccessException { Handler<org.slc.sli.ingestion.Resource, String> handler = Mockito.mock(Handler.class); ReportStats rs = Mockito.mock(ReportStats.class); Mockito.when(rs.hasErrors()).thenReturn(false); Ab...
PluginForREST implements Uml2XsdPlugin { @Override public String getTargetNamespace() { return TARGET_NAMESPACE; } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAssoc...
@Test public void testGetTargetNamespace() throws Exception { Assert.assertEquals(TARGET_NAMESPACE, pluginForREST.getTargetNamespace()); }
PluginForREST implements Uml2XsdPlugin { @Override public QName getTypeName(final String name) { return new QName(TARGET_NAMESPACE, name, TARGET_NAMESPACE_PREFIX); } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getE...
@Test public void testGetTypeName() throws Exception { final QName expected = new QName(TARGET_NAMESPACE, "test", TARGET_NAMESPACE_PREFIX); Assert.assertEquals(expected, pluginForREST.getTypeName("test")); }
PluginForREST implements Uml2XsdPlugin { @Override public boolean isAttributeFormDefaultQualified() { return false; } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAs...
@Test public void testIsAttributeFormDefaultQualified() throws Exception { Assert.assertFalse(pluginForREST.isAttributeFormDefaultQualified()); }
PluginForREST implements Uml2XsdPlugin { @Override public boolean isElementFormDefaultQualified() { return true; } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAssoc...
@Test public void testIsElementFormDefaultQualified() throws Exception { Assert.assertTrue(pluginForREST.isElementFormDefaultQualified()); }
PluginForREST implements Uml2XsdPlugin { @Override public boolean isEnabled(final QName name) { return false; } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAssociat...
@Test public void testIsEnabled() throws Exception { final QName test = new QName(""); Assert.assertFalse(pluginForREST.isEnabled(test)); }
PluginForREST implements Uml2XsdPlugin { @Override public void writeAppInfo(final TaggedValue taggedValue, final ModelIndex lookup, final Uml2XsdPluginWriter xsw) { } @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName get...
@Test public void testWriteAppInfo() throws Exception { final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class); pluginForREST.writeAppInfo(Mockito.mock(TaggedValue.class), Mockito.mock(ModelIndex.class), mockWriter); Mockito.verify(mockWriter, Mockito.never()).end(); }
PluginForREST implements Uml2XsdPlugin { @Override public void writeAssociation(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { if (end.isNavigable()) { writeEmbedded(complexType, end, model, xsw); } } @Override Map<String, String> declarePrefixMappings()...
@Test public void testWriteAssociation() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final Identifier id = Identifier.fromString("1234"); final AssociationEnd mockEnd = new AssociationEnd(multiplicity, "test", true, id, "test"); final ClassType mockClassTyp...
PluginForREST implements Uml2XsdPlugin { public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.ge...
@Test public void testWriteReference() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final Identifier id = Identifier.fromString("1234"); final List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); final TaggedValue mockTaggedValue = new TaggedVal...
PluginForREST implements Uml2XsdPlugin { @Override public void writeTopLevelElement(final PsmDocument<Type> classType, final ModelIndex model, final Uml2XsdPluginWriter xsw) { final Type elementType = classType.getType(); final QName elementName = getElementName(classType); final String ns = elementName.getNamespaceURI...
@Test public void testWriteTopLevelElement() throws Exception { final Type mockType = Mockito.mock(Type.class); final PsmDocument<Type> mockClassType = new PsmDocument<Type>(mockType, new PsmResource("resource"), new PsmCollection("collection")); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2Xs...
Uml2XsdTools { public static final String camelCase(final String name) { return name.substring(0, 1).toLowerCase().concat(name.substring(1)); } static final String camelCase(final String name); }
@Test public void testCamelCase() throws Exception { String expected; String actual; expected = "myTest"; actual = Uml2XsdTools.camelCase("MyTest"); Assert.assertEquals(expected, actual); expected = "myTest"; actual = Uml2XsdTools.camelCase("myTest"); Assert.assertEquals(expected, actual); }
ValidationController { public void processValidators(ControlFile cfile, ReportStats reportStats) { boolean isValid = false; for (IngestionFileEntry ife : cfile.getFileEntries()) { if (ife.isValid()) { messageReport.info(reportStats, new XmlFileSource(ife), ValidationMessageCode.VALIDATION_0002, ife.getFileName()); isVa...
@Test public void testValidatorInValid() throws IOException, NoSuchFieldException, IllegalAccessException { Resource xmlResource = new ClassPathResource("emptyXml/InterchangeStudent.xml"); File xmlFile = xmlResource.getFile(); IngestionFileEntry ife = new IngestionFileEntry(xmlFile.getParentFile().getAbsolutePath(), Fi...
PluginHelpers { public static final void writeDocumentation(final Taggable taggable, final ModelIndex model, final Uml2XsdPluginWriter xsw) { for (final TaggedValue taggedValue : taggable.getTaggedValues()) { final TagDefinition tagDefinition = model.getTagDefinition(taggedValue.getTagDefinition()); if (TagName.DOCUMEN...
@Test public void testWriteDocumentation() throws Exception { final Taggable mockTaggable = Mockito.mock(Taggable.class); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class); final List<TaggedValue> taggedValueList = new ArrayList<T...
PluginHelpers { public static final boolean isMongoNavigable(final AssociationEnd associationEnd, final ModelIndex model) { return TaggedValueHelper.getBooleanTag(TagName.MONGO_NAVIGABLE, associationEnd, model, false); } static final void writeDocumentation(final Taggable taggable, final ModelIndex model, ...
@Test public void testIsMongoNavigable() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); final Identifier id = Identifier.fromString("1234"); taggedValueList.add(new TaggedValue("true", id)...
PluginHelpers { public static final boolean hasMongoName(final Feature feature, final ModelIndex model) { return TaggedValueHelper.hasTag(TagName.MONGO_NAME, feature, model); } static final void writeDocumentation(final Taggable taggable, final ModelIndex model, final Uml2XsdPluginWriter xsw); static final...
@Test public void testHasMongoName() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); final Identifier id = Identifier.fromString("1234"); taggedValueList.add(new TaggedValue(TagName.MONGO_N...
PluginHelpers { public static final String getMongoName(final Feature feature, final ModelIndex model) { return TaggedValueHelper.getStringTag(TagName.MONGO_NAME, feature, model, null); } static final void writeDocumentation(final Taggable taggable, final ModelIndex model, final Uml2XsdPluginWriter xsw); s...
@Test public void testGetMongoName() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); final Identifier id = Identifier.fromString("1234"); taggedValueList.add(new TaggedValue("CollectionName...
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void annotation() { try { xsw.writeStartElement(prefix, "annotation", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix)...
@Test public void testAnnotation() throws Exception { uml2XsdPluginWriterAdapter.annotation(); Mockito.verify(mockWriter).writeStartElement(prefix, "annotation", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void appinfo() { try { xsw.writeStartElement(prefix, "appinfo", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Ove...
@Test public void testAppinfo() throws Exception { uml2XsdPluginWriterAdapter.appinfo(); Mockito.verify(mockWriter).writeStartElement(prefix, "appinfo", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void begin(final String prefix, final String localName, final String namespace) { try { xsw.writeStartElement(prefix, localName, namespace); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAda...
@Test public void testBegin() throws Exception { uml2XsdPluginWriterAdapter.begin(prefix, "test", "testns"); Mockito.verify(mockWriter).writeStartElement(prefix, "test", "testns"); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void characters(final String text) { try { xsw.writeCharacters(text); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Override void an...
@Test public void testCharacters() throws Exception { uml2XsdPluginWriterAdapter.characters("test"); Mockito.verify(mockWriter).writeCharacters("test"); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void choice() { try { xsw.writeStartElement(prefix, "choice", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Overr...
@Test public void testChoice() throws Exception { uml2XsdPluginWriterAdapter.choice(); Mockito.verify(mockWriter).writeStartElement(prefix, "choice", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void comment(final String data) { try { xsw.writeComment(data); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Override void annotati...
@Test public void testComment() throws Exception { uml2XsdPluginWriterAdapter.comment("test"); Mockito.verify(mockWriter).writeComment("test"); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void complexType() { try { xsw.writeStartElement(prefix, "complexType", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefi...
@Test public void testComplexType() throws Exception { uml2XsdPluginWriterAdapter.complexType(); Mockito.verify(mockWriter).writeStartElement(prefix, "complexType", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void documentation() { try { xsw.writeStartElement(prefix, "documentation", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String p...
@Test public void testDocumentation() throws Exception { uml2XsdPluginWriterAdapter.documentation(); Mockito.verify(mockWriter).writeStartElement(prefix, "documentation", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void element() { try { xsw.writeStartElement(prefix, "element", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Ove...
@Test public void testElement() throws Exception { uml2XsdPluginWriterAdapter.element(); Mockito.verify(mockWriter).writeStartElement(prefix, "element", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void elementName(final QName name) { try { xsw.writeAttribute("name", name.getLocalPart()); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String pref...
@Test public void testElementName() throws Exception { final QName qName = new QName("test"); uml2XsdPluginWriterAdapter.elementName(qName); Mockito.verify(mockWriter).writeAttribute("name", "test"); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void end() { try { xsw.writeEndElement(); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Override void annotation(); @Override void a...
@Test public void testEnd() throws Exception { uml2XsdPluginWriterAdapter.end(); Mockito.verify(mockWriter).writeEndElement(); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void maxOccurs(final Occurs value) { if (!value.equals(Occurs.ONE)) { try { xsw.writeAttribute(XsdAttributeName.MAX_OCCURS.getLocalName(), toString(value)); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } } Uml2...
@Test public void testMaxOccurs() throws Exception { uml2XsdPluginWriterAdapter.maxOccurs(Occurs.ONE); Mockito.verifyZeroInteractions(mockWriter); uml2XsdPluginWriterAdapter.maxOccurs(Occurs.UNBOUNDED); Mockito.verify(mockWriter).writeAttribute(XsdAttributeName.MAX_OCCURS.getLocalName(), "unbounded"); uml2XsdPluginWrit...
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void minOccurs(final Occurs value) { if (!value.equals(Occurs.ONE)) { try { xsw.writeAttribute(XsdAttributeName.MIN_OCCURS.getLocalName(), toString(value)); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } } Uml2...
@Test public void testMinOccurs() throws Exception { uml2XsdPluginWriterAdapter.minOccurs(Occurs.ONE); Mockito.verifyZeroInteractions(mockWriter); uml2XsdPluginWriterAdapter.minOccurs(Occurs.UNBOUNDED); Mockito.verify(mockWriter).writeAttribute(XsdAttributeName.MIN_OCCURS.getLocalName(), "unbounded"); uml2XsdPluginWrit...
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void ref(final QName name) { try { if (name.getNamespaceURI().equals(WxsNamespace.URI)) { xsw.writeAttribute("ref", prefix.concat(":").concat(name.getLocalPart())); } else { xsw.writeAttribute("ref", typeLexicalName(name, xsw)); } } catch (fin...
@Test public void testRef() throws Exception { final NamespaceContext mockNamespaceContext = Mockito.mock(NamespaceContext.class); Mockito.when(mockWriter.getNamespaceContext()).thenReturn(mockNamespaceContext); Mockito.when(mockNamespaceContext.getPrefix(Matchers.anyString())).thenReturn("sli"); final QName qName = ne...
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void sequence() { try { xsw.writeStartElement(prefix, "sequence", WxsNamespace.URI); } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @O...
@Test public void testSequence() throws Exception { uml2XsdPluginWriterAdapter.sequence(); Mockito.verify(mockWriter).writeStartElement(prefix, "sequence", WxsNamespace.URI); }
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void type(final QName name) { try { if (name.getNamespaceURI().equals(WxsNamespace.URI)) { xsw.writeAttribute("type", prefix.concat(":").concat(name.getLocalPart())); } else { xsw.writeAttribute("type", typeLexicalName(name, xsw)); } } catch (...
@Test public void testType() throws Exception { final NamespaceContext mockNamespaceContext = Mockito.mock(NamespaceContext.class); Mockito.when(mockWriter.getNamespaceContext()).thenReturn(mockNamespaceContext); Mockito.when(mockNamespaceContext.getPrefix(Matchers.anyString())).thenReturn("sli"); final QName qName = n...
ValidationController { public void processControlFile(File parentDirectoryOrZipFile, String ctlFile, ReportStats reportStats) { Source source = new ControlFileSource(ctlFile); messageReport.info(reportStats, source, ValidationMessageCode.VALIDATION_0007, ctlFile); try { ControlFile cfile = ControlFile.parse(parentDirec...
@Test public void testInvalidProcessControlFile() throws IOException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Resource ctlFileResource = new ClassPathResource(invalidControlFile); File ctlFile = ctlFileResource.getFile(); AbstractMessageReport messageReport = Mockito....
Uml2XsdWriter { public static final void writeSchema(final List<PsmDocument<Type>> elements, final ModelIndex model, final Uml2XsdPlugin plugin, final File file) { try { final OutputStream outstream = new BufferedOutputStream(new FileOutputStream(file)); try { writeSchema(elements, model, plugin, outstream); } finally ...
@Test public void testByFile() throws FileNotFoundException { File file = new File(filename); Uml2XsdWriter.writeSchema(documents, model, plugin, file); try { XsdReader.readSchema(file, null); } catch (AssertionError e) { Assert.fail(); } finally { file.delete(); } } @Test public void testByString() throws FileNotFound...