src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
XmiFeature { @Override public String toString() { return String.format("{name : %s, exists : %s, className : %s, classExists : %s}", name, exists, className, classExists); } XmiFeature(final String name, final boolean exists, final String className, final boolean classExists); String getName(); String getOwnerName(); b... | @Test public void testToString() { assertNotNull(XMI_FEATURE.toString()); } |
XmiDefinition { public String getName() { return name; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); } | @Test public void testGetName() { Assert.assertEquals(NAME, xmiDefinition.getName()); } |
XmiDefinition { public String getVersion() { return version; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); } | @Test public void testGetVersion() { Assert.assertEquals(VERSION, xmiDefinition.getVersion()); } |
XmiDefinition { public String getFile() { return file; } XmiDefinition(final String name, final String version, final String file); String getName(); String getVersion(); String getFile(); } | @Test public void testGetFile() { Assert.assertEquals(FILE, xmiDefinition.getFile()); } |
XmiReader { protected static final <T> T assertNotNull(final T obj) { if (obj != null) { return obj; } else { throw new AssertionError(); } } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName); } | @Test public void testAssertNotNullHappyPath() { Object o = new Object(); assertTrue(XmiReader.assertNotNull(o) == o); }
@Test(expected = AssertionError.class) public void testAssertNotNullSadPath() { XmiReader.assertNotNull(null); }
@Test public void testAllPublicMethods() throws XMLStreamException, IOException { Stri... |
XmiReader { protected static final Occurs getOccurs(final XMLStreamReader reader, final XmiAttributeName name) { final int value = Integer.valueOf(reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName())); switch (value) { case 0: { return Occurs.ZERO; } case 1: { return Occurs.ONE; } case -1: { return Occurs.UN... | @Test public void testGetOccursHappyPath() { when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("1"); assertTrue(XmiReader.getOccurs(mockReader, sampleAttribute) == Occurs.ONE); when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("0"); assertTrue(XmiReade... |
DocumentManipulator { protected Document parseDocument(File file) throws DocumentManipulatorException { Document doc = null; try { DocumentBuilder builder = docFactory.newDocumentBuilder(); doc = builder.parse(file); } catch (SAXException e) { throw new DocumentManipulatorException(e); } catch (IOException e) { throw n... | @Test(expected = DocumentManipulatorException.class) public void testParseDocumentEmptyFile() throws DocumentManipulatorException { handler.parseDocument(new File("")); }
@Test public void testParseDocument() throws DocumentManipulatorException, URISyntaxException { URL url = this.getClass().getResource("/sample.xml");... |
XmiReader { protected static final Identifier getIdRef(final XMLStreamReader reader) throws XmiMissingAttributeException { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.IDREF.getLocalName()); if (value != null) { return Identifier.fromString(value); } else { throw new XmiMissingAttrib... | @Test public void testGetIdRefHappyPath() { String id = "ID1234567890"; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn(id); assertTrue(XmiReader.getIdRef(mockReader).toString().equals(id)); }
@Test(expected = XmiMissingAttributeException.class) public void testGetIdRefSadPath() { wh... |
XmiReader { protected static final Identifier getId(final XMLStreamReader reader) { return Identifier.fromString(reader.getAttributeValue(GLOBAL_NAMESPACE, XmiAttributeName.ID.getLocalName())); } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model r... | @Test public void testGetIdHappyPath() { String id = "ID1234567890"; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn(id); assertTrue(XmiReader.getId(mockReader).toString().equals(id)); } |
XmiReader { protected static final boolean getBoolean(final XmiAttributeName name, final boolean defaultValue, final XMLStreamReader reader) { final String value = reader.getAttributeValue(GLOBAL_NAMESPACE, name.getLocalName()); if (value != null) { return Boolean.valueOf(value); } else { return defaultValue; } } stat... | @Test public void testGetBoolean() { boolean defaultBoolean; defaultBoolean = false; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("true"); assertTrue(XmiReader.getBoolean(sampleAttribute, defaultBoolean, mockReader)); defaultBoolean = true; when(mockReader.getAttributeValue(any(St... |
XmiReader { protected static final void closeQuiet(final Closeable closeable) { IOUtils.closeQuietly(closeable); } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final String fileName); } | @Test public void testCloseQuiet() throws IOException { Closeable mockCloseable = mock(Closeable.class); final StringBuffer stringBuffer = new StringBuffer(); PrintStream stdErr = System.err; PrintStream myErr = new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { stringBuffer.ap... |
XmiReader { protected static final void assertName(final QName name, final XMLStreamReader reader) { if (!match(name, reader)) { throw new AssertionError(reader.getLocalName()); } } static final Model readModel(final File file); static final Model readModel(final InputStream stream); static final Model readModel(final... | @Test public void testAssertElementNameEqualsStreamReadNameHappyPath() { XmiElementName xmiElementName = XmiElementName.ASSOCIATION; String elementName = xmiElementName.getLocalName(); when(mockReader.getLocalName()).thenReturn(elementName); XmiReader.assertName(xmiElementName, mockReader); }
@Test(expected = Assertion... |
XmiReader { protected static final void skipElement(final XMLStreamReader reader, final boolean check) throws XMLStreamException { if (check) { throw new AssertionError(reader.getName()); } final String localName = reader.getLocalName(); while (reader.hasNext()) { reader.next(); switch (reader.getEventType()) { case XM... | @Test public void testSkipElement() throws XMLStreamException { final List<String> localNames = new ArrayList<String>(); localNames.add("myLocalName1"); localNames.add("myLocalName2"); localNames.add("myLocalName2"); localNames.add("myLocalName1"); final List<Integer> eventTypes = new ArrayList<Integer>(); eventTypes.a... |
ValueMapper extends Mapper<TenantAndIdEmittableKey, BSONWritable, TenantAndIdEmittableKey, Writable> { @Override public void map(TenantAndIdEmittableKey key, BSONWritable entity, Context context) throws InterruptedException, IOException { context.write(key, getValue(entity)); } @Override void map(TenantAndIdEmittableK... | @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testMap() throws Exception { TenantAndIdEmittableKey key = new TenantAndIdEmittableKey(); ValueMapper m = new MockValueMapper(); BSONObject entry = new BasicBSONObject("found", "data"); BSONWritable entity = new BSONWritable(entry); Context context = Mock... |
XmiReader { protected static final String getName(final XMLStreamReader reader, final String defaultName, final XmiAttributeName attr) { final String name = reader.getAttributeValue(GLOBAL_NAMESPACE, attr.getLocalName()); if (name != null) { return name; } else { return defaultName; } } static final Model readModel(fi... | @Test public void testGetName() { String defaultString; defaultString = "defString"; when(mockReader.getAttributeValue(any(String.class), any(String.class))).thenReturn("specifiedString"); assertEquals("specifiedString", XmiReader.getName(mockReader, defaultString, sampleAttribute)); when(mockReader.getAttributeValue(a... |
XmiWriter { public static final void writeDocument(final Model model, final ModelIndex mapper, final OutputStream outstream) { final XMLOutputFactory xof = XMLOutputFactory.newInstance(); try { final XMLStreamWriter xsw = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(outstream, "UTF-8")); xsw.writeStartDocumen... | @Test public void testWriteDocumentOutputStream() throws Exception { OutputStream os = new ByteArrayOutputStream(); OutputStream mockOutputStream = spy(os); XmiWriter.writeDocument(model, modelIndex, mockOutputStream); String output = mockOutputStream.toString(); assertTrue(output.contains(MODEL_ID.toString())); assert... |
WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource... | @Test(expected = IllegalArgumentException.class) public void testWalkNullApplication() { WadlHandler mockHandler = mock(WadlHandler.class); WadlWalker ww = new WadlWalker(mockHandler); ww.walk(null); }
@Test public void testWalk() { WadlHandler wadlHandler = mock(WadlHandler.class); WadlWalker ww = new WadlWalker(wadlH... |
WadlHelper { public static List<Param> getRequestParams(final Method method) { if (method == null) { throw new IllegalArgumentException(); } final Request request = method.getRequest(); if (request != null) { return request.getParams(); } else { return Collections.emptyList(); } } private WadlHelper(); static List<Par... | @Test public void testGetRequestParams() throws Exception { Param mockParam = mock(Param.class); Request mockRequest = mock(Request.class); List<Param> mockParamList = new ArrayList<Param>(1); mockParamList.add(mockParam); when(mockRequest.getParams()).thenReturn(mockParamList); Method mockMethod = mock(Method.class); ... |
DocumentManipulator { public NodeList getNodeList(Document doc, String expression) throws XPathException { XPath xpath = xPathFactory.newXPath(); xpath.setNamespaceContext(new DocumentNamespaceResolver(doc)); XPathExpression exp = xpath.compile(expression); Object result = exp.evaluate(doc, XPathConstants.NODESET); ret... | @Test public void testGetNodeList() throws DocumentManipulatorException, URISyntaxException, XPathException { URL url = this.getClass().getResource("/sample.xml"); String expression = " Document doc = handler.parseDocument(new File(url.toURI())); NodeList list = handler.getNodeList(doc, expression); assertNotNull("list... |
WadlHelper { public static final String computeId(final Method method, final Resource resource, final Resources resources, final Application app, final Stack<Resource> ancestors) { final List<String> steps = reverse(toSteps(resource, ancestors)); final StringBuilder sb = new StringBuilder(); sb.append(method.getVerb().... | @Test public void testComputeId() throws Exception { String id = "getStudentsByIdForApi"; Method mockMethod = mock(Method.class); when(mockMethod.getVerb()).thenReturn(Method.NAME_HTTP_GET); Resource mockResource = mock(Resource.class); when(mockResource.getPath()).thenReturn("students/{id}"); Resource mockAncestorReso... |
WadlHelper { public static final String titleCase(final String text) { return text.substring(0, 1).toUpperCase().concat(text.substring(1)); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final Resources resou... | @Test public void testTitleCase() throws Exception { String camelCase = "randomName"; String titleCase = "RandomName"; assertEquals(titleCase, WadlHelper.titleCase(camelCase)); } |
WadlHelper { 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); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final S... | @Test public void testReverse() throws Exception { @SuppressWarnings({ "serial" }) List<Integer> strList = new ArrayList<Integer>(3) { { add(1); add(2); add(3); } }; List<Integer> revList = WadlHelper.reverse(strList); assertEquals(3, revList.size()); assertEquals(3, (int) revList.get(0)); assertEquals(2, (int) revList... |
WadlHelper { public static final boolean isVersion(final String step) { return step.toLowerCase().equals("v1"); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final Resources resources,
final Appl... | @Test public void testIsVersion() throws Exception { String versionString = "v1"; String versionStringUpperCase = "V1"; String nonVersionString = "blah"; assertTrue(WadlHelper.isVersion(versionString)); assertTrue(WadlHelper.isVersion(versionStringUpperCase)); assertFalse(WadlHelper.isVersion(nonVersionString)); } |
WadlHelper { public static final String parseTemplateParam(final String step) { if (isTemplateParam(step)) { return step.substring(1, step.length() - 1); } else { throw new AssertionError(step); } } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Meth... | @Test public void testParseTemplateParam() throws Exception { String templateParam = "{paramName}"; assertEquals("paramName", WadlHelper.parseTemplateParam(templateParam)); } |
WadlHelper { public static final List<String> toSteps(final Resource resource, final Stack<Resource> ancestors) { final List<String> result = new LinkedList<String>(); for (final Resource ancestor : ancestors) { result.addAll(splitBasedOnFwdSlash(ancestor.getPath())); } result.addAll(splitBasedOnFwdSlash(resource.getPa... | @Test public void testToSteps() throws Exception { Resource mockResource = mock(Resource.class); when(mockResource.getPath()).thenReturn("students/{id}"); Resource mockAncestorResource = mock(Resource.class); when(mockAncestorResource.getPath()).thenReturn("api/v1"); Stack<Resource> resources = new Stack<Resource>(); r... |
WadlHelper { public static final boolean isTemplateParam(final String step) { return step.trim().startsWith("{") && step.endsWith("}"); } private WadlHelper(); static List<Param> getRequestParams(final Method method); static final String computeId(final Method method, final Resource resource, final Resources resources... | @Test public void testIsTemplateParam() throws Exception { String templateParam = "{paramName}"; String nonTemplateParam = "blah"; assertTrue(WadlHelper.isTemplateParam(templateParam)); assertFalse(WadlHelper.isTemplateParam(nonTemplateParam)); } |
XsdReader { public static final XmlSchema readSchema(final String fileName, final URIResolver schemaResolver) throws FileNotFoundException { final InputStream istream = new BufferedInputStream(new FileInputStream(fileName)); try { return readSchema(istream, schemaResolver); } finally { closeQuiet(istream); } } static ... | @Test public void testReadSchemaUsingFile() throws FileNotFoundException, URISyntaxException { final URIResolver mockResolver = mock(URIResolver.class); final File testXSD = new File(getClass().getResource("/test.xsd").toURI()); final XmlSchema schema = XsdReader.readSchema(testXSD, mockResolver); testReadSchema(schema... |
SeaCustomDataProvider { public Map<String, List<SliEntityLocator>> getIdMap(String seaGuid) { LOG.info("Attempting to pull id map from SEA custom data, will cause exception if doesn't exist"); List<Entity> list = slcInterface.read("/educationOrganizations/" + seaGuid + "/custom"); if (list.size() > 0) { Map<String, Obj... | @Test public void testGetMap() { String seaGuid = "asladfalsd"; String url = "/educationOrganizations/" + seaGuid + "/custom"; Mockito.when(mockSlcInterface.read(url)).thenReturn(buildCustomDataList()); Map<String, List<SliEntityLocator>> result = dataProvider.getIdMap(seaGuid); Assert.assertNotNull(result); Assert.ass... |
ResourceDocumentation { public void addDocumentation() throws IOException, XPathException { final NodeList topLevelResources = manipulator.getNodeList(this.doc, " for (int i = 0; i < topLevelResources.getLength(); i++) { final Node node = topLevelResources.item(i); final ResourceEndPointTemplate resourceTemplate = getR... | @Test public void testAddDocumentation() throws Exception { NodeList section = documentManipulator.getNodeList(testWadl, " assertEquals(1, section.getLength()); Node sectionNodeDoc = documentManipulator.getNodeList(testWadl, " assertNotNull(sectionNodeDoc); assertEquals("test /sections doc", sectionNodeDoc.getFirstChil... |
SifIdResolverCustomData implements SifIdResolver { @Override public Entity getSliEntity(String sifId, String zoneId) { synchronized (lock) { List<Entity> entities = getSliEntityList(sifId, zoneId); if (entities == null || entities.size() == 0) { LOG.warn("No entity found for sifId: " + sifId); return null; } return ent... | @Test public void getSliEntityShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); Entity expected = new GenericEntity(SLI_TYPE1, new HashMap<String, Object>()); List<Entity> queryResult = Arrays.asList(new Entity[] { expected }); when(mockSlcInterface.read(eq(SLI_TYPE1), any(Query.class))).thenReturn... |
SifIdResolverCustomData implements SifIdResolver { @Override public String getZoneSea(String zoneId) { synchronized (lock) { Map<String, SliEntityLocator> seaMap = zoneMapProvider.getZoneToSliIdMap(); SliEntityLocator locator = seaMap.get(zoneId); Entity seaEntity = fetchSliEntity(locator); if (seaEntity == null) { ret... | @Test public void getZoneSeaShouldLookupSeaGuid() throws Exception { when(mockZoneMapProvider.getZoneToSliIdMap()).thenReturn(getDummySeaIdMap()); Entity seaEntity = Mockito.mock(Entity.class); when(seaEntity.getId()).thenReturn(SEA_ID2); List<Entity> queryResult = Arrays.asList(new Entity[] { seaEntity }); when(mockSl... |
DeltaExtractor implements InitializingBean { public void execute(String tenant, File tenantDirectory, DateTime deltaUptoTime) { TenantContext.setTenantId(tenant); audit(securityEventUtil.createSecurityEvent(this.getClass().getName(), "Delta Extract Initiation", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0019, DAT... | @SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testPublicAndPrivate() { when(deltaEntityIterator.hasNext()).thenReturn(true, true, true, false); when(deltaEntityIterator.next()).thenReturn(buildUpdatePublicRecord(), buildDeleteRecord(), buildUpdatePrivateRecord()); extractor.execute("Midgar", null, ne... |
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityList(String sifId, String zoneId) { synchronized (lock) { String seaId = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaId); List<SliEntityLocator> locators = idMap.get(sifId); if... | @Test public void getSliEntityListShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); List<Entity> expected = new ArrayList<Entity>(); Entity entity = new GenericEntity(SLI_TYPE3A, new HashMap<String, Object>()); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(mockSlcInterface... |
SifIdResolverCustomData implements SifIdResolver { @Override public Entity getSliEntityFromOtherSifId(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntity(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSliGuidL... | @Test public void getSliEntityFromOtherSifIdShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); Entity expected = new GenericEntity(SLI_TYPE4, new HashMap<String, Object>()); List<Entity> queryResult = Arrays.asList(new Entity[] { expected }); when(mockSlcInterface.read(eq(SLI_TYPE4), any(Query.class... |
SifIdResolverCustomData implements SifIdResolver { @Override public String getSliGuid(String sifId, String zoneId) { synchronized (lock) { Entity entity = getSliEntity(sifId, zoneId); if (entity == null) { LOG.info("No sli id found for sifId(" + sifId + ")"); return null; } return entity.getId(); } } @Override String ... | @Test public void getSliGuidShouldFindGuid() throws Exception { setupCustomDataMocking(); Entity expected = Mockito.mock(Entity.class); when(expected.getId()).thenReturn(SLI_ID1); List<Entity> queryResult = Arrays.asList(new Entity[] { expected }); when(mockSlcInterface.read(eq(SLI_TYPE1), any(Query.class))).thenReturn... |
SifIdResolverCustomData implements SifIdResolver { @Override public List<String> getSliGuidList(String sifId, String zoneId) { synchronized (lock) { List<Entity> entityList = getSliEntityList(sifId, zoneId); List<String> idList = new ArrayList<String>(); for (Entity entity : entityList) { idList.add(entity.getId()); } ... | @Test public void getSliGuidListShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); List<Entity> expected = new ArrayList<Entity>(); Entity entity = Mockito.mock(Entity.class); when(entity.getId()).thenReturn(SLI_ID3A); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(mockSlcIn... |
SifIdResolverCustomData implements SifIdResolver { @Override public List<Entity> getSliEntityListByType(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntityList(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSl... | @Test public void getSliEntityListByTypeShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); List<Entity> expected = new ArrayList<Entity>(); Entity entity = Mockito.mock(Entity.class); when(entity.getId()).thenReturn(SLI_ID3A); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(m... |
SifIdResolverCustomData implements SifIdResolver { @Override public Entity getSliEntityByType(String sifId, String sliType, String zoneId) { synchronized (lock) { return getSliEntity(sifId + "-" + sliType, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); @Override List<String> getSliGuidList(Stri... | @Test public void getSliEntityByTypeShouldLookupSliEntities() throws Exception { setupCustomDataMocking(); Entity expected = new GenericEntity(SLI_TYPE4, new HashMap<String, Object>()); List<Entity> queryResult = Arrays.asList(new Entity[] { expected }); when(mockSlcInterface.read(eq(SLI_TYPE4), any(Query.class))).then... |
SifIdResolverCustomData implements SifIdResolver { @Override public List<String> getSliGuidListByType(String sifId, String sliType, String zoneId) { synchronized (lock) { List<Entity> entityList = getSliEntityListByType(sifId, sliType, zoneId); List<String> idList = new ArrayList<String>(); for (Entity entity : entityL... | @Test public void getSliGuidListByTypeShouldLookupSliGuids() throws Exception { setupCustomDataMocking(); List<Entity> expected = new ArrayList<Entity>(); Entity entity = Mockito.mock(Entity.class); when(entity.getId()).thenReturn(SLI_ID3A); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(mockSl... |
SifIdResolverCustomData implements SifIdResolver { @Override public String getSliGuidByType(String sifId, String sliType, String zoneId) { synchronized (lock) { Entity entity = getSliEntityFromOtherSifId(sifId, sliType, zoneId); if (entity == null) { return null; } return entity.getId(); } } @Override String getSliGui... | @Test public void getSliGuidByTypeShouldLookupSliGuid() throws Exception { setupCustomDataMocking(); Entity entity = Mockito.mock(Entity.class); when(entity.getId()).thenReturn(SLI_ID4); List<Entity> queryResult = Arrays.asList(new Entity[] { entity }); when(mockSlcInterface.read(eq(SLI_TYPE4), any(Query.class))).thenR... |
SifIdResolverCustomData implements SifIdResolver { @Override public void putSliGuid(String sifId, String sliType, String sliId, String zoneId) { synchronized (lock) { String seaGuid = getZoneSea(zoneId); Map<String, List<SliEntityLocator>> idMap = customDataProvider.getIdMap(seaGuid); SliEntityLocator id = new SliEntit... | @Test public void putSliGuidStoreNewId() throws Exception { Map<String, List<SliEntityLocator>> idMap = setupCustomDataMocking(); when(mockSeaCustomDataProvider.getIdMap(SEA_ID1)).thenReturn(idMap); resolver.putSliGuid("newSifId", "sliType", "sliId", ZONE_ID1); List<SliEntityLocator> resultList = idMap.get("newSifId");... |
SifIdResolverCustomData implements SifIdResolver { @Override public void putSliGuidForOtherSifId(String sifId, String sliType, String sliId, String zoneId) { synchronized (lock) { String key = sifId + "-" + sliType; putSliGuid(key, sliType, sliId, zoneId); } } @Override String getSliGuid(String sifId, String zoneId); ... | @Test public void putSliGuidForOtherSifIdStoreNewId() throws Exception { Map<String, List<SliEntityLocator>> idMap = setupCustomDataMocking(); when(mockSeaCustomDataProvider.getIdMap(SEA_ID1)).thenReturn(idMap); resolver.putSliGuidForOtherSifId("newSifId", "sliType", "sliId", ZONE_ID1); List<SliEntityLocator> resultLis... |
AgentManager { public void setup() throws Exception { System.setProperty("adk.log.file", logPath + File.separator + adkLogFile); ADK.initialize(); ADK.debug = ADK.DBG_ALL; agent.startAgent(); subscribeToZone(); } @PostConstruct void postConstruct(); void setup(); @PreDestroy void cleanup(); void setSubscribeTypeList(L... | @Test public void shouldStartAgentOnSetup() throws Exception { agentManager.setup(); Mockito.verify(mockAgent, Mockito.times(1)).startAgent(); }
@Test public void shouldSubscribeToZoneOnSetup() throws Exception { agentManager.setup(); Mockito.verify(mockAgent, Mockito.times(1)).startAgent(); Mockito.verify(mockZone, Mo... |
AgentManager { @PreDestroy public void cleanup() throws ADKException { agent.shutdown(ADKFlags.PROV_NONE); } @PostConstruct void postConstruct(); void setup(); @PreDestroy void cleanup(); void setSubscribeTypeList(List<String> subscribeTypeList); List<String> getSubscribeTypeList(); void setSubscriberZoneName(String s... | @Test public void shouldShutdownAgentOnCleanup() throws ADKException { agentManager.cleanup(); Mockito.verify(mockAgent, Mockito.times(1)).shutdown(Mockito.eq(ADKFlags.PROV_NONE)); } |
SifAgent extends Agent { public void startAgent() throws Exception { super.initialize(); setProperties(); Zone[] allZones = getZoneFactory().getAllZones(); zoneConfigurator.configure(allZones); } SifAgent(); SifAgent(String id); SifAgent(String id, ZoneConfigurator zoneConfig, Properties agentProperties,
... | @Test public void shouldCreateAndConfigureAgent() throws Exception { ZoneConfigurator mockZoneConfigurator = Mockito.mock(ZoneConfigurator.class); SifAgent agent = createSifAgent(mockZoneConfigurator); agent.startAgent(); AgentProperties props = agent.getProperties(); Assert.assertEquals("Push", props.getProperty("adk.... |
SifSubscriber implements Subscriber { @Override public void onEvent(Event event, Zone zone, MessageInfo info) throws ADKException { LOG.info("Received event:\n" + "\tEvent: " + event.getActionString() + "\n" + "\tZone: " + zone.getZoneId() + "\n" + "\tInfo: " + info); SIFDataObject sifData = inspectAndDestroyEvent(even... | @Test public void shouldCallSessionCheckOnEvent() throws ADKException { SIFDataObject mockSifDataObject = createMockSifDataObject(); Event mockEvent = createMockSifEvent(false, mockSifDataObject); Zone mockZone = createMockZone(); MessageInfo mockInfo = createMockInfo(); subscriber.onEvent(mockEvent, mockZone, mockInfo... |
StudentPersonalTranslationTask extends AbstractTranslationTask<StudentPersonal, StudentEntity> { private List<String> getHomeLanguages(LanguageList languageList) { Language[] languages = languageList == null ? null : languageList.getLanguages(); if (languages == null) { return null; } LanguageList homeList = new Langua... | @Test public void testLanguages() throws SifTranslationException { StudentPersonal info = new StudentPersonal(); Demographics demographics = new Demographics(); LanguageList languageList = new LanguageList(); languageList.addLanguage(LanguageCode.ENGLISH); languageList.addLanguage(LanguageCode.CHINESE); demographics.se... |
EmploymentRecordToStaffEdOrgTranslationTask extends
AbstractTranslationTask<EmploymentRecord, StaffEducationOrganizationAssociationEntity> { @Override public List<StaffEducationOrganizationAssociationEntity> doTranslate(EmploymentRecord sifData, String zoneId) { List<StaffEducationOrganizationAssociationEntity>... | @Test public void shouldNotReturnNull() { Entity entity = new GenericEntity("entityType", new HashMap<String, Object>()); Mockito.when(sifIdResolver.getSliEntity(Mockito.anyString(), Mockito.anyString())).thenReturn(entity); List<StaffEducationOrganizationAssociationEntity> result = translator.doTranslate(new Employmen... |
EdOrgExtractor { public void execute(String tenant, File tenantDirectory, DateTime startTime) { TenantContext.setTenantId(tenant); this.tenantDirectory = tenantDirectory; this.startTime = startTime; audit(securityEventUtil.createSecurityEvent(this.getClass().getName(), "Top-level extract initiated", LogLevelType.TYPE_I... | @Test @Ignore public void testExecute() { File tenantDir = Mockito.mock(File.class); Map<String, Object> registration = new HashMap<String, Object>(); registration.put("status", "APPROVED"); body.put("registration", registration); Mockito.when(repo.findAll(Mockito.eq("application"), Mockito.any(NeutralQuery.class))).th... |
SifTranslationManager { public List<SliEntity> translate(SIFDataObject sifData, String zoneId) { List<SliEntity> entities = new ArrayList<SliEntity>(); List<TranslationTask> translationTasks = translationMap.get(sifData.getObjectType().toString()); if (translationTasks == null) { LOG.error("No TranslationTask found for... | @Test public void shouldCreateOneToOneTranslatedEntities() { List<SliEntity> sliEntities = sifTranslationManager.translate(sifB, "zoneId"); Assert.assertEquals("Should translate to one sli entity", 1, sliEntities.size()); Assert.assertEquals("First translated entity not of correct", sliZ, sliEntities.get(0)); }
@Test p... |
PublishZoneConfigurator implements ZoneConfigurator { @Override public void configure(Zone[] allZones) { for (Zone zone : allZones) { try { LOG.info("- Connecting to zone \"" + zone.getZoneId() + "\" at " + zone.getZoneUrl()); zone.connect(ADKFlags.PROV_REGISTER | ADKFlags.PROV_PROVIDE); } catch (ADKException ex) { LOG... | @Test public void testConfigure() throws ADKException { Zone[] zones = {zone1, zone2, zone3}; publishZoneConfigurator.configure(zones); Mockito.verify(zone1, Mockito.times(1)).connect(Mockito.anyInt()); Mockito.verify(zone2, Mockito.times(1)).connect(Mockito.anyInt()); Mockito.verify(zone3, Mockito.times(1)).connect(Mo... |
SubscribeZoneConfigurator implements ZoneConfigurator { @Override public void configure(Zone[] allZones) { for (Zone zone : allZones) { try { LOG.info("- Connecting to zone \"" + zone.getZoneId() + "\" at " + zone.getZoneUrl()); zone.connect(ADKFlags.PROV_REGISTER | ADKFlags.PROV_SUBSCRIBE); } catch (ADKException ex) {... | @Test public void testConfigure() throws ADKException { Zone[] zones = {zone1, zone2, zone3}; subscribeZoneConfigurator.configure(zones); Mockito.verify(zone1, Mockito.times(1)).connect(Mockito.anyInt()); Mockito.verify(zone2, Mockito.times(1)).connect(Mockito.anyInt()); Mockito.verify(zone3, Mockito.times(1)).connect(... |
SliEntity { public Map<String, Object> createBody() { Map<String, Object> body = null; try { body = MAPPER. readValue(this.json(), new TypeReference<Map<String, Object>>() { }); clearNullValueKeys(body); } catch (JsonParseException e) { LOG.error("Entity map conversion error: ", e); } catch (JsonMappingException e) { L... | @Test public void shouldTransformConcreteBodyToMap() { testSliEntity = new TestSliEntity(); Map<String, Object> body = testSliEntity.createBody(); Assert.assertEquals("Body should contain 2 elements", 2, body.size()); Assert.assertEquals("Incorrect map element", "1", body.get("fieldOne")); @SuppressWarnings("unchecked"... |
SliEntity { public GenericEntity createGenericEntity() { GenericEntity entity = new GenericEntity(entityType(), createBody()); return entity; } SliEntity(); abstract String entityType(); GenericEntity createGenericEntity(); Map<String, Object> createBody(); JsonNode json(); @JsonIgnore boolean isCreatedByOthers(); @Jso... | @Test public void shouldCreateGenericEntity() { testSliEntity = new TestSliEntity(); GenericEntity entity = testSliEntity.createGenericEntity(); Assert.assertNotNull("GenericEntity null", entity); Assert.assertNotNull("Entity body null", entity.getData()); Assert.assertEquals("Incorrect entity type", "TestEntity", enti... |
OtherIdListConverter { public List<StaffIdentificationCode> convert(OtherIdList otherIdList) { if (otherIdList == null) { return null; } return toSliStaffIdentificationCodeList(otherIdList.getOtherIds()); } List<StaffIdentificationCode> convert(OtherIdList otherIdList); } | @Test public void testNullObject() { List<StaffIdentificationCode> result = converter.convert((OtherIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result); result = converter.convert((OtherIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result); }
@Test p... |
YesNoUnknownConverter { public Boolean convert(String value) { return value == null ? null : BOOLEAN_MAP.get(value); } Boolean convert(String value); } | @Test public void testNullObject() { Boolean result = converter.convert(null); Assert.assertNull("Race list should be null", result); }
@Test public void testYes() { Boolean result = converter.convert("Yes"); Assert.assertEquals(Boolean.TRUE, result); }
@Test public void testNo() { Boolean result = converter.convert("N... |
YesNoConverter { public Boolean convert(YesNo value) { return value == null ? null : BOOLEAN_MAP.get(value); } Boolean convert(YesNo value); } | @Test public void testNullObject() { Boolean result = converter.convert(null); Assert.assertNull("Result should be null", result); }
@Test public void testYes() { Boolean result = converter.convert(YesNo.YES); Assert.assertEquals(Boolean.TRUE, result); }
@Test public void testNo() { Boolean result = converter.convert(Y... |
EntityExtractor { public void extractEntities(ExtractFile archiveFile, String collectionName, Predicate<Entity> filter) { audit(securityEventUtil.createSecurityEvent(this.getClass().getName(), " Entity extraction", LogLevelType.TYPE_INFO, BEMessageCode.BE_SE_CODE_0024, collectionName)); if (extractionQuery == null) { e... | @SuppressWarnings("unchecked") @Test public void testExtractEntities() throws IOException { String testTenant = "Midgar"; String testEntity = "student"; Iterator<Entity> cursor = Mockito.mock(Iterator.class); List<Entity> students = TestUtils.createStudents(); Mockito.when(cursor.hasNext()).thenReturn(true, true, true,... |
DateConverter { public String convert(Calendar date) { if (date == null) { return null; } return dateFormat.format(date.getTime()); } String convert(Calendar date); } | @Test public void shouldConvertWithCorrectFormat() { Calendar date = new GregorianCalendar(2004, Calendar.FEBRUARY, 29); String result = converter.convert(date); Assert.assertEquals("2004-02-29", result); }
@Test public void shouldHandleNullDate() { String result = converter.convert(null); Assert.assertNull(result); } |
ElectronicIdListConverter { public List<StaffIdentificationCode> convert(ElectronicIdList electronicIdList) { if (electronicIdList == null) { return null; } return toSliStaffIdentificationCodeList(electronicIdList.getElectronicIds()); } List<StaffIdentificationCode> convert(ElectronicIdList electronicIdList); } | @Test public void testNullObject() { List<StaffIdentificationCode> result = converter.convert((ElectronicIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result); result = converter.convert((ElectronicIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result);... |
SchoolFocusConverter { public String convert(SchoolFocusList schoolFocusList) { if (schoolFocusList == null || schoolFocusList.getSchoolFocuses().length == 0) { return null; } SchoolFocus[] schoolFocus = schoolFocusList.getSchoolFocuses(); String result = SCHOOL_FOCUS_MAP.get(schoolFocus[0].getValue()); if (result != n... | @Test public void testNullList() { String result = converter.convert(null); Assert.assertNull("school type should be null", result); }
@Test public void testEmptyList() { SchoolFocusList list = new SchoolFocusList(); String result = converter.convert(list); Assert.assertNull("school type should be null", result); }
@Te... |
EntityExtractor { public void extractEntity(Entity entity, ExtractFile archiveFile, String collectionName, Predicate<Entity> filter) { if (archiveFile != null) { write(entity, archiveFile, new CollectionWrittenRecord(collectionName), filter); } } void extractEntities(ExtractFile archiveFile, String collectionName, Pre... | @Test public void testExtractEntity() throws IOException { extractor.extractEntity(Mockito.mock(Entity.class), Mockito.mock(ExtractFile.class), "BLOOP"); Mockito.verify(writer, Mockito.times(1)).write(Mockito.any(Entity.class), Mockito.any(ExtractFile.class)); } |
JobClassificationConverter { public String convert(JobClassification jobClassification) { if (jobClassification == null) { return null; } return toSliEntryType(JobClassificationCode.wrap(jobClassification.getCode())); } String convert(JobClassification jobClassification); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Entry Type should be null", result); }
@Test public void testMappings() { Assert.assertEquals(converter.convert(getJobClassification(JobClassificationCode.ATHLETIC_TRAINER)), "Athletic Trainer"); Assert.assertEquals(convert... |
TeachingAssignmentConverter { public List<String> convert(TeachingAssignment source) { if (source == null) { return null; } List<String> list = new ArrayList<String>(0); list.add(toSliAcademicSubjectType(TeachingArea.wrap(source.getCode()))); return list; } List<String> convert(TeachingAssignment source); } | @Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assertNull("Teaching Assignment list should be null", result); }
@Test public void testEmptyList() { TeachingAssignment list = new TeachingAssignment(); List<String> result = converter.convert(list); Assert.assertEquals(1, result... |
EmailListConverter { public List<ElectronicMail> convert(EmailList list) { if (list == null) { return null; } List<ElectronicMail> result = new ArrayList<ElectronicMail>(); for (Email sifEmail : list) { ElectronicMail sliEmail = new ElectronicMail(); sliEmail.setEmailAddress(sifEmail.getValue()); result.add(sliEmail); ... | @Test public void testNullObject() { List<ElectronicMail> result = converter.convert(null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { EmailList list = new EmailList(); List<ElectronicMail> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@T... |
TreatmentApplicator implements Treatment { @Override public Entity apply(Entity entity) { Entity treated = entity; for (Treatment treatment : treatments) { treated = treatment.apply(treated); } return treated; } @Override Entity apply(Entity entity); List<Treatment> getTreatments(); void setTreatments(List<Treatment> ... | @Test public void testApplyAll() { Entity student = Mockito.mock(Entity.class); applicator.apply(student); Mockito.verify(treatment1,Mockito.atLeast(1)).apply(Mockito.any(Entity.class)); Mockito.verify(treatment2,Mockito.atLeast(1)).apply(Mockito.any(Entity.class)); } |
DemographicsToBirthDataConverter { public BirthData convert(Demographics sifDemographics) { if (sifDemographics == null) { return null; } BirthData sliBirthData = new BirthData(); sliBirthData.setCountryOfBirthCode(sifDemographics.getCountryOfBirth()); sliBirthData.setCityOfBirth(sifDemographics.getPlaceOfBirth()); if ... | @Test public void nullNameShouldReturnNull() { openadk.library.common.Demographics sifDemographics = null; BirthData sliName = converter.convert(sifDemographics); Assert.assertNull(sliName); }
@Test public void emptySifDemographicShouldMapToNullBirthDataValues() { openadk.library.common.Demographics sifDemographics = n... |
EntryTypeConverter { public String convert(EntryType entryType) { if (entryType == null) { return null; } return toSliEntryType(EntryTypeCode.wrap(entryType.getCode())); } String convert(EntryType entryType); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Entry Type should be null", result); }
@Test public void testMappings() { Assert.assertEquals(converter.convert(getEntryType(EntryTypeCode._0619_1821)), "Transfer from a public school in the same local education agency"); A... |
AddressListConverter { public List<Address> convert(AddressList addressList) { if (addressList == null) { return null; } return toSliAddressList(addressList.getAddresses()); } List<Address> convert(AddressList addressList); List<Address> convert(StudentAddressList addressList); } | @Test public void testNullObject() { List<Address> result = converter.convert((AddressList) null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { AddressList list = new AddressList(); List<Address> result = converter.convert(list); Assert.assertEquals(0, result.size()); ... |
AttendanceTreatment implements Treatment { @Override public Entity apply(Entity entity) { if (entity.getBody().containsKey("schoolYearAttendance")) { LOG.debug("Treatment has already been applied to attendance entity: {}", new Object[] { entity.getEntityId() }); return entity; } Map<String,Object> treated = AttendanceS... | @Test public void testApply() { Map<String, Object> body = new HashMap<String, Object>(); body.put("schoolYear", "schoolYear"); List<Map<String,Object>> attendanceEvent = new ArrayList<Map<String,Object>>(); body.put("attendanceEvent", attendanceEvent); Entity entity = new BulkExtractEntity(body, "student"); Entity tre... |
PhoneNumberListConverter { public List<InstitutionTelephone> convertInstitutionTelephone(PhoneNumberList phoneNumberList) { if (phoneNumberList == null) { return null; } return toSliInstitutionTelephoneList(phoneNumberList.getPhoneNumbers()); } List<InstitutionTelephone> convertInstitutionTelephone(PhoneNumberList pho... | @Test public void testNullObject() { List<InstitutionTelephone> result = converter.convertInstitutionTelephone(null); Assert.assertNull("Telephone list should be null", result); }
@Test public void testEmptyList() { PhoneNumberList list = new PhoneNumberList(); list.setPhoneNumbers(new PhoneNumber[0]); List<Institution... |
RaceListConverter { public List<String> convert(RaceList raceList) { if (raceList == null) { return null; } return toSliRaceList(raceList.getRaces()); } List<String> convert(RaceList raceList); } | @Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assertNull("Race list should be null", result); }
@Test public void testEmptyList() { RaceList list = new RaceList(); List<String> result = converter.convert(list); Assert.assertEquals(0, result.size()); }
@Test public void testC... |
GradeLevelsConverter { public List<String> convert(GradeLevels source) { if (source == null) { return null; } return toSliGradeList(source.getGradeLevels()); } List<String> convert(GradeLevels source); String convert(GradeLevel source); } | @Test public void testNullObject() { List<String> result = converter.convert((GradeLevels) null); Assert.assertNull("Grade levels list should be null", result); }
@Test public void testEmptyList() { GradeLevels list = new GradeLevels(); list.setGradeLevels(new GradeLevel[0]); List<String> result = converter.convert(lis... |
OtherNamesConverter { public List<OtherName> convert(OtherNames sifOtherNames) { if (sifOtherNames == null) { return null; } List<OtherName> sliNames = new ArrayList<OtherName>(); for (openadk.library.common.Name sifName : sifOtherNames) { OtherName sliName = new OtherName(); nameConverter.mapSifNameIntoSliName(sifName... | @Test public void testNullObject() { OtherNames sifOtherNames = null; List<OtherName> result = converter.convert(sifOtherNames); Assert.assertNull("OtherName list should be null", result); }
@Test public void testEmptyList() { OtherNames sifOtherNames = new OtherNames(); List<OtherName> result = converter.convert(sifOt... |
ExitTypeConverter { public String convert(ExitType exitType) { if (exitType == null) { return null; } return toSliExitType(ExitTypeCode.wrap(exitType.getCode())); } String convert(ExitType exitType); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Entry Type should be null", result); }
@Test public void testMappings() { Assert.assertEquals(converter.convert(getExitType(ExitTypeCode._1907_TRANSFERRED_IN_LEA)), "Student is in a different public school in the same local... |
EnglishProficiencyConverter { public String convert(EnglishProficiency ep) { if (ep == null) { return null; } EnglishProficiencyCode code = EnglishProficiencyCode.wrap(ep.getCode()); return ENGLISH_PROFICIENCY_MAP.get(code); } String convert(EnglishProficiency ep); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("English Proficiency should be null", result); }
@Test public void testNativeEnglish() { EnglishProficiency ep = new EnglishProficiency(); ep.setCode(EnglishProficiencyCode.NATIVE_ENGLISH); String result = converter.convert(... |
SimpleExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { String entityDate = EntityDateHelper.retrieveDate(entity); return EntityDateHelper.isPastOrCurrentDate(entityDate, upToDate, entity.getType()); } @Override boolean shouldExtract(Entity entity, ... | @Test public void testShouldExtract() { Map<String, Object> body = new HashMap<String, Object>(); body.put(ParameterConstants.BEGIN_DATE, "01-01-01"); Entity studentProgramAssociation = new MongoEntity(EntityNames.STUDENT_PROGRAM_ASSOCIATION, body); Assert.assertTrue( "01-01-01",simpleExtractVerifier.shouldExtract(stud... |
SchoolYearConverter { public String convert(Integer schoolYear) { if (schoolYear == null) { return null; } Integer priorSchoolYear = schoolYear - 1; return priorSchoolYear.toString() + "-" + schoolYear.toString(); } String convert(Integer schoolYear); } | @Test public void testNullList() { String result = converter.convert(null); Assert.assertNull("school year should be null", result); }
@Test public void test() { Assert.assertEquals(converter.convert(2011), "2010-2011"); Assert.assertEquals(converter.convert(2013), "2012-2013"); } |
NameConverter { public Name convert(openadk.library.common.Name sifName) { if (sifName == null) { return null; } Name sliName = new Name(); mapSifNameIntoSliName(sifName, sliName); return sliName; } Name convert(openadk.library.common.Name sifName); void mapSifNameIntoSliName(openadk.library.common.Name sifName, Name ... | @Test public void nullNameShouldReturnNull() { openadk.library.common.Name sifName = null; Name sliName = converter.convert(sifName); Assert.assertNull(sliName); }
@Test public void emptySifNameShouldMapToNullAndDefaultValues() { openadk.library.common.Name sifName = new openadk.library.common.Name(); Name sliName = co... |
HRProgramTypeConverter { public String convert(HRProgramType hrProgramType) { if (hrProgramType == null) { return null; } return toSliProgramAssignment(ProgramTypeCode.wrap(hrProgramType.getCode())); } String convert(HRProgramType hrProgramType); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Teaching Assignment list should be null", result); }
@Test public void testMappings() { map.clear(); map.put(ProgramTypeCode.ADULT_BASIC_EDUCATION, "Title I-Non-Academic"); map.put(ProgramTypeCode.ADULT_CONTINUING_EDUCATION... |
GenderConverter { public String convert(String gender) { return GENDER_TYPE_MAP.get(gender); } String convert(String gender); } | @Test public void testNullObject() { String result = converter.convert(null); Assert.assertNull("Race list should be null", result); }
@Test public void testMale() { String result = converter.convert("M"); Assert.assertEquals("Male", result); }
@Test public void testFemale() { String result = converter.convert("F"); As... |
OperationalStatusConverter { public String convert(OperationalStatus operationalStatus) { if (operationalStatus == null || operationalStatus.getValue() == null || operationalStatus.getValue().isEmpty()) { return null; } return OPERATIONAL_STATUS_MAP.get(operationalStatus); } String convert(OperationalStatus operationa... | @Test public void testNull() { String result = converter.convert(null); Assert.assertNull("Operational status should be null", result); }
@Test public void testEmpty() { OperationalStatus status = OperationalStatus.wrap(""); String result = converter.convert(status); Assert.assertNull("Operational status should be null... |
SchoolLevelTypeConverter { public String convert(SchoolLevelType schoolLevelType) { if (schoolLevelType == null) { return null; } return SCHOOL_LEVEL_TYPE_MAP.get(schoolLevelType); } String convert(SchoolLevelType schoolLevelType); List<String> convertAsList(SchoolLevelType schoolLevelType); } | @Test public void testNull() { String result = converter.convert(null); Assert.assertNull("School category should be null", result); }
@Test public void testEmpty() { SchoolLevelType type = SchoolLevelType.wrap(""); String result = converter.convert(type); Assert.assertNull(result); } |
SchoolLevelTypeConverter { public List<String> convertAsList(SchoolLevelType schoolLevelType) { if (schoolLevelType == null) { return null; } ArrayList<String> list = new ArrayList<String>(); String category = SCHOOL_LEVEL_TYPE_MAP.get(schoolLevelType); if (category != null) { list.add(category); } return list; } Stri... | @Test public void testListNull() { List<String> result = converter.convertAsList(null); Assert.assertNull("School category should be null", result); }
@Test public void testListEmpty() { SchoolLevelType type = SchoolLevelType.wrap(""); List<String> result = converter.convertAsList(type); Assert.assertEquals(0, result.s... |
HrOtherIdListConverter { public List<StaffIdentificationCode> convert(HrOtherIdList hrOtherIdList) { if (hrOtherIdList == null) { return null; } return toSliStaffIdentificationCodeList(hrOtherIdList.getOtherIds()); } List<StaffIdentificationCode> convert(HrOtherIdList hrOtherIdList); List<StaffIdentificationCode> conv... | @Test public void testNullObject() { List<StaffIdentificationCode> result = converter.convert((HrOtherIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result); result = converter.convert((OtherIdList) null); Assert.assertNull("StaffIdentificationCode list should be null", result); }
@Test... |
LanguageListConverter { public List<String> convert(LanguageList languageList) { if (languageList == null) { return null; } return toSliLanguageList(languageList.getLanguages()); } List<String> convert(LanguageList languageList); } | @Test public void testNullObject() { List<String> result = converter.convert(null); Assert.assertNull("Address list should be null", result); }
@Test public void testEmptyList() { List<String> result = converter.convert(new LanguageList()); Assert.assertEquals(0, result.size()); }
@Test public void testEmptyLanguage() ... |
TeacherSchoolAssociationExtractVerifier implements ExtractVerifier { @Override public boolean shouldExtract(Entity entity, DateTime upToDate) { Iterable<Entity> seaos = edOrgExtractHelper.retrieveSEOAS((String) entity.getBody().get(ParameterConstants.TEACHER_ID), (String) entity.getBody().get(ParameterConstants.SCHOOL_... | @Test public void testSholdExtractEntities() { List<Entity> seaos = new ArrayList<Entity>(); Map<String, Object> body = new HashMap<String, Object>(); body.put(ParameterConstants.BEGIN_DATE, "2001-05-24"); Entity entity1 = new MongoEntity(EntityNames.STUDENT_PROGRAM_ASSOCIATION, body); Map<String, Object> body2 = new H... |
MockZis { public String createAckString() { SIF_Message message = new SIF_Message(); SIF_Ack ack = message.ackStatus(0); return sifElementToString(ack); } void parseSIFMessage(String sifString); void broadcastMessage(String xmlMessage); @PostConstruct void setup(); String createAckString(); void getAgentUrls(Set<Strin... | @Test public void shouldCreateAckMessages() throws ADKException, IOException { String ackString = mockZis.createAckString(); SIFParser parser = SIFParser.newInstance(); SIFElement sifElem = parser.parse(ackString); Assert.assertTrue("Should create a SIF message", (sifElem instanceof SIF_Ack)); } |
CustomEventGenerator { public static Event generateEvent(String messageFile, EventAction eventAction) { FileReader in = null; Event event = null; try { SIFParser p = SIFParser.newInstance(); in = new FileReader(messageFile); StringBuffer xml = new StringBuffer(); int bufSize = 4096; char[] buf = new char[bufSize]; whil... | @Test public void testGenerateStudentPersonalDefaultEvent() throws ADKException { String messageFile = getPathForFile("/element_xml/StudentPersonal.xml"); Event studentPersonalEvent = CustomEventGenerator.generateEvent(messageFile, EventAction.ADD); EventAction eventAction = studentPersonalEvent.getAction(); Assert.ass... |
SifEntityGenerator { public static SchoolInfo generateTestSchoolInfo() { SchoolInfo info = new SchoolInfo(); info.setRefId(TEST_SCHOOLINFO_REFID); info.setStateProvinceId("Daybreak West High"); info.setNCESId("421575003045"); info.setSchoolName("Daybreak West High"); info.setLEAInfoRefId(TEST_LEAINFO_REFID); SchoolFocu... | @Test public void testGenerateTestSchoolInfo() { SchoolInfo schoolInfo = SifEntityGenerator.generateTestSchoolInfo(); Assert.assertEquals(SifEntityGenerator.TEST_SCHOOLINFO_REFID, schoolInfo.getRefId()); Assert.assertEquals("Daybreak West High", schoolInfo.getStateProvinceId()); Assert.assertEquals("421575003045", scho... |
SifEntityGenerator { public static LEAInfo generateTestLEAInfo() { LEAInfo info = new LEAInfo(); info.setRefId(TEST_LEAINFO_REFID); info.setStateProvinceId("IL-DAYBREAK"); info.setNCESId("4215750"); info.setLEAName("Daybreak School District 4530"); info.setLEAURL("http: info.setEducationAgencyType(EducationAgencyTypeCo... | @Test public void testGenerateTestLeaInfo() { LEAInfo leaInfo = SifEntityGenerator.generateTestLEAInfo(); Assert.assertEquals(SifEntityGenerator.TEST_LEAINFO_REFID, leaInfo.getRefId()); Assert.assertEquals("IL-DAYBREAK", leaInfo.getStateProvinceId()); Assert.assertEquals("4215750", leaInfo.getNCESId()); Assert.assertEq... |
SifEntityGenerator { public static SEAInfo generateTestSEAInfo() { SEAInfo info = new SEAInfo(); info.setRefId(TEST_SEAINFO_REFID); info.setSEAName("Illinois State Board of Education"); info.setSEAURL("http: Address address = new Address(); address.setCity("Salt Lake City"); address.setStateProvince(StatePrCode.IL); ad... | @Test public void testGenerateTestSeaInfo() { SEAInfo seaInfo = SifEntityGenerator.generateTestSEAInfo(); Assert.assertEquals(SifEntityGenerator.TEST_SEAINFO_REFID, seaInfo.getRefId()); Assert.assertEquals("Illinois State Board of Education", seaInfo.getSEAName()); Assert.assertEquals("http: AddressList addressList = s... |
SifEntityGenerator { public static StudentSchoolEnrollment generateTestStudentSchoolEnrollment() { StudentSchoolEnrollment retVal = new StudentSchoolEnrollment(); retVal.setRefId(TEST_STUDENTSCHOOLENROLLMENT_REFID); retVal.setSchoolInfoRefId(TEST_SCHOOLINFO_REFID); retVal.setStudentPersonalRefId(TEST_STUDENTPERSONAL_RE... | @Test public void testGenerateTestStudentSchoolEnrollment() { StudentSchoolEnrollment studentSchoolEnrollment = SifEntityGenerator.generateTestStudentSchoolEnrollment(); Assert.assertEquals(SifEntityGenerator.TEST_STUDENTSCHOOLENROLLMENT_REFID, studentSchoolEnrollment.getRefId()); Assert.assertEquals(SifEntityGenerator... |
SifEntityGenerator { public static StudentLEARelationship generateTestStudentLeaRelationship() { StudentLEARelationship retVal = new StudentLEARelationship(); retVal.setRefId(TEST_STUDENTLEARELATIONSHIP_REFID); retVal.setStudentPersonalRefId(TEST_STUDENTPERSONAL_REFID); retVal.setLEAInfoRefId(TEST_LEAINFO_REFID); retVa... | @Test public void testGenerateTestStudentLeaRelationship() { StudentLEARelationship studentLeaRelationship = SifEntityGenerator.generateTestStudentLeaRelationship(); Assert.assertEquals(SifEntityGenerator.TEST_STUDENTLEARELATIONSHIP_REFID, studentLeaRelationship.getRefId()); Assert.assertEquals(SifEntityGenerator.TEST_... |
SifEntityGenerator { public static StudentPersonal generateTestStudentPersonal() { StudentPersonal studentPersonal = new StudentPersonal(); studentPersonal.setRefId(TEST_STUDENTPERSONAL_REFID); studentPersonal.setStateProvinceId("IL-DAYBREAK-54321"); Name name = new Name(NameType.NAME_OF_RECORD, "Smith", "Joe"); name.s... | @Test public void testGenerateTestStudentPersonal() { StudentPersonal studentPersonal = SifEntityGenerator.generateTestStudentPersonal(); Assert.assertEquals(SifEntityGenerator.TEST_STUDENTPERSONAL_REFID, studentPersonal.getRefId()); Assert.assertEquals("1982", studentPersonal.getGraduationDate().getValue()); Assert.as... |
SifEntityGenerator { public static StaffPersonal generateTestStaffPersonal() { StaffPersonal staffPersonal = new StaffPersonal(); staffPersonal.setRefId(TEST_STAFFPERSONAL_REFID); staffPersonal.setEmployeePersonalRefId(TEST_EMPLOYEEPERSONAL_REFID); staffPersonal.setLocalId("946379881"); staffPersonal.setStateProvinceId... | @Test public void testGenerateTestStaffPersonal() { StaffPersonal staffPersonal = SifEntityGenerator.generateTestStaffPersonal(); Assert.assertEquals(SifEntityGenerator.TEST_STAFFPERSONAL_REFID, staffPersonal.getRefId()); Assert.assertEquals(SifEntityGenerator.TEST_EMPLOYEEPERSONAL_REFID, staffPersonal.getEmployeePerso... |
SifEntityGenerator { public static EmployeePersonal generateTestEmployeePersonal() { EmployeePersonal employeePersonal = new EmployeePersonal(); employeePersonal.setRefId(TEST_EMPLOYEEPERSONAL_REFID); employeePersonal.setStateProvinceId("C2345681"); OtherId otherId1 = new OtherId(OtherIdType.SOCIALSECURITY, "333333333"... | @Test public void testGenerateTestEmployeePersonal() { EmployeePersonal employeePersonal = SifEntityGenerator.generateTestEmployeePersonal(); Assert.assertEquals(SifEntityGenerator.TEST_EMPLOYEEPERSONAL_REFID, employeePersonal.getRefId()); HrOtherIdList hrOtherIdList = employeePersonal.getOtherIdList(); Assert.assertEq... |
SifEntityGenerator { public static StaffAssignment generateTestStaffAssignment() { StaffAssignment staffAssignment = new StaffAssignment(); staffAssignment.setRefId(TEST_STAFFASSIGNMENT_REFID); staffAssignment.setSchoolInfoRefId(TEST_SCHOOLINFO_REFID); staffAssignment.setStaffPersonalRefId(TEST_STAFFPERSONAL_REFID); st... | @Test public void testGenerateTestStaffAssignment() { StaffAssignment staffAssignment = SifEntityGenerator.generateTestStaffAssignment(); Assert.assertEquals(SifEntityGenerator.TEST_STAFFASSIGNMENT_REFID, staffAssignment.getRefId()); Assert.assertEquals(SifEntityGenerator.TEST_SCHOOLINFO_REFID, staffAssignment.getSchoo... |
SifEntityGenerator { public static EmploymentRecord generateTestEmploymentRecord() { EmploymentRecord employmentRecord = new EmploymentRecord(); employmentRecord.setRefId(TEST_EMPLOYMENTRECORD_REFID); employmentRecord.setSIF_RefId(TEST_STAFFPERSONAL_REFID); employmentRecord.setSIF_RefObject("StaffPersonal"); employment... | @Test public void testGenerateTestEmploymentRecord() { EmploymentRecord employmentRecord = SifEntityGenerator.generateTestEmploymentRecord(); Assert.assertEquals(SifEntityGenerator.TEST_EMPLOYMENTRECORD_REFID, employmentRecord.getRefId()); Assert.assertEquals(SifEntityGenerator.TEST_STAFFPERSONAL_REFID, employmentRecor... |
SifEntityGenerator { public static EmployeeAssignment generateTestEmployeeAssignment() { EmployeeAssignment employeeAssignment = new EmployeeAssignment(); employeeAssignment.setRefId(TEST_EMPLOYEEASSIGNMENT_REFID); employeeAssignment.setEmployeePersonalRefId(TEST_EMPLOYEEPERSONAL_REFID); employeeAssignment.setDescripti... | @Test public void testGenerateTestEmployeeAssignment() { EmployeeAssignment employeeAssignment = SifEntityGenerator.generateTestEmployeeAssignment(); Assert.assertEquals(SifEntityGenerator.TEST_EMPLOYEEASSIGNMENT_REFID, employeeAssignment.getRefId()); Assert.assertEquals(SifEntityGenerator.TEST_EMPLOYEEPERSONAL_REFID, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.