2041 |
2041 |
String str1 = "object1";
|
2042 |
2042 |
String str2 = "object2";
|
2043 |
2043 |
String str3 = "object3";
|
2044 |
|
|
|
2044 |
|
|
2045 |
Date date = new Date();
|
|
2046 |
Thread.sleep(2000);
|
2045 |
2047 |
//insert test documents with a series id
|
2046 |
2048 |
Session session = getTestSession();
|
2047 |
2049 |
Identifier guid = new Identifier();
|
... | ... | |
2063 |
2065 |
assertTrue(metadata.getSize().equals(sysmeta.getSize()));
|
2064 |
2066 |
System.out.println("the identifier is "+guid.getValue());
|
2065 |
2067 |
|
2066 |
|
|
2067 |
|
|
|
2068 |
Date current = sysmeta.getDateSysMetadataModified();
|
|
2069 |
//updating system metadata failed since the date doesn't match
|
|
2070 |
sysmeta.setArchived(true);
|
|
2071 |
sysmeta.setDateSysMetadataModified(date);
|
|
2072 |
try {
|
|
2073 |
MNodeService.getInstance(request).updateSystemMetadata(session, guid, sysmeta);
|
|
2074 |
fail("We shouldn't get there");
|
|
2075 |
} catch (Exception e) {
|
|
2076 |
assertTrue(e instanceof InvalidRequest);
|
|
2077 |
}
|
2068 |
2078 |
//update system metadata sucessfully
|
2069 |
|
sysmeta.setArchived(true);
|
|
2079 |
sysmeta.setDateSysMetadataModified(current);
|
2070 |
2080 |
BigInteger serialVersion = metadata.getSerialVersion();
|
2071 |
|
System.out.println("the current version is "+serialVersion.toString());
|
2072 |
|
serialVersion = serialVersion.add(BigInteger.ONE);
|
2073 |
|
System.out.println("the new version is "+serialVersion.toString());
|
2074 |
|
sysmeta.setSerialVersion(serialVersion);
|
|
2081 |
//System.out.println("the current version is "+serialVersion.toString());
|
|
2082 |
//serialVersion = serialVersion.add(BigInteger.ONE);
|
|
2083 |
//System.out.println("the new version is "+serialVersion.toString());
|
|
2084 |
//sysmeta.setSerialVersion(serialVersion);
|
2075 |
2085 |
MNodeService.getInstance(request).updateSystemMetadata(session, guid, sysmeta);
|
2076 |
2086 |
SystemMetadata metadata2 = MNodeService.getInstance(request).getSystemMetadata(session, seriesId);
|
2077 |
2087 |
assertTrue(metadata2.getIdentifier().equals(guid));
|
2078 |
2088 |
assertTrue(metadata2.getSeriesId().equals(seriesId));
|
2079 |
2089 |
assertTrue(metadata2.getArchived().equals(true));
|
2080 |
2090 |
assertTrue(metadata2.getChecksum().getValue().equals(metadata.getChecksum().getValue()));
|
|
2091 |
assertTrue(metadata2.getDateSysMetadataModified().getTime() > current.getTime());
|
2081 |
2092 |
|
2082 |
2093 |
Identifier newId = new Identifier();
|
2083 |
2094 |
newId.setValue("newValue");
|
... | ... | |
2128 |
2139 |
} catch (Exception e) {
|
2129 |
2140 |
assertTrue(e instanceof InvalidRequest);
|
2130 |
2141 |
}
|
2131 |
|
}
|
|
2142 |
}
|
2132 |
2143 |
|
2133 |
2144 |
public void testUpdateObsoletesAndObsoletedBy() throws Exception {
|
2134 |
2145 |
String str1 = "object1";
|
Change the test method for the updateSystemMetadata method.