@Test public void createProjectTest() throws CatalogException, JsonProcessingException { Project p = new Project("1000G", "Project about some genomes", "Today", "Cool", new Status(), "", 1000, "", null, 1); System.out.println(catalogProjectDBAdaptor.insert(p, user1.getId(), null)); p = new Project("2000G", "Project about some more genomes", "Tomorrow", "Cool", new Status(), "", 3000, "", null, 1); System.out.println(catalogProjectDBAdaptor.insert(p, user1.getId(), null)); p = new Project("pmp", "Project management project", "yesterday", "it is a system", new Status(), "", 2000, "", null, 1); System.out.println(catalogProjectDBAdaptor.insert(p, user2.getId(), null)); System.out.println(catalogProjectDBAdaptor.insert(p, user1.getId(), null)); try { System.out.println(catalogProjectDBAdaptor.insert(p, user1.getId(), null)); fail("Expected \"projectAlias already exists\" exception"); } catch (CatalogDBException e) { System.out.println(e); } }
Arrays.<Project>asList(new Project("P1", "project", "", new Status(), "", null, 1), new Project("P2", "project", "", new Status(), "", null, 1), new Project("P3", "project", "", new Status(), "", null, 1)), Collections.<Tool>emptyList(), new HashMap<>(), new HashMap<>()); QueryResult createUser = catalogUserDBAdaptor.insert(user1, null); Arrays.asList(new Project("pr", "lncRNAs", null, "My description", "My org", null, new Status(), "", 0, Arrays.asList( new Study("spongeScan", "spongeScan", "sponges", Study.Type.COLLECTION, "", "", new Status(), "", 0, "",
Project project = new Project(id, name, description, new Status(), organization, organism, 1);
@Test public void deleteProjectTest() throws CatalogException { Project p = new Project("2000G", "Project about some more genomes", null, "Cool", new Status(), "", 3000, "", null, 1); QueryResult<Project> result = catalogProjectDBAdaptor.insert(p, user1.getId(), null); System.out.println(result.first().getStatus()); p = result.first(); QueryResult<Project> queryResult = catalogProjectDBAdaptor.delete(p.getUid(), new QueryOptions()); System.out.println(queryResult.first().getStatus()); assertTrue(queryResult.getNumResults() == 1); //thrown.expect(CatalogDBException.class); //catalogProjectDBAdaptor.delete(p.getId()); thrown.expect(CatalogDBException.class); //Expected "Project not found" exception catalogProjectDBAdaptor.delete(-1, new QueryOptions()); }
/** * cases: * ok: correct projectId, correct newName * error: non-existent projectId * error: newName already used * error: newName == oldName * * @throws CatalogDBException */ @Test public void renameProjectTest() throws CatalogException { Project p1 = catalogProjectDBAdaptor.insert(new Project("p1", "project1", null, "Cool", new Status(), "", 3000, "", null, 1), user1.getId(), null).first(); Project p2 = catalogProjectDBAdaptor.insert(new Project("p2", "project2", null, "Cool", new Status(), "", 3000, "", null, 1), user1.getId(), null).first(); catalogProjectDBAdaptor.editId(user1.getId(), p1.getUid(), "p1", "newpmp"); try { catalogProjectDBAdaptor.editId(user1.getId(), -1, "", "falseProject"); fail("renamed project with projectId=-1"); } catch (CatalogDBException e) { System.out.println("correct exception: " + e); } try { catalogProjectDBAdaptor.editId(user1.getId(), p1.getUid(), "newpmp", p2.getId()); fail("renamed project with name collision"); } catch (CatalogDBException e) { System.out.println("correct exception: " + e); } }