public TopologyTestRunCaseSink addOrUpdateTopologyTestRunCaseSink(Long id, TopologyTestRunCaseSink testCaseSink) { testCaseSink.setId(id); testCaseSink.setTimestamp(System.currentTimeMillis()); dao.addOrUpdate(testCaseSink); return testCaseSink; }
public TopologyTestRunCaseSink getTopologyTestRunCaseSinkBySinkId(Long testCaseId, Long sinkId) { TopologyTestRunCaseSink testCaseSink = new TopologyTestRunCaseSink(); testCaseSink.setId(testCaseId); Collection<TopologyTestRunCaseSink> sinks = dao.find(TopologyTestRunCaseSink.NAMESPACE, Lists.newArrayList( new QueryParam("testCaseId", testCaseId.toString()), new QueryParam("sinkId", sinkId.toString()) )); if (sinks == null || sinks.isEmpty()) { return null; } else if (sinks.size() > 1) { LOG.warn("More than one test run case sink entity for same test case and sink. test case id: " + testCaseId + " , sink id: " + sinkId); LOG.warn("Returning first one..."); } return sinks.iterator().next(); }
private void addTopologyTestRunCaseSink(Long newTestCaseId, Long newVersionId, TopologyTestRunCaseSink testRunCaseSink) { // unlike topology related entities, just issues a new id testRunCaseSink.setId(null); testRunCaseSink.setTestCaseId(newTestCaseId); testRunCaseSink.setVersionId(newVersionId); addTopologyTestRunCaseSink(testRunCaseSink); }
public TopologyTestRunCaseSink addTopologyTestRunCaseSink(TopologyTestRunCaseSink testCaseSink) { if (testCaseSink.getId() == null) { testCaseSink.setId(dao.nextId(TopologyTestRunCaseSink.NAMESPACE)); } testCaseSink.setTimestamp(System.currentTimeMillis()); dao.add(testCaseSink); return testCaseSink; }
public TopologyTestRunCaseSink removeTopologyTestRunCaseSink(Long id) { TopologyTestRunCaseSink testcaseSink = new TopologyTestRunCaseSink(); testcaseSink.setId(id); return dao.remove(testcaseSink.getStorableKey()); }
@PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks/{id}") public Response addOrUpdateTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); testRunCaseSink.setId(id); testRunCaseSink.setTestCaseId(testCaseId); TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSink(testRunCaseSink.getId(), testRunCaseSink); return WSUtils.respondEntity(updatedCase, OK); }
public TopologyTestRunCaseSink getTopologyTestRunCaseSink(Long testcaseId, Long id) { TopologyTestRunCaseSink testCaseSink = new TopologyTestRunCaseSink(); testCaseSink.setId(id); TopologyTestRunCaseSink retrieved = dao.get(new StorableKey(TopologyTestRunCaseSink.NAMESPACE, testCaseSink.getPrimaryKey())); if (retrieved == null || !retrieved.getTestCaseId().equals(testcaseId)) { return null; } return retrieved; }
public TopologyTestRunCaseSink(TopologyTestRunCaseSink other) { if (other != null) { setId(other.getId()); setTestCaseId(other.getTestCaseId()); setSinkId(other.getSinkId()); setVersionId(other.getVersionId()); setRecords(other.getRecords()); setTimestamp(other.getTimestamp()); } }