Search in sources :

Example 1 with TableStoreForCsvInMemory

use of org.molgenis.emx2.io.tablestore.TableStoreForCsvInMemory 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());
}
Also used : TableStoreForCsvInMemory(org.molgenis.emx2.io.tablestore.TableStoreForCsvInMemory) Member(org.molgenis.emx2.Member) TableStore(org.molgenis.emx2.io.tablestore.TableStore) Test(org.junit.Test)

Example 2 with TableStoreForCsvInMemory

use of org.molgenis.emx2.io.tablestore.TableStoreForCsvInMemory in project molgenis-emx2 by molgenis.

the class TestEmx2Settings method testRolesIO.

@Test
public void testRolesIO() {
    // create settings
    schema.getMetadata().setSetting("foo", "bar");
    // export
    TableStore store = new TableStoreForCsvInMemory();
    Emx2Settings.outputSettings(store, schema);
    // empty the database, verify
    schema = schema.getDatabase().dropCreateSchema(TestEmx2Settings.class.getSimpleName());
    assertEquals(0, schema.getMetadata().getSettings().size());
    // import and see if consistent
    Emx2Settings.inputSettings(store, schema);
    List<Setting> settings = schema.getMetadata().getSettings();
    assertEquals("foo", settings.get(0).key());
    assertEquals("bar", settings.get(0).value());
}
Also used : TableStoreForCsvInMemory(org.molgenis.emx2.io.tablestore.TableStoreForCsvInMemory) Setting(org.molgenis.emx2.Setting) TableStore(org.molgenis.emx2.io.tablestore.TableStore) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 TableStore (org.molgenis.emx2.io.tablestore.TableStore)2 TableStoreForCsvInMemory (org.molgenis.emx2.io.tablestore.TableStoreForCsvInMemory)2 Member (org.molgenis.emx2.Member)1 Setting (org.molgenis.emx2.Setting)1