use of org.molgenis.emx2.Database in project molgenis-emx2 by molgenis.
the class TestEmx2Roles method testRolesIO.
@Test
public void testRolesIO() {
// create user roles
schema.addMember("bofke", "Viewer");
TableStore store = new TableStoreForCsvInMemory();
// export
Emx2Members.outputRoles(store, schema);
// empty the database, verify
schema = schema.getDatabase().dropCreateSchema(TestEmx2Roles.class.getSimpleName());
assertEquals(0, schema.getMembers().size());
// import and see if consistent
Emx2Members.inputRoles(store, schema);
List<Member> members = schema.getMembers();
assertEquals("bofke", members.get(0).getUser());
assertEquals("Viewer", members.get(0).getRole());
}
use of org.molgenis.emx2.Database in project molgenis-emx2 by molgenis.
the class TestEmx2Roles method setup.
@BeforeClass
public static void setup() {
Database database = TestDatabaseFactory.getTestDatabase();
schema = database.dropCreateSchema(TestEmx2Roles.class.getSimpleName());
}
use of org.molgenis.emx2.Database in project molgenis-emx2 by molgenis.
the class TestImportTableTask method setup.
@BeforeClass
public static void setup() {
Database database = TestDatabaseFactory.getTestDatabase();
schema = database.dropCreateSchema(TestImportTableTask.class.getSimpleName());
}
use of org.molgenis.emx2.Database in project molgenis-emx2 by molgenis.
the class Benchmark method testCopyInAndOut.
public void testCopyInAndOut() {
Database database = TestDatabaseFactory.getTestDatabase();
Schema schema = database.dropCreateSchema(Benchmark.class.getSimpleName());
int aSize = 50;
int bSize = 100000;
Table a = schema.create(table("TableA").add(column("ID").setPkey()));
List<String> values = new ArrayList<>();
Table b = schema.create(table("TableB").add(column("ID").setPkey()).add(column("ref").setType(REF_ARRAY).setRefTable("TableA")));
// Table c =
// schema.create(
// table("TableC")
// .add(column("ID").setPkey())
// .add(column("ref").setType(MREF).setRefTable("TableA")));
StopWatch.start("benchmark started");
List<Row> aRows = new ArrayList<>();
for (int i = 0; i < aSize; i++) {
aRows.add(new Row().set("ID", "row" + i));
values.add("row" + i);
}
StopWatch.start("benchmark1");
a.insert(aRows);
StopWatch.print("inserted primary", aSize);
aRows.clear();
List<Row> bRows = new ArrayList<>();
for (int i = 0; i < bSize; i++) {
bRows.add(new Row().set("ID", "row" + i).set("ref", values));
}
StopWatch.start("benchmark2 started");
b.insert(bRows);
StopWatch.print("inserted ref_array", bSize);
bRows.clear();
// List<Row> cRows = new ArrayList<>();
// for (int i = 0; i < bSize; i++) {
// cRows.add(new Row().set("ID", "row" + i).set("ref", values));
// }
// StopWatch.start("benchmark3 started");
// c.insert(cRows);
// StopWatch.print("inserted mref", bSize);
// cRows.clear();
// StopWatch.print("inserted mref", bSize);
// ref_array
}
use of org.molgenis.emx2.Database in project molgenis-emx2 by molgenis.
the class TestMetaDataIsStoredForNextSessions method testArrayTypesTest.
@Test
public void testArrayTypesTest() {
Schema schema = database.dropCreateSchema(SCHEMA_NAME + "3");
ArrayTypeTestExample.createSimpleTypeTest(schema.getMetadata());
try {
CompareTools.reloadAndCompare(database, schema);
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations