diff --git a/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java b/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java index 311779450e..dbb1cbb82f 100644 --- a/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java +++ b/src/main/java/org/alfresco/rest/model/FilePlanComponentProperties.java @@ -27,14 +27,10 @@ import org.springframework.stereotype.Component; * @author Kristijan Conkas * @since 1.0 */ -@Component -@Scope(value = "prototype") //FIXME: Once the fields have been added the JsonIgnoreProperties annotation should be removed @JsonIgnoreProperties(ignoreUnknown = true) public class FilePlanComponentProperties { - // TODO: handling individual properties is tedious and error prone, how about @JsonGetter + @JsonSetter? - @JsonProperty(PROPERTIES_VITAL_RECORD_INDICATOR) private boolean vitalRecord; diff --git a/src/test/java/org/alfresco/rest/fileplancomponents/RecordCategoryTest.java b/src/test/java/org/alfresco/rest/fileplancomponents/RecordCategoryTest.java index c891226235..8b74076d36 100644 --- a/src/test/java/org/alfresco/rest/fileplancomponents/RecordCategoryTest.java +++ b/src/test/java/org/alfresco/rest/fileplancomponents/RecordCategoryTest.java @@ -27,9 +27,11 @@ import static org.springframework.http.HttpStatus.OK; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; import java.util.ArrayList; import java.util.List; +import java.util.NoSuchElementException; import com.google.gson.JsonObject; @@ -210,6 +212,7 @@ public class RecordCategoryTest extends BaseRestTest // create subcategory as a child of rootCategory FilePlanComponent childCategory = createCategory(rootCategory.getId(), RandomData.getRandomAlphanumeric()); + // child category created? assertNotNull(childCategory.getId()); } @@ -250,12 +253,31 @@ public class RecordCategoryTest extends BaseRestTest FilePlanComponentsCollection apiChildren = filePlanComponentApi.listChildComponents(rootCategory.getId()); restWrapper.assertStatusCodeIs(OK); + // check listed children against created list List childrenApi = apiChildren.getEntries(); - childrenApi.forEach(c -> { - //assertNotNull(c.getId()); - + childrenApi.forEach(c -> + { FilePlanComponent filePlanComponent = c.getFilePlanComponent(); + assertNotNull(filePlanComponent.getId()); + logger.info(c + " id=" + filePlanComponent.getId() + " name=" + filePlanComponent.getName() + " properties=" + filePlanComponent.getProperties()); + + try + { + FilePlanComponent createdComponent = children.stream() + .filter(child -> child.getId().compareTo(filePlanComponent.getId()) == 0) + .findFirst() + .get(); + + // does returned object have the same contents as the created one? + assertEquals(createdComponent.getName(), filePlanComponent.getName()); + assertEquals(createdComponent.getNodeType(), filePlanComponent.getNodeType()); + assertEquals(createdComponent.getProperties().getTitle(), filePlanComponent.getProperties().getTitle()); + } + catch (NoSuchElementException e) + { + fail("No child element for " + filePlanComponent.getId()); + } }); }