public TopologyTestRunCaseSource addOrUpdateTopologyTestRunCaseSource(Long id, TopologyTestRunCaseSource testCaseSource) { testCaseSource.setId(id); testCaseSource.setTimestamp(System.currentTimeMillis()); dao.addOrUpdate(testCaseSource); return testCaseSource; }
public TopologyTestRunCaseSource getTopologyTestRunCaseSourceBySourceId(Long testCaseId, Long sourceId) { TopologyTestRunCaseSource testCaseSource = new TopologyTestRunCaseSource(); testCaseSource.setId(testCaseId); Collection<TopologyTestRunCaseSource> sources = dao.find(TopologyTestRunCaseSource.NAMESPACE, Lists.newArrayList( new QueryParam("testCaseId", testCaseId.toString()), new QueryParam("sourceId", sourceId.toString()) )); if (sources == null || sources.isEmpty()) { return null; } else if (sources.size() > 1) { LOG.warn("More than one test run case source entity for same test case and source. test case id: " + testCaseId + " , source id: " + sourceId); LOG.warn("Returning first one..."); } return sources.iterator().next(); }
private void addTopologyTestRunCaseSource(Long newTestCaseId, Long newVersionId, TopologyTestRunCaseSource testRunCaseSource) { // unlike topology related entities, just issues a new id testRunCaseSource.setId(null); testRunCaseSource.setTestCaseId(newTestCaseId); testRunCaseSource.setVersionId(newVersionId); addTopologyTestRunCaseSource(testRunCaseSource); }
public TopologyTestRunCaseSource removeTopologyTestRunCaseSource(Long id) { TopologyTestRunCaseSource testcaseSource = new TopologyTestRunCaseSource(); testcaseSource.setId(id); return dao.remove(testcaseSource.getStorableKey()); }
public TopologyTestRunCaseSource addTopologyTestRunCaseSource(TopologyTestRunCaseSource testCaseSource) { if (testCaseSource.getId() == null) { testCaseSource.setId(dao.nextId(TopologyTestRunCaseSource.NAMESPACE)); } testCaseSource.setTimestamp(System.currentTimeMillis()); dao.add(testCaseSource); return testCaseSource; }
@PUT @Path("/topologies/{topologyId}/testcases/{testCaseId}/sources/{id}") public Response addOrUpdateTestRunCaseSource(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, @PathParam("id") Long id, TopologyTestRunCaseSource testRunCaseSource, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); testRunCaseSource.setId(id); testRunCaseSource.setTestCaseId(testCaseId); TopologySource topologySource = getAssociatedTopologySource(topologyId, testCaseId, testRunCaseSource.getSourceId()); testRunCaseSource.setVersionId(topologySource.getVersionId()); TopologyTestRunCaseSource updatedCase = catalogService.addOrUpdateTopologyTestRunCaseSource(testRunCaseSource.getId(), testRunCaseSource); return WSUtils.respondEntity(updatedCase, OK); }
public TopologyTestRunCaseSource getTopologyTestRunCaseSource(Long testcaseId, Long id) { TopologyTestRunCaseSource testCaseSource = new TopologyTestRunCaseSource(); testCaseSource.setId(id); TopologyTestRunCaseSource retrieved = dao.get(new StorableKey(TopologyTestRunCaseSource.NAMESPACE, testCaseSource.getPrimaryKey())); if (retrieved == null || !retrieved.getTestCaseId().equals(testcaseId)) { return null; } return retrieved; }
public TopologyTestRunCaseSource(TopologyTestRunCaseSource other) { if (other != null) { setId(other.getId()); setTestCaseId(other.getTestCaseId()); setSourceId(other.getSourceId()); setVersionId(other.getVersionId()); setRecords(other.getRecords()); setOccurrence(other.getOccurrence()); setSleepMsPerIteration(other.getSleepMsPerIteration()); setTimestamp(other.getTimestamp()); } }