@Test public void testReadJsonManifestNoAttributeValue() throws IOException { UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto(); HashMap<String, String> attributes = new HashMap<>(); uploaderInputManifestDto.setAttributes(attributes); attributes.put(ATTRIBUTE_NAME_1_MIXED_CASE, null); attributes.put(ATTRIBUTE_NAME_2_MIXED_CASE, ""); attributes.put(ATTRIBUTE_NAME_3_MIXED_CASE, BLANK_TEXT); UploaderInputManifestDto resultManifest = uploaderManifestReader.readJsonManifest(createManifestFile(LOCAL_TEMP_PATH_INPUT.toString(), uploaderInputManifestDto)); // Validate the results. assertUploaderManifest(uploaderInputManifestDto, resultManifest); assertEquals(attributes.size(), resultManifest.getAttributes().size()); assertEquals(null, resultManifest.getAttributes().get(ATTRIBUTE_NAME_1_MIXED_CASE)); assertEquals("", resultManifest.getAttributes().get(ATTRIBUTE_NAME_2_MIXED_CASE)); assertEquals(BLANK_TEXT, resultManifest.getAttributes().get(ATTRIBUTE_NAME_3_MIXED_CASE)); }
if (manifest.getAttributes() != null) for (Map.Entry<String, String> entry : manifest.getAttributes().entrySet())
if (manifest.getAttributes() != null) for (Map.Entry<String, String> entry : manifest.getAttributes().entrySet())
if (manifest.getAttributes() != null) for (Map.Entry<String, String> entry : manifest.getAttributes().entrySet())
uploaderInputManifestDto.getAttributes().put(BLANK_TEXT, ATTRIBUTE_VALUE_1); try
/** * Validates an uploader input manifest instance. * * @param expectedUploaderInputManifest the expected uploader input manifest instance * @param actualUploaderInputManifest the actual instance of the uploader input manifest to be validated */ private void assertUploaderManifest(UploaderInputManifestDto expectedUploaderInputManifest, UploaderInputManifestDto actualUploaderInputManifest) { // Validate all regular fields. assertEquals(expectedUploaderInputManifest.getBusinessObjectDefinitionName(), actualUploaderInputManifest.getBusinessObjectDefinitionName()); assertEquals(expectedUploaderInputManifest.getBusinessObjectFormatUsage(), actualUploaderInputManifest.getBusinessObjectFormatUsage()); assertEquals(expectedUploaderInputManifest.getBusinessObjectFormatFileType(), actualUploaderInputManifest.getBusinessObjectFormatFileType()); assertEquals(expectedUploaderInputManifest.getBusinessObjectFormatVersion(), actualUploaderInputManifest.getBusinessObjectFormatVersion()); assertEquals(expectedUploaderInputManifest.getPartitionKey(), actualUploaderInputManifest.getPartitionKey()); assertEquals(expectedUploaderInputManifest.getPartitionValue(), actualUploaderInputManifest.getPartitionValue()); // Validate the files by comparing two file list ignoring the order. assertTrue(expectedUploaderInputManifest.getManifestFiles().containsAll(actualUploaderInputManifest.getManifestFiles())); assertTrue(actualUploaderInputManifest.getManifestFiles().containsAll(expectedUploaderInputManifest.getManifestFiles())); // Validate the attributes. assertEquals(expectedUploaderInputManifest.getAttributes(), actualUploaderInputManifest.getAttributes()); // Validate the business object data parents. assertEquals(expectedUploaderInputManifest.getBusinessObjectDataParents(), actualUploaderInputManifest.getBusinessObjectDataParents()); } }