@Test public void DirectoryWithContentIsFileSystemPage() throws Exception { fileSystem.makeFile("./somepath/WikiPage/content.txt", "stuff"); fileSystem.makeFile("./somepath/WikiPage/subsuite/myfile.html", "stuff"); WikiPage page = pageRepository.makeChildPage("WikiPage", rootPage); assertEquals(FileSystemPage.class, page.getClass()); }
private void createDirectoryIfNewPage(FileSystem fileSystem) throws Exception { String pagePath = getFileSystemPath(); if (!fileSystem.exists(pagePath)) { fileSystem.makeDirectory(pagePath); cmSystem.update(pagePath); } }
@Test public void DirectoryOfHtmlFilesIsExternalSuitePageChild() throws Exception { fileSystem.makeFile("./somepath/ExternalSuite/subsuite/myfile.html", "stuff"); ExternalSuitePage page = (ExternalSuitePage) pageRepository.makeChildPage("ExternalSuite", rootPage); WikiPage child = pageRepository.findChildren(page).get(0); assertEquals(ExternalSuitePage.class, child.getClass()); assertEquals("SubsuitE", child.getName()); }
private void run() { FileSystem.setAssnId(MAIN_ASSN_ID); // load the necessary graphs loadGraphs(); statMax = new TreeMap<String, Pair<String, Double>>(); // test the policy graph against the ground truth File policyDir = new File(FileSystem.getAssnDir(), "policies"); for (File policyFile : FileSystem.listFiles(policyDir)) { String ext = FileSystem.getExtension(policyFile.getName()); if (!ext.equals("txt")) continue; String name = policyFile.getName(); Map<String, String> policy = FileSystem.getFileMapString(policyFile); generateStats(name, policy); } System.out.println(""); System.out.println("Best:"); for (String test : statMax.keySet()) { System.out.println(test + ": " + statMax.get(test).getFirst()); } }
private void run() { FileSystem.setAssnId(MAIN_ASSN_ID); DirectedGraph<String> p1 = GraphLoader.loadPolicy("nodeRank.txt"); DirectedGraph<String> p2 = GraphLoader.loadPolicy("nodeRank6.txt"); Set<String> verticies = new HashSet<String>(); verticies.addAll(p1.vertexSet()); verticies.addAll(p2.vertexSet()); ArrayList<Integer> idSet = new ArrayList<Integer>(); for (String s : verticies) { int id = Integer.parseInt(s); idSet.add(id); } Collections.sort(idSet); List<String> sortedList = new ArrayList<String>(); for (int s : idSet) { sortedList.add("" + s); } for (String v : sortedList) { if (Integer.parseInt(v) > 100) continue; if (!p1.containsVertex(v)) { System.out.println("p1 missing: " + v); } if (!p2.containsVertex(v)) { System.out.println("p2 missing: " + v); } String n1 = getNext(p1, v); String n2 = getNext(p2, v); if (!n1.equals(n2)) { System.out.println("diff " + v + ":\t" + n1 + "\t" + n2); } } }
@Test public void DirectoryOfDirectoryOfHtmlFilesIsExternalSuitePage() throws Exception { fileSystem.makeFile("./somepath/ExternalSuite/subsuite/myfile.html", "stuff"); WikiPage page = pageRepository.makeChildPage("ExternalSuite", rootPage); assertEquals(ExternalSuitePage.class, page.getClass()); }
public static void main(String[] args) { FileSystem.setAssnId(MAIN_ASSN_ID); new IndependentProbablePath().run(); }