Project

General

Profile

« Previous | Next » 

Revision 8632

add a few more checks while debugging test

View differences:

test/edu/ucsb/nceas/metacat/admin/upgrade/dataone/SyncAccessPolicyTest.java
93 93
	public static Test suite() {
94 94
		TestSuite suite = new TestSuite();
95 95
		suite.addTest(new SyncAccessPolicyTest("initialize"));
96
		suite.addTest(new SyncAccessPolicyTest("testIsEqual"));
96
//		suite.addTest(new SyncAccessPolicyTest("testIsEqual"));
97 97
		suite.addTest(new SyncAccessPolicyTest("testSyncAccessPolicy"));
98
		suite.addTest(new SyncAccessPolicyTest(
99
				"testSyncEML201OnlineDataAccessPolicy"));
98
//		suite.addTest(new SyncAccessPolicyTest("testSyncEML201OnlineDataAccessPolicy"));
100 99

  
101 100
		return suite;
102 101
	}
......
162 161

  
163 162
		String response = null;
164 163
		debug("\nStarting sync access policy test");
165
		debug("Logging in with user: " + anotheruser + ", password: "
166
				+ anotherpassword);
167
		try {
168
			response = m.login(anotheruser, anotherpassword);
169
		} catch (Exception e) {
170
			debug("Unable to login: " + response);
171
			fail();
172
		}
173 164

  
174 165
		String localId = null;
175 166
		try {
......
227 218
				fail("Error, cannot read system metadata for pid: " + pid
228 219
						+ " after " + attempts + " attempts");
229 220
			}
221
			
222
			/* Read SM from MN */
223
			try {
224
				mnSysMeta = MNodeService.getInstance(request)
225
						.getSystemMetadata(pid);
226
				debug("Got SM from MN");
227
			} catch (Exception e) {
228
				fail("Error getting system metadata for new pid: "
229
						+ pid.getValue() + ". Message: " + e.getMessage());
230
			}
231
			
232
			SyncAccessPolicy syncAP = new SyncAccessPolicy();
230 233

  
234
			// access policies should match after initial harvest
235
			assertTrue(syncAP.isEqual(cnSysMeta.getAccessPolicy(), mnSysMeta.getAccessPolicy()));
236

  
237
			// find the local id for this pid
231 238
			try {
232 239
				localId = IdentifierManager.getInstance().getLocalId(
233 240
						pid.getValue());
......
239 246
					+ pid.getValue() + ", username: " + username
240 247
					+ " read, allow, allowFirst");
241 248

  
242
			m.logout();
243 249
			response = m.login(anotheruser, anotherpassword);
244 250
			debug("Logging in as user: " + anotheruser);
245 251
			debug("Adding access for user: " + username);
......
259 265
			debug("Response from setaccess: " + response);
260 266
			debug("Retrieving updated docid from CN to check if perms were updated...");
261 267

  
262
			/* Reread SM from MN */
268
			/* Reread SM from MN after updating access */
263 269
			try {
264 270
				mnSysMeta = MNodeService.getInstance(request)
265 271
						.getSystemMetadata(pid);
......
341 347
			debug("Getting access policy for pid: " + pid.getValue());
342 348
			cnAccessPolicy = cnSysMeta.getAccessPolicy();
343 349
			debug("Diffing access policies (MN,CN) for pid: " + pid.getValue());
344
			SyncAccessPolicy syncAP = new SyncAccessPolicy();
345 350
			debug("Comparing access policies...");
346 351

  
347 352
			Boolean apEqual = new Boolean(syncAP.isEqual(mnAccessPolicy,

Also available in: Unified diff