/** The known resource id. */
private String knownResourceId = null;
+
+ private final static String TIMESTAMP_UTC = GregorianCalendarDateTimeUtils.timestampUTC();
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
MovementsCommon movement = (MovementsCommon) extractPart(input,
client.getCommonPartName(), MovementsCommon.class);
Assert.assertNotNull(movement);
+
+ // Check the values of one or more date/time fields
+ if (logger.isDebugEnabled()) {
+ logger.debug("locationDate=" + movement.getLocationDate());
+ logger.debug("TIMESTAMP_UTC=" + TIMESTAMP_UTC);
+ }
+ Assert.assertTrue(movement.getLocationDate().equals(TIMESTAMP_UTC));
+ Assert.assertTrue(movement.getPlannedRemovalDate().equals(TIMESTAMP_UTC));
+ Assert.assertTrue(movement.getRemovalDate().equals(TIMESTAMP_UTC));
}
// Failure outcomes
*/
private MultipartOutput createInstance(String movementReferenceNumber) {
MovementsCommon movement = new MovementsCommon();
- String timestampUTC = GregorianCalendarDateTimeUtils.timestampUTC();
// FIXME: Values of currentLocation, normalLocation,
// and movementContact should be refNames.
movement.setCurrentLocation("currentLocation value");
movement.setCurrentLocationFitness("currentLocationFitness value");
movement.setCurrentLocationNote("currentLocationNote value");
- movement.setLocationDate(timestampUTC);
+ movement.setLocationDate(TIMESTAMP_UTC);
movement.setNormalLocation("normalLocation value");
movement.setMovementContact("movementContact value");
MovementMethodsList movementMethodsList = new MovementMethodsList();
movement.setMovementMethods(movementMethodsList);
movement.setMovementNote("movementNote value");
movement.setMovementReferenceNumber(movementReferenceNumber);
- movement.setPlannedRemovalDate(timestampUTC);
- movement.setRemovalDate(timestampUTC);
+ movement.setPlannedRemovalDate(TIMESTAMP_UTC);
+ movement.setRemovalDate(TIMESTAMP_UTC);
movement.setReasonForMove("reasonForMove value");
MultipartOutput multipart = new MultipartOutput();
OutputPart commonPart =
/** The Movement list. */
private MovementsCommonList MovementList;
-
/**
* Gets the common part.
*
this.MovementList = MovementList;
}
- /* (non-Javadoc)
- * @see org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl#extractPart(org.nuxeo.ecm.core.api.DocumentModel, java.lang.String, org.collectionspace.services.common.service.ObjectPartType)
- */
- @Override
- protected Map<String, Object> extractPart(DocumentModel docModel, String schema, ObjectPartType partMeta)
- throws Exception {
- Map<String, Object> unQObjectProperties = super.extractPart(docModel, schema, partMeta);
-
- // For each dateTime field in the common part, return an
- // appropriately formatted representation of its value.
- if (partMeta.getLabel().equalsIgnoreCase(COMMON_PART_LABEL)) {
- for(Entry<String, Object> entry : unQObjectProperties.entrySet()){
- if (isDateTimeType(entry)) {
- entry.setValue(
- GregorianCalendarDateTimeUtils.formatAsISO8601Timestamp(
- (GregorianCalendar) entry.getValue()));
- }
- }
- }
-
- return unQObjectProperties;
- }
-
/**
* Extract common part.
*
return MovementConstants.NUXEO_SCHEMA_NAME + ":" + prop;
}
- private boolean isDateTimeType(Entry<String, Object> entry) {
+ private boolean isDateTimeType(Object obj) {
boolean isDateTimeType = false;
- if (entry.getValue() instanceof Calendar) {
+ if (obj != null && obj instanceof Calendar) {
isDateTimeType = true;
}
return isDateTimeType;
}
-
+
}