public final void testGetResourceSuccess() throws Exception { VirtualCollection vcoll = this.getMyVC(); String[] names = vcoll.listResources(); assertTrue("Expected resource names and not an empty array.", 0 != names.length); Resource res = vcoll.getResource(names[0]); assertTrue( "Expected instance of VirtualResource and not " + res.getClass(), res instanceof VirtualResource); }
public final void testRemoveResourceFail() throws Exception { VirtualCollection vcoll = this.getMyVC(); String[] names = vcoll.listResources(); for (int i = 0; i < names.length; i++) { Resource r = vcoll.getResource(names[i]); try { vcoll.removeResource(r); assertTrue(EXPECTED_EXCEPTION, false); } catch (XMLDBException e) { assertTrue(INVALID_COLL_MSG + e.errorCode, this.isInvalidColl(e.errorCode)); } } }
public final void testGetPCVResourceSuccess() throws Exception { VirtualCollection vcoll = this.getMyVC(); String[] names = vcoll.listResources(); assertTrue("Expected resource names and not an empty array.", 0 != names.length); Resource res = vcoll.getResource(names[0]); assertTrue( "Expected instance of VirtualResource and not " + res.getClass(), res instanceof VirtualResource); VirtualResource vres = (VirtualResource) res; PCVResource pres = vres.getPreCompiledResource(); assertNotNull("Expected pres to be not null", pres); assertTrue( "Expected instance of PCVResource and not " + res.getClass(), pres instanceof PCVResource); assertEquals(vres.getId(), pres.getId()); }