mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
58489: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 58379: MNT-9888: WorkflowModelBuilderTest is susceptible to timezone issues - Fix unit tests, because they fails in build 75. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@61989 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -87,7 +87,7 @@ public abstract class AbstractMetadataExtracterTest extends TestCase
|
||||
long now = System.currentTimeMillis();
|
||||
TempFileProvider.TempFileCleanerJob.removeFiles(now);
|
||||
|
||||
TimeZone tz = TimeZone.getTimeZone("Europe/London");
|
||||
TimeZone tz = TimeZone.getTimeZone("GMT");
|
||||
TimeZone.setDefault(tz);
|
||||
// Joda time has already grabbed the JVM zone so re-set it here
|
||||
DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
|
||||
|
@@ -105,20 +105,20 @@ public class OfficeMetadataExtracterTest extends AbstractMetadataExtracterTest
|
||||
if(mimetype.equals(MimetypeMap.MIMETYPE_WORD)) {
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_CREATED + " not found for mimetype " + mimetype,
|
||||
"2005-05-26T13:57:00.000+01:00",
|
||||
"2005-05-26T12:57:00.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_CREATED)));
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_MODIFIED + " not found for mimetype " + mimetype,
|
||||
"2005-09-20T18:25:00.000+01:00",
|
||||
"2005-09-20T17:25:00.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_MODIFIED)));
|
||||
} else if(mimetype.equals(MimetypeMap.MIMETYPE_EXCEL)) {
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_CREATED + " not found for mimetype " + mimetype,
|
||||
"1996-10-15T00:33:28.000+01:00",
|
||||
"1996-10-14T23:33:28.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_CREATED)));
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_MODIFIED + " not found for mimetype " + mimetype,
|
||||
"2005-09-20T19:22:32.000+01:00",
|
||||
"2005-09-20T18:22:32.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_MODIFIED)));
|
||||
} else if(mimetype.equals(MimetypeMap.MIMETYPE_PPT)) {
|
||||
assertEquals(
|
||||
@@ -127,7 +127,7 @@ public class OfficeMetadataExtracterTest extends AbstractMetadataExtracterTest
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_CREATED)));
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_MODIFIED + " not found for mimetype " + mimetype,
|
||||
"2005-09-20T19:23:41.000+01:00",
|
||||
"2005-09-20T18:23:41.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_MODIFIED)));
|
||||
}
|
||||
|
||||
|
@@ -84,7 +84,7 @@ public class PdfBoxMetadataExtracterTest extends AbstractMetadataExtracterTest
|
||||
Map<QName, Serializable> properties) {
|
||||
assertEquals(
|
||||
"Property " + ContentModel.PROP_CREATED + " not found for mimetype " + mimetype,
|
||||
"2005-05-26T20:52:58.000+01:00",
|
||||
"2005-05-26T19:52:58.000Z",
|
||||
DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_CREATED)));
|
||||
}
|
||||
|
||||
|
@@ -94,7 +94,7 @@ public class PoiMetadataExtracterTest extends AbstractMetadataExtracterTest
|
||||
}
|
||||
else if (MimetypeMap.MIMETYPE_OPENXML_SPREADSHEET.equals(mimetype))
|
||||
{
|
||||
checkFileCreationDate(mimetype, properties, "1996-10-15T00:33:28.000+01:00");
|
||||
checkFileCreationDate(mimetype, properties, "1996-10-14T23:33:28.000Z");
|
||||
}
|
||||
else if (MimetypeMap.MIMETYPE_OPENXML_PRESENTATION.equals(mimetype))
|
||||
{
|
||||
|
@@ -23,6 +23,7 @@ import java.io.InputStreamReader;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
@@ -45,6 +46,7 @@ import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.BaseSpringTest;
|
||||
import org.alfresco.util.debug.NodeStoreInspector;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.springframework.extensions.surf.util.ISO8601DateFormat;
|
||||
|
||||
@Category(OwnJVMTestsCategory.class)
|
||||
@@ -74,6 +76,11 @@ public class ImporterComponentTest extends BaseSpringTest
|
||||
|
||||
// Create the store
|
||||
this.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
|
||||
|
||||
TimeZone tz = TimeZone.getTimeZone("GMT");
|
||||
TimeZone.setDefault(tz);
|
||||
// Joda time has already grabbed the JVM zone so re-set it here
|
||||
DateTimeZone.setDefault(DateTimeZone.forTimeZone(tz));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,9 +133,9 @@ public class ImporterComponentTest extends BaseSpringTest
|
||||
String modifiedDate = DefaultTypeConverter.INSTANCE.convert(String.class, nodeProps.get(ContentModel.PROP_MODIFIED));
|
||||
String modifier = DefaultTypeConverter.INSTANCE.convert(String.class, nodeProps.get(ContentModel.PROP_MODIFIER));
|
||||
// Check that the cm:auditable properties are correct
|
||||
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-05-01T00:00:00.000+01:00")), createdDate);
|
||||
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-04-30T23:00:00.000Z")), createdDate);
|
||||
assertEquals("cm:creator not preserved during import", "Import Creator", creator);
|
||||
assertEquals("cm:modified not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-05-02T00:00:00.000+01:00")), modifiedDate);
|
||||
assertEquals("cm:modified not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-05-01T23:00:00.000Z")), modifiedDate);
|
||||
assertEquals("cm:modifier not preserved during import", "Import Modifier", modifier);
|
||||
|
||||
nodeRef = childAssocs.get(1).getChildRef();
|
||||
@@ -138,7 +145,7 @@ public class ImporterComponentTest extends BaseSpringTest
|
||||
modifiedDate = DefaultTypeConverter.INSTANCE.convert(String.class, nodeProps.get(ContentModel.PROP_MODIFIED));
|
||||
modifier = DefaultTypeConverter.INSTANCE.convert(String.class, nodeProps.get(ContentModel.PROP_MODIFIER));
|
||||
// Check that the cm:auditable properties are correct
|
||||
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-05-01T00:00:00.000+01:00")), createdDate);
|
||||
assertEquals("cm:created not preserved during import", ISO8601DateFormat.format(ISO8601DateFormat.parse("2009-04-30T23:00:00.000Z")), createdDate);
|
||||
assertEquals("cm:creator not preserved during import", "Import Creator", creator);
|
||||
assertEquals("cm:modifier not preserved during import", AuthenticationUtil.getSystemUserName(), modifier);
|
||||
}
|
||||
|
Reference in New Issue
Block a user