@SuppressWarnings("unchecked") @Test public void testAssessmentMapping() { NeutralRecord assessment = createAssessmentNeutralRecord(false); ReportStats reportStats = new SimpleReportStats(); List<? extends Entity> result = transformer.transform(assessment, new DummyMessageReport(), reportStats); Assert.assertNotNull(result); Assert.assertEquals(1, result.size()); Assert.assertEquals("assessmentTitle", result.get(0).getBody().get("assessmentTitle")); Assert.assertEquals(ASSESSMENT_FAMILY_ID, result.get(0).getBody().get("assessmentFamilyReference")); List<Map<String, Object>> assessmentIDCodeList = (List<Map<String, Object>>) result.get(0) .getBody().get("assessmentIdentificationCode"); Assert.assertNotNull(assessmentIDCodeList); Assert.assertEquals(2, assessmentIDCodeList.size()); Map<String, Object> assessmentIDCode1 = assessmentIDCodeList.get(0); Assert.assertNotNull(assessmentIDCode1); Assert.assertEquals("202A1", assessmentIDCode1.get("ID")); Assert.assertEquals("School", assessmentIDCode1.get("identificationSystem")); Assert.assertEquals("assigningOrganizationCode", assessmentIDCode1.get("assigningOrganizationCode")); Map<String, Object> assessmentIDCode2 = assessmentIDCodeList.get(1); Assert.assertNotNull(assessmentIDCode2); Assert.assertEquals("303A1", assessmentIDCode2.get("ID")); Assert.assertEquals("State", assessmentIDCode2.get("identificationSystem")); Assert.assertEquals("assigningOrganizationCode2", assessmentIDCode2.get("assigningOrganizationCode")); List<Map<String, Object>> assessmentPerfLevelList = (List<Map<String, Object>>) result .get(0).getBody().get("assessmentPerformanceLevel"); Assert.assertNotNull(assessmentPerfLevelList); Assert.assertEquals(2, assessmentPerfLevelList.size()); Map<String, Object> assessmentPerfLevel1 = assessmentPerfLevelList.get(0); Assert.assertNotNull(assessmentPerfLevel1); Assert.assertEquals(2400, assessmentPerfLevel1.get("maximumScore")); Assert.assertEquals(1600, assessmentPerfLevel1.get("minimumScore")); Assert.assertEquals("C-scaled scores", assessmentPerfLevel1.get("assessmentReportingMethod")); List<Map<String, Object>> perfLevelDescriptor1 = (List<Map<String, Object>>) assessmentPerfLevel1 .get("performanceLevelDescriptor"); Assert.assertEquals("description1", perfLevelDescriptor1.get(0).get("description")); Map<String, Object> assessmentPerfLevel2 = assessmentPerfLevelList.get(1); Assert.assertNotNull(assessmentPerfLevel2); Assert.assertEquals(2600, assessmentPerfLevel2.get("maximumScore")); Assert.assertEquals(1800, assessmentPerfLevel2.get("minimumScore")); Assert.assertEquals("ACT score", assessmentPerfLevel2.get("assessmentReportingMethod")); List<Map<String, Object>> perfLevelDescriptor2 = (List<Map<String, Object>>) assessmentPerfLevel2 .get("performanceLevelDescriptor"); Assert.assertEquals("description2", perfLevelDescriptor2.get(0).get("description")); Assert.assertEquals("Achievement test", result.get(0).getBody().get("assessmentCategory")); Assert.assertEquals("English", result.get(0).getBody().get("academicSubject")); Assert.assertEquals("Adult Education", result.get(0).getBody().get("gradeLevelAssessed")); Assert.assertEquals("Early Education", result.get(0).getBody().get("lowestGradeLevelAssessed")); Assert.assertEquals("SAT", result.get(0).getBody().get("contentStandard")); Assert.assertEquals("assessmentForm", result.get(0).getBody().get("assessmentForm")); Assert.assertEquals(1, result.get(0).getBody().get("version")); Assert.assertEquals("1999-01-01", result.get(0).getBody().get("revisionDate")); Assert.assertEquals(2400, result.get(0).getBody().get("maxRawScore")); Assert.assertEquals("nomenclature", result.get(0).getBody().get("nomenclature")); }
@Override public List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats) { JavaResult result = new JavaResult(); Smooks smooks = smooksConfigs.get(item.getRecordType()); if (smooks == null) { String type = item.getRecordType().replaceAll("_transformed", ""); Map<String, Object> body = item.getAttributes(); SimpleEntity entity = new SimpleEntity(); entity.setType(type); entity.setBody(body); entity.setStagedEntityId(item.getRecordId()); entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } String externalId = (String) item.getLocalId(); if (externalId != null) { entity.getMetaData().put("externalId", externalId); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); return Arrays.asList(entity); } List<SimpleEntity> sliEntities; try { StringSource source = new StringSource(MAPPER.writeValueAsString(item)); smooks.filterSource(source, result); sliEntities = getEntityListResult(result); for (SimpleEntity entity : sliEntities) { entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); } } catch (java.io.IOException e) { sliEntities = Collections.emptyList(); } return sliEntities; }
SmooksEdFi2SLITransformer extends EdFi2SLITransformer { @Override public List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats) { JavaResult result = new JavaResult(); Smooks smooks = smooksConfigs.get(item.getRecordType()); if (smooks == null) { String type = item.getRecordType().replaceAll("_transformed", ""); Map<String, Object> body = item.getAttributes(); SimpleEntity entity = new SimpleEntity(); entity.setType(type); entity.setBody(body); entity.setStagedEntityId(item.getRecordId()); entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } String externalId = (String) item.getLocalId(); if (externalId != null) { entity.getMetaData().put("externalId", externalId); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); return Arrays.asList(entity); } List<SimpleEntity> sliEntities; try { StringSource source = new StringSource(MAPPER.writeValueAsString(item)); smooks.filterSource(source, result); sliEntities = getEntityListResult(result); for (SimpleEntity entity : sliEntities) { entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); } } catch (java.io.IOException e) { sliEntities = Collections.emptyList(); } return sliEntities; } }
SmooksEdFi2SLITransformer extends EdFi2SLITransformer { @Override public List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats) { JavaResult result = new JavaResult(); Smooks smooks = smooksConfigs.get(item.getRecordType()); if (smooks == null) { String type = item.getRecordType().replaceAll("_transformed", ""); Map<String, Object> body = item.getAttributes(); SimpleEntity entity = new SimpleEntity(); entity.setType(type); entity.setBody(body); entity.setStagedEntityId(item.getRecordId()); entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } String externalId = (String) item.getLocalId(); if (externalId != null) { entity.getMetaData().put("externalId", externalId); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); return Arrays.asList(entity); } List<SimpleEntity> sliEntities; try { StringSource source = new StringSource(MAPPER.writeValueAsString(item)); smooks.filterSource(source, result); sliEntities = getEntityListResult(result); for (SimpleEntity entity : sliEntities) { entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); } } catch (java.io.IOException e) { sliEntities = Collections.emptyList(); } return sliEntities; }  }
SmooksEdFi2SLITransformer extends EdFi2SLITransformer { @Override public List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats) { JavaResult result = new JavaResult(); Smooks smooks = smooksConfigs.get(item.getRecordType()); if (smooks == null) { String type = item.getRecordType().replaceAll("_transformed", ""); Map<String, Object> body = item.getAttributes(); SimpleEntity entity = new SimpleEntity(); entity.setType(type); entity.setBody(body); entity.setStagedEntityId(item.getRecordId()); entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } String externalId = (String) item.getLocalId(); if (externalId != null) { entity.getMetaData().put("externalId", externalId); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); return Arrays.asList(entity); } List<SimpleEntity> sliEntities; try { StringSource source = new StringSource(MAPPER.writeValueAsString(item)); smooks.filterSource(source, result); sliEntities = getEntityListResult(result); for (SimpleEntity entity : sliEntities) { entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); } } catch (java.io.IOException e) { sliEntities = Collections.emptyList(); } return sliEntities; }  @Override List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats); Map<String, Smooks> getSmooksConfigs(); void setSmooksConfigs(Map<String, Smooks> smooksConfigs); @Override List<List<SimpleEntity>> handle(List<NeutralRecord> items, AbstractMessageReport report,
            ReportStats reportStats); @Override String getStageName(); }
SmooksEdFi2SLITransformer extends EdFi2SLITransformer { @Override public List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats) { JavaResult result = new JavaResult(); Smooks smooks = smooksConfigs.get(item.getRecordType()); if (smooks == null) { String type = item.getRecordType().replaceAll("_transformed", ""); Map<String, Object> body = item.getAttributes(); SimpleEntity entity = new SimpleEntity(); entity.setType(type); entity.setBody(body); entity.setStagedEntityId(item.getRecordId()); entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } String externalId = (String) item.getLocalId(); if (externalId != null) { entity.getMetaData().put("externalId", externalId); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); return Arrays.asList(entity); } List<SimpleEntity> sliEntities; try { StringSource source = new StringSource(MAPPER.writeValueAsString(item)); smooks.filterSource(source, result); sliEntities = getEntityListResult(result); for (SimpleEntity entity : sliEntities) { entity.setSourceFile(item.getSourceFile()); entity.setVisitBeforeLineNumber(item.getVisitBeforeLineNumber()); entity.setVisitBeforeColumnNumber(item.getVisitBeforeColumnNumber()); entity.setVisitAfterLineNumber(item.getVisitAfterLineNumber()); entity.setVisitAfterColumnNumber(item.getVisitAfterColumnNumber()); if (entity.getMetaData() == null) { entity.setMetaData(new HashMap<String, Object>()); } entity.setAction( item.getActionVerb()); entity.setActionAttributes(item.getActionAttributes()); } } catch (java.io.IOException e) { sliEntities = Collections.emptyList(); } return sliEntities; }  @Override List<SimpleEntity> transform(NeutralRecord item, AbstractMessageReport report, ReportStats reportStats); Map<String, Smooks> getSmooksConfigs(); void setSmooksConfigs(Map<String, Smooks> smooksConfigs); @Override List<List<SimpleEntity>> handle(List<NeutralRecord> items, AbstractMessageReport report,
            ReportStats reportStats); @Override String getStageName();  }