@Override public final boolean uniqueIdInUse(final String uniqueID) { return allJobs.contains(uniqueID); }
/** * Adds the to scan task. * * @param event the event */ public void addToScanTask(String event) { if (!scanSet.contains(event)) { scanSet.add(event); task.addLogFile(event); } }
/** * new trigger to queue * * @param triggerParam * @return */ public ReturnT<String> pushTriggerQueue(TriggerParam triggerParam) { // avoid repeat if (triggerLogIdSet.contains(triggerParam.getLogId())) { logger.debug("repeate trigger job, logId:{}", triggerParam.getLogId()); return new ReturnT<String>(ReturnT.FAIL_CODE, "repeate trigger job, logId:" + triggerParam.getLogId()); } triggerLogIdSet.add(triggerParam.getLogId()); triggerQueue.add(triggerParam); return ReturnT.SUCCESS; }
String request = jsonParser.getJson("/AuditIT/createAuditEntityInverse.req.json"); Assert.assertFalse(logger.logMessages.contains("Inverse entities: [Value: update id 1 through id 2 relationship: 2]")); .statusCode(HttpStatus.SC_CREATED); Assert.assertTrue(logger.logMessages.contains("Entity with id 1 now has inverse list [AuditEntityInverse{id=1, entities=[Value: update id 1 through id 2 relationship: 2]}]")); Assert.assertTrue(logger.logMessages.contains("Inverse entities: [Value: update id 1 through id 2 relationship: 2]")); .statusCode(HttpStatus.SC_NO_CONTENT); Assert.assertTrue(logger.logMessages.contains("Entity with id 1 now has inverse list []")); Assert.assertTrue(logger.logMessages.contains("Inverse entities: []"));
@Test(priority = 2) public void testAuditWithDuplicateLineageEntry() { String request = jsonParser.getJson("/AuditIT/updateAuditEntityLineageDup.req.json"); given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(request) .patch("/auditEntity/2/otherEntity/1") .then() .statusCode(HttpStatus.SC_NO_CONTENT); Assert.assertTrue(logger.logMessages.contains("Updated value (for id: 1): update id 1 through id 2")); }
@Test(priority = 0) public void testAuditOnCreate() throws Exception { String request = jsonParser.getJson("/AuditIT/createAuditEntity.req.json"); String expected = jsonParser.getJson("/AuditIT/createAuditEntity.resp.json"); String actual = given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(request) .post("/auditEntity") .then() .statusCode(HttpStatus.SC_CREATED) .extract().body().asString(); assertEqualDocuments(actual, expected); Assert.assertTrue(logger.logMessages.contains("old: null\n" + "new: Value: test abc relationship: null")); Assert.assertTrue(logger.logMessages.contains("Created with value: test abc")); }
private boolean add(final QueuedJob queuedJob) if(allJobs.contains(queuedJob.getUniqueID()))
@Test(priority = 1) public void testAuditOnUpdate() { String request = jsonParser.getJson("/AuditIT/createAuditEntity2.req.json"); String expected = jsonParser.getJson("/AuditIT/createAuditEntity2.resp.json"); String actual = given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(request) .post("/auditEntity") .then() .statusCode(HttpStatus.SC_CREATED) .extract().body().asString(); assertEqualDocuments(actual, expected); request = jsonParser.getJson("/AuditIT/updateAuditEntity.req.json"); given() .contentType(JSONAPI_CONTENT_TYPE) .accept(JSONAPI_CONTENT_TYPE) .body(request) .patch("/auditEntity/1") .then() .statusCode(HttpStatus.SC_NO_CONTENT); Assert.assertTrue(logger.logMessages.contains("Updated relationship (for id: 1): 2")); Assert.assertTrue(logger.logMessages.contains("Updated value (for id: 1): updated value")); }