@Test /* * Test bitemporal protections - NOWIPE With transaction. */ public void testProtectWipeWithoutPermission() throws Exception { System.out.println("Inside testProtectWipeWithoutPermission"); DatabaseClient adminClient = getDatabaseClientOnDatabase(appServerHostname, restPort, dbName, "eval-readeruser", "x", getConnType()); ConnectedRESTQA.updateTemporalCollectionForLSQT(dbName, temporalLsqtCollectionName, true); Calendar insertTime = DatatypeConverter.parseDateTime("2005-01-01T00:00:01"); String docId = "javaSingleJSONDoc.json"; JacksonDatabindHandle<ObjectNode> handle = getJSONDocumentHandle("2001-01-01T00:00:00", "2011-12-31T23:59:59", "999 Skyway Park - JSON", docId ); JSONDocumentManager docMgr = writerClient.newJSONDocumentManager(); JSONDocumentManager docMgrProtect = adminClient.newJSONDocumentManager(); docMgr.write(docId, null, handle, null, null, temporalLsqtCollectionName, insertTime); Thread.sleep(10000); StringBuilder str = new StringBuilder(); try { // Protect document for 30 sec. Use Duration. docMgrProtect.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOWIPE, DatatypeFactory.newInstance().newDuration("PT30S")); } catch (Exception ex) { str.append(ex.getMessage()); System.out.println("Exception not thrown when user does not have permissions" + str.toString()); } assertTrue("Exception not thrown when user does not have permissions ", str.toString().contains("User is not allowed to protect resource")); }
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOUPDATE, DatatypeFactory.newInstance().newDuration("PT30S")); JacksonDatabindHandle<ObjectNode> handleUpd = getJSONDocumentHandle( "2003-01-01T00:00:00", "2008-12-31T23:59:59",
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOWIPE, DatatypeFactory.newInstance().newDuration("PT60S")); JacksonDatabindHandle<ObjectNode> handleUpd = getJSONDocumentHandle( "2003-01-01T00:00:00", "2012-12-31T23:59:59",
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOUPDATE, DatatypeFactory.newInstance().newDuration("PT30S"), t1); JacksonDatabindHandle<ObjectNode> handleUpd = getJSONDocumentHandle( "2003-01-01T00:00:00", "2008-12-31T23:59:59",
t2 = writerClient.openTransaction("T2", 30); docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOUPDATE, DatatypeFactory.newInstance().newDuration("PT30S"), t2);
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOUPDATE, DatatypeFactory.newInstance().newDuration("PT30S"), t1); JacksonDatabindHandle<ObjectNode> handleUpd = getJSONDocumentHandle(
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NOUPDATE, DatatypeFactory.newInstance().newDuration("PT30S"), t2); JacksonDatabindHandle<ObjectNode> handleUpd = getJSONDocumentHandle( "2003-01-01T00:00:00", "2008-12-31T23:59:59",
docMgr.protect(docId, temporalLsqtCollectionName, ProtectionLevel.NODELETE, DatatypeFactory.newInstance().newDuration("PT40S"));