Project

General

Profile

« Previous | Next » 

Revision 6317

test for CN.getSystemMetadata()

View differences:

test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
109 109
		suite.addTest(new CNodeServiceTest("testCreate"));
110 110
		suite.addTest(new CNodeServiceTest("testGet"));
111 111
		suite.addTest(new CNodeServiceTest("testGetFormat"));
112
		suite.addTest(new CNodeServiceTest("testGetSystemMetadata"));
112 113
		suite.addTest(new CNodeServiceTest("testListFormats"));
113 114
		suite.addTest(new CNodeServiceTest("testListNodes"));
114 115
		suite.addTest(new CNodeServiceTest("testObjectFormatNotFoundException"));
......
152 153
        }
153 154
	}
154 155
	
156
	/**
157
	 * test for getting system metadata
158
	 */
159
	public void testGetSystemMetadata() {
160
	    printTestHeader("testGetSystemMetadata");
161

  
162
	    try {
163
            Session session = getTestSession();
164
			Identifier guid = new Identifier();
165
			guid.setValue("testGetSystemMetadata." + System.currentTimeMillis());
166
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject());
167
			boolean result = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
168
			assertTrue(result);
169
			// get it
170
			SystemMetadata retSysmeta = CNodeService.getInstance().getSystemMetadata(session, guid);
171
			// check it
172
			assertEquals(sysmeta.getIdentifier().getValue(), retSysmeta.getIdentifier().getValue());
173
        } catch(Exception e) {
174
            fail("Unexpected error: " + e.getMessage());
175
        }
176
	}
177
	
155 178
	public void testCreate() {
156 179
	    printTestHeader("testCreate");
157 180

  

Also available in: Unified diff