move reladomo ex to librarie-data (#2485)

This commit is contained in:
lor6
2017-08-23 11:53:21 +03:00
committed by Grzegorz Piwowarek
parent ccba3de765
commit 18b1334ff1
17 changed files with 126 additions and 96 deletions
@@ -0,0 +1,38 @@
package com.baeldung.reladomo;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.gs.fw.common.mithra.test.ConnectionManagerForTests;
import com.gs.fw.common.mithra.test.MithraTestResource;
public class ReladomoTest {
private MithraTestResource mithraTestResource;
@Before
public void setUp() throws Exception {
this.mithraTestResource = new MithraTestResource("reladomo/ReladomoTestConfig.xml");
final ConnectionManagerForTests connectionManager = ConnectionManagerForTests.getInstanceForDbName("testDb");
this.mithraTestResource.createSingleDatabase(connectionManager);
mithraTestResource.addTestDataToDatabase("reladomo/test-data.txt", connectionManager);
this.mithraTestResource.setUp();
}
@Test
public void whenGetTestData_thenOk() {
Employee employee = EmployeeFinder.findByPrimaryKey(1);
assertEquals(employee.getName(), "Paul");
}
@After
public void tearDown() throws Exception {
this.mithraTestResource.tearDown();
}
}
@@ -0,0 +1,7 @@
<MithraRuntime>
<ConnectionManager className="com.gs.fw.common.mithra.test.ConnectionManagerForTests">
<Property name="resourceName" value="testDb"/>
<MithraObjectConfiguration className="com.baeldung.reladomo.Department" cacheType="partial"/>
<MithraObjectConfiguration className="com.baeldung.reladomo.Employee " cacheType="partial"/>
</ConnectionManager>
</MithraRuntime>
@@ -0,0 +1,7 @@
class com.baeldung.reladomo.Department
id, name
1, "Marketing"
class com.baeldung.reladomo.Employee
id, name
1, "Paul"