Project

General

Profile

« Previous | Next » 

Revision 9590

Added by Jing Tao over 8 years ago

Add a junit test to test using the noaa format id to validate a xml object.

View differences:

test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
41 41
import java.io.ByteArrayInputStream;
42 42
import java.io.ByteArrayOutputStream;
43 43
import java.io.File;
44
import java.io.FileInputStream;
44 45
import java.io.FileOutputStream;
45 46
import java.io.IOException;
46 47
import java.io.InputStream;
......
178 179
    suite.addTest(new MNodeServiceTest("testReadDeletedObject"));
179 180
    suite.addTest(new MNodeServiceTest("testCreateAndUpdateXMLWithUnmatchingEncoding"));
180 181
    suite.addTest(new MNodeServiceTest("testListViews"));
182
    suite.addTest(new MNodeServiceTest("testCreateNOAAObject"));
181 183
   
182 184
    
183 185
    
......
2464 2466
        assertTrue(metadata.getChecksum().getValue().equals(sysmeta2.getChecksum().getValue()));
2465 2467
    }
2466 2468
    
2469
    /**
2470
     * Test to create a metacat object which uses the isotc211 noaa variant.
2471
     * @throws Exception
2472
     */
2473
    public void testCreateNOAAObject() throws Exception {
2474
        Session session = getTestSession();
2475
        Identifier guid = new Identifier();
2476
        guid.setValue("testNoaa." + System.currentTimeMillis());
2477
        InputStream object = new FileInputStream("test/sciencemetadata-noaa.xml");
2478
        InputStream sysmetaInput = new FileInputStream("test/sysmeta-noaa.xml");
2479
        SystemMetadata sysmeta = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, sysmetaInput);
2480
        sysmeta.setIdentifier(guid);
2481
        Identifier pid = MNodeService.getInstance(request).create(session, guid, object, sysmeta);
2482
        assertTrue(pid.getValue().equals(guid.getValue()));
2483
    }
2484
    
2467 2485
}

Also available in: Unified diff