422 |
422 |
suite.addTest(new OnlineDataAccessTest("onlineData201CasesTest_5"));
|
423 |
423 |
suite.addTest(new OnlineDataAccessTest("onlineData201CasesTest_6"));
|
424 |
424 |
suite.addTest(new OnlineDataAccessTest("onlineData210CasesTest_6"));
|
|
425 |
|
|
426 |
suite.addTest(new OnlineDataAccessTest("onlineData210CasesTest_7"));
|
|
427 |
|
425 |
428 |
return suite;
|
426 |
429 |
}
|
427 |
430 |
|
... | ... | |
2119 |
2122 |
|
2120 |
2123 |
return docid.toString();
|
2121 |
2124 |
}
|
|
2125 |
|
|
2126 |
/**
|
|
2127 |
* Checking the following cases on 2.1.0 version documents:
|
|
2128 |
* when a data file is uploaded without ALL permissions for other user
|
|
2129 |
* and then the package has ALL permissions granted the [data file] should
|
|
2130 |
* not prevent a metadata update
|
|
2131 |
*/
|
|
2132 |
public void onlineData210CasesTest_7() {
|
|
2133 |
try {
|
|
2134 |
debug("\nRunning: onlineData210CasesTest_7");
|
|
2135 |
|
|
2136 |
// insert a document
|
|
2137 |
m.login(username, password);
|
|
2138 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert",
|
|
2139 |
null, null, null,
|
|
2140 |
null, getAccessBlock(anotheruser, true,
|
|
2141 |
true, false, false, false), null, null,
|
|
2142 |
null, null);
|
|
2143 |
newdocid = generateDocid();
|
|
2144 |
insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
|
|
2145 |
m.logout();
|
|
2146 |
|
|
2147 |
// update document
|
|
2148 |
m.login(username, password);
|
|
2149 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing update",
|
|
2150 |
null, null, null,
|
|
2151 |
null, getAccessBlock(anotheruser, true,
|
|
2152 |
true, false, false, false), null, null,
|
|
2153 |
null, null);
|
|
2154 |
updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
|
|
2155 |
m.logout();
|
|
2156 |
|
|
2157 |
// upload data and update the document
|
|
2158 |
onlineDocid = generateDocid();
|
|
2159 |
m.login(username, password);
|
|
2160 |
uploadDocid(onlineDocid + ".1", onlinetestdatafile1, SUCCESS, false);
|
|
2161 |
m.logout();
|
|
2162 |
|
|
2163 |
// try to read the online data
|
|
2164 |
m.login(anotheruser, anotherpassword);
|
|
2165 |
readDocid(onlineDocid + ".1", FAILURE, true);
|
|
2166 |
m.logout();
|
|
2167 |
|
|
2168 |
// update the document to point at the data
|
|
2169 |
m.login(username, password);
|
|
2170 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing update",
|
|
2171 |
null, null,
|
|
2172 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
2173 |
null, null, null, null,
|
|
2174 |
null, null);
|
|
2175 |
updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
|
|
2176 |
m.logout();
|
|
2177 |
|
|
2178 |
// set read for document - nothing for data
|
|
2179 |
m.login(username, password);
|
|
2180 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing insert",
|
|
2181 |
null, null,
|
|
2182 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
2183 |
null, getAccessBlock(anotheruser, true,
|
|
2184 |
true, false, false, false), null, null,
|
|
2185 |
null, null);
|
|
2186 |
updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
|
|
2187 |
m.logout();
|
|
2188 |
|
|
2189 |
// try to read the online data
|
|
2190 |
m.login(anotheruser, anotherpassword);
|
|
2191 |
readDocid(newdocid + ".4", SUCCESS, false);
|
|
2192 |
readDocid(onlineDocid + ".1", FAILURE, true);
|
|
2193 |
m.logout();
|
|
2194 |
|
|
2195 |
// try to update the package as the other user (expect failure)
|
|
2196 |
m.login(anotheruser, anotherpassword);
|
|
2197 |
testdocument = get210TestEmlDoc("Doing update as other user", null, null,
|
|
2198 |
"ecogrid://knb/" + onlineDocid + ".1",
|
|
2199 |
null, getAccessBlock(anotheruser, true,
|
|
2200 |
true, false, false, false), null, null,
|
|
2201 |
getAccessBlock(anotheruser, true,
|
|
2202 |
true, false, false, false), null);
|
|
2203 |
updateDocid(newdocid + ".5", testdocument, FAILURE, true);
|
|
2204 |
m.logout();
|
|
2205 |
|
|
2206 |
// upload updated data
|
|
2207 |
m.login(username, password);
|
|
2208 |
uploadDocid(onlineDocid + ".2", onlinetestdatafile1, SUCCESS, false);
|
|
2209 |
m.logout();
|
|
2210 |
|
|
2211 |
// update the document
|
|
2212 |
m.login(username, password);
|
|
2213 |
testdocument = get210TestEmlDoc("OnlineDataAccessTest: Doing update",
|
|
2214 |
null, null,
|
|
2215 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
2216 |
null, getAccessBlock(anotheruser, true,
|
|
2217 |
true, false, false, false), null, null,
|
|
2218 |
null, null);
|
|
2219 |
updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
|
|
2220 |
m.logout();
|
|
2221 |
|
|
2222 |
// try to update the package as the other user (expect failure)
|
|
2223 |
m.login(anotheruser, anotherpassword);
|
|
2224 |
testdocument = get210TestEmlDoc("Doing update as other user", null, null,
|
|
2225 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
2226 |
null, getAccessBlock(anotheruser, false,
|
|
2227 |
false, false, false, true), null, null,
|
|
2228 |
getAccessBlock(anotheruser, true,
|
|
2229 |
true, true, true, true), null);
|
|
2230 |
updateDocid(newdocid + ".6", testdocument, FAILURE, true);
|
|
2231 |
m.logout();
|
|
2232 |
|
|
2233 |
// set ALL for data package
|
|
2234 |
m.login(username, password);
|
|
2235 |
testdocument = get210TestEmlDoc("Doing update for package ALL", null, null,
|
|
2236 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
2237 |
null, getAccessBlock(anotheruser, true,
|
|
2238 |
true, true, true, true), null, null,
|
|
2239 |
getAccessBlock(anotheruser, true,
|
|
2240 |
true, true, true, true), null);
|
|
2241 |
updateDocid(newdocid + ".6", testdocument, SUCCESS, false);
|
|
2242 |
m.logout();
|
|
2243 |
|
|
2244 |
// try to read the online data
|
|
2245 |
m.login(anotheruser, anotherpassword);
|
|
2246 |
readDocid(newdocid + ".6", SUCCESS, false);
|
|
2247 |
readDocid(onlineDocid + ".2", SUCCESS, false);
|
|
2248 |
m.logout();
|
|
2249 |
|
|
2250 |
// try to update the package as the other user (success)
|
|
2251 |
m.login(anotheruser, anotherpassword);
|
|
2252 |
testdocument = get210TestEmlDoc("Doing update as other user", null, null,
|
|
2253 |
"ecogrid://knb/" + onlineDocid + ".2",
|
|
2254 |
null, getAccessBlock(anotheruser, true,
|
|
2255 |
true, true, true, true), null, null,
|
|
2256 |
getAccessBlock(anotheruser, true,
|
|
2257 |
true, true, true, true), null);
|
|
2258 |
updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
|
|
2259 |
m.logout();
|
|
2260 |
|
|
2261 |
}
|
|
2262 |
catch (MetacatAuthException mae) {
|
|
2263 |
fail("Authorization failed:\n" + mae.getMessage());
|
|
2264 |
}
|
|
2265 |
catch (MetacatInaccessibleException mie) {
|
|
2266 |
fail("Metacat Inaccessible:\n" + mie.getMessage());
|
|
2267 |
}
|
|
2268 |
catch (Exception e) {
|
|
2269 |
fail("General exception:\n" + e.getMessage());
|
|
2270 |
}
|
|
2271 |
}
|
2122 |
2272 |
}
|
check both previous and current data revisions when updating packages. https://projects.ecoinformatics.org/ecoinfo/issues/5647