public String getOwner() { if (owner == null) return TestSession.DEFAULT_TEST_SESSION.getValue(); return owner; }
@Override public String toString() { return testSession.getValue() + "/" + name; }
public File getSessionDir(TestSession testSession) { return new File(cache + File.separator + testSession.getValue()); } }
public List<String> reloadCommonSites(TestSession testSession) throws FactoryConfigurationError, Exception { logger.debug("reloadCommonSites for " + testSession.getValue()); Sites sites = getCommonSites(testSession); // does reload List<String> values = sites.getSiteNames(); logger.debug("reloaded CommonSites are " + testSession.getValue() + ": " + values); return values; }
static public File getRoot(String environmentName, TestSession testSession) { String sep = File.separator; StringBuilder buf = new StringBuilder(); buf.append(Installation.instance().environmentFile().toString()); buf.append(sep).append(environmentName); buf.append(sep).append("testkits"); buf.append(sep).append(testSession.getValue()); return new File(buf.toString()); }
public List<Result> runTest(TestSession testSession, String siteName, TestInstance testInstance, List<String> sections, Map<String, String> params, boolean stopOnFirstFailure) throws Exception { return runTest(testSession.getValue(),siteName,false,testInstance,sections,params,stopOnFirstFailure); }
public File testLogCache(TestSession testSession) { return new File(testLogCache(), testSession.getValue()); }
public Site getSite(String siteName, TestSession testSession) throws Exception { if (siteName.equals(FAKE_SITE_NAME)) return FAKE_SITE; if (siteName == null) throw new Exception("Internal error: null site requested"); if (siteName.equals("gov/nist/toolkit/installation/shared")) return new Site("gov/nist/toolkit/installation/shared", testSession); List<String> sitenames = getSiteNames(); if ( !sitenames.contains(siteName)) { if (sitenames.contains(testSession.getValue() + "__" + siteName)) siteName = testSession.getValue() + "__" + siteName; else if (!sitenames.contains(siteName)) throw new Exception("Site [" + siteName + "] is not defined"); } Site s = siteMap.get(siteName); return s; }
public File actorsDir(TestSession testSession) { if (testSession == null) throw new ToolkitRuntimeException("TestSession is null"); File f = new File(actorsDir(), testSession.getValue()); f.mkdirs(); return f; }
public File testSessionMgmtDir(TestSession testSession) { return new File(new File(Installation.instance().externalCache(), "TestSessionMgmt"), testSession.getValue()); }
/** * @return a {@link File} object representing the simdb directory, that is, * the directory in which information for simulators is maintained on disc. */ public File simDbFile(TestSession testSession) { if (testSession == null) throw new ToolkitRuntimeException("TestSession is null"); return new File(simDbFile(), testSession.getValue()); }
private void build(TestSession testSession, String id) throws BadSimIdException { testSession.clean(); id = cleanId(id); if (testSession.getValue().contains(SEPARATOR)) throw new BadSimIdException(SEPARATOR + " is illegal in simulator testSession name"); if (testSession.getValue().contains(SLASH)) throw new BadSimIdException(SLASH + " is illegal in simulator testSession name"); if (id.contains(SLASH)) throw new BadSimIdException(SLASH + " is illegal in simulator id"); this.testSession = testSession; this.id = id; }
public boolean isValid() { return (!isEmpty(testSession.getValue())) && (!isEmpty(id)); } public void setValid(boolean x) { }
public Site getActorSite(SimulatorConfig asc, Site site) throws NoSimulatorException { Site finalSite = buildActorSite(asc, site); if (finalSite == null) return null; finalSite.setOwner(asc.getTestSession().getValue()); return finalSite; }
LogRepository(File location, TestSession testSession, LogIdIOFormat format, LogIdType idType, TestInstance id) { this.location = location; this.testSession = testSession.getValue(); this.format = format; this.idType = idType; this.id = id; if (id != null) { if (location != null) id.setLocation(location.toString()); id.setTestSession(testSession); id.setFormat(format); id.setIdType(idType); } }
private String getQualifiedName(Site s) { TestSession owningTestSession = (s.getOwner() == null) ? TestSession.DEFAULT_TEST_SESSION : new TestSession(s.getOwner()); if (Installation.instance().testSessionExists(owningTestSession) || owningTestSession.equals(TestSession.GAZELLE_TEST_SESSION)) return owningTestSession.getValue() + ":" + s.getName(); return "UNDEFINED:" + s.getName(); }
static public SimIdResource asSimIdBean(gov.nist.toolkit.simcommon.client.SimId simId) { SimIdResource bean = new SimIdResource(); bean.setId(simId.getId()); bean.setUser(simId.getTestSession().getValue()); bean.setActorType(simId.getActorType()); bean.setEnvironmentName(simId.getEnvironmentName()); return bean; }
public void promoteSiteToDefault(String siteName, TestSession testSession) throws Exception { SeparateSiteLoader srcLoader = new SeparateSiteLoader(testSession); File srcDir = Installation.instance().actorsDir(testSession); Sites sites = srcLoader.load(srcDir, new Sites(testSession)); Site site = sites.getSite(siteName, testSession); site.setOwner(testSession.getValue()); SeparateSiteLoader tgtLoader = new SeparateSiteLoader(TestSession.DEFAULT_TEST_SESSION); File tgtDir = Installation.instance().actorsDir(TestSession.DEFAULT_TEST_SESSION); tgtLoader.saveToFile(tgtDir, site); srcLoader.delete(srcDir, siteName); }
static public SimConfigResource asSimConfigBean(SimulatorConfig config) { SimConfigResource bean = new SimConfigResource(); bean.setId(config.getId().getId()); bean.setUser(config.getId().getTestSession().getValue()); bean.setActorType(config.getActorType()); for (SimulatorConfigElement ele : config.getElements()) { if (ele.hasBoolean()) { bean.setProperty(ele.name, ele.asBoolean()); } else if (ele.hasString()) { bean.setProperty(ele.name, ele.asString()); } else if (ele.hasList()) { bean.setProperty(ele.name, ele.asList()); } } return bean; }
public TestSessionStatsTool(List<TestSessionStats> stats) { panel.add(new HTML("<h2>Test Session Statistics</h2>")); FlexTable table = new FlexTable(); table.setHTML(0, 0, "Test Session"); table.setHTML(0, 1, "Last Updated"); table.setHTML(0, 2, "Expires"); table.setHTML(0, 3, "is expired"); table.setHTML(0, 4, "Expiration Policy"); int row = 1; for (TestSessionStats stat : stats) { table.setHTML(row, 0, stat.getTestSession().getValue()); table.setHTML(row, 1, stat.getLastUpdated()); table.setHTML(row, 2, (stat.isExpired()) ? "" : stat.getExpires()); table.setHTML(row, 3, (stat.isExpired()) ? "True" : "False"); table.setHTML(row, 4, stat.getExpirationPolicy().toString()); row++; } panel.add(table); }