public Suite replaceSuite(final Suite oldSuite, final Suite newSuite) throws StorageException { metadataDAO.replaceSuite(oldSuite,newSuite); return newSuite; }
public Suite saveSuite(final Suite suite) throws ValidatorException, StorageException { return metadataDAO.saveSuite(suite); }
public Suite getSuite(DBKey dbKey, String correlationId) throws StorageException { return metadataDAO.getSuite(dbKey, correlationId); }
/** * @param currentRun - current suite run * @return suite wrapper with all patterns from the last or specified (see * Suite.patternCorrelationId) run, if this is the first run of the suite, patterns will be * empty. */ public Suite enrichWithPatterns(final Suite currentRun) throws StorageException { final SimpleDBKey dbKey = new SimpleDBKey(currentRun); Suite lastVersion = metadataDAO.getLatestRun(dbKey, currentRun.getName()); Suite pattern; if (currentRun.getPatternCorrelationId() != null) { pattern = metadataDAO.getSuite(dbKey, currentRun.getPatternCorrelationId()); } else { pattern = lastVersion; } return SuiteMergeStrategy.merge(currentRun, lastVersion, pattern); }
private MongoCollection<Document> getMetadataCollection(DBKey dbKey) throws StorageException { final String dbName = MongoDBClient.getDbName(dbKey.getCompany(), dbKey.getProject()); final MongoDatabase database = client.getDatabase(dbName, true); if (database == null) { throw new StorageException( String.format("Database %s does not exist! Contact AET administrators.", dbName)); } return database.getCollection(METADATA_COLLECTION_NAME); } }
private String getPatternCorrelationId(TestSuiteRun testSuiteRun) { String result = testSuiteRun.getPatternCorrelationId(); if (result == null && testSuiteRun.getPatternSuite() != null) { SimpleDBKey dbKey = new SimpleDBKey(testSuiteRun.getCompany(), testSuiteRun.getProject()); try { Suite patternSuite = metadataDao.getLatestRun(dbKey, testSuiteRun.getPatternSuite()); result = patternSuite != null ? patternSuite.getCorrelationId() : null; } catch (StorageException e) { LOG.error("Error while retrieving suite from mongo db: '{}', suiteName: '{}'", dbKey, testSuiteRun.getPatternSuite(), e); } } return result; }
@Override public DBKey apply(String dbName) { return new SimpleDBKey(MongoDBClient.getCompanyNameFromDbName(dbName), MongoDBClient.getProjectNameFromDbName(dbName)); } };
public static Suite getSuiteFromMetadata(MetadataDAO metadataDAO, DBKey dbKey, String correlationId, String suiteName) throws StorageException { if (isValidCorrelationId(correlationId)) { return metadataDAO.getSuite(dbKey, correlationId); } else if (isValidName(suiteName)) { return metadataDAO.getLatestRun(dbKey, suiteName); } else { return null; } }
public static DBKey getDBKeyFromRequest(HttpServletRequest req) throws ValidatorException { String company = req.getParameter(Helper.COMPANY_PARAM); String project = req.getParameter(Helper.PROJECT_PARAM); SimpleDBKey dbKey = new SimpleDBKey(company, project); dbKey.validate(null); return dbKey; }
public String getId() { return getDbKey().getCompany() + "_" + getDbKey().getProject() + "|" + getData(); }
private Set<JsErrorLog> getCollectedResult() throws IOException { return artifactsDAO .getJsonFormatArtifact(comparatorProperties, comparatorProperties.getCollectedId(), RESULT_TYPE); }
@Override public CollectorStepResult collect() throws ProcessingException { CollectorStepResult stepResult; Set<JsErrorLog> jsErrorLogs = webCommunicationWrapper.getJSErrorLogs(); final String artifactId = artifactsDAO.saveArtifactInJsonFormat(properties, jsErrorLogs); stepResult = CollectorStepResult.newCollectedResult(artifactId); return stepResult; }
/** * @param currentRun - current suite run * @return suite wrapper with all patterns from the last or specified (see * Suite.patternCorrelationId) run, if this is the first run of the suite, patterns will be * empty. */ public Suite enrichWithPatterns(final Suite currentRun) throws StorageException { final SimpleDBKey dbKey = new SimpleDBKey(currentRun); Suite lastVersion = metadataDAO.getLatestRun(dbKey, currentRun.getName()); Suite pattern; if (currentRun.getPatternCorrelationId() != null) { pattern = metadataDAO.getSuite(dbKey, currentRun.getPatternCorrelationId()); } else { pattern = lastVersion; } return SuiteMergeStrategy.merge(currentRun, lastVersion, pattern); }
private MongoCollection<Document> getMetadataCollection(DBKey dbKey) throws StorageException { final String dbName = MongoDBClient.getDbName(dbKey.getCompany(), dbKey.getProject()); final MongoDatabase database = client.getDatabase(dbName, true); if (database == null) { throw new StorageException( String.format("Database %s does not exist! Contact AET administrators.", dbName)); } return database.getCollection(METADATA_COLLECTION_NAME); } }
private String getPatternCorrelationId(TestSuiteRun testSuiteRun) { String result = testSuiteRun.getPatternCorrelationId(); if (result == null && testSuiteRun.getPatternSuite() != null) { SimpleDBKey dbKey = new SimpleDBKey(testSuiteRun.getCompany(), testSuiteRun.getProject()); try { Suite patternSuite = metadataDao.getLatestRun(dbKey, testSuiteRun.getPatternSuite()); result = patternSuite != null ? patternSuite.getCorrelationId() : null; } catch (StorageException e) { LOG.error("Error while retrieving suite from mongo db: '{}', suiteName: '{}'", dbKey, testSuiteRun.getPatternSuite(), e); } } return result; }
public static Suite getSuiteFromMetadata(MetadataDAO metadataDAO, DBKey dbKey, String correlationId, String suiteName) throws StorageException { if (isValidCorrelationId(correlationId)) { return metadataDAO.getSuite(dbKey, correlationId); } else if (isValidName(suiteName)) { return metadataDAO.getLatestRun(dbKey, suiteName); } else { return null; } }
public Suite getSuite(DBKey dbKey, String correlationId) throws StorageException { return metadataDAO.getSuite(dbKey, correlationId); }
public Suite replaceSuite(final Suite oldSuite, final Suite newSuite) throws StorageException { metadataDAO.replaceSuite(oldSuite,newSuite); return newSuite; }
public Suite saveSuite(final Suite suite) throws ValidatorException, StorageException { return metadataDAO.saveSuite(suite); }
private Set<JsErrorLog> getCollectedResult() throws IOException { return artifactsDAO .getJsonFormatArtifact(comparatorProperties, comparatorProperties.getCollectedId(), RESULT_TYPE); }