Package org.openengsb.core.edbi.models

Examples of org.openengsb.core.edbi.models.TestModel


        when(commit.getTimestamp()).thenReturn(new Date(42));
        // TODO: mock entire commit

        List models = new ArrayList<>();

        models.add(new TestModel("A", 42));
        models.add(new TestModel("B", -42));

        InsertOperation operation = new InsertOperation(commit, testIndex, models);

        engine.execute(operation);
View Full Code Here


        engine.create(testIndex);

        IndexCommit commit = mock(IndexCommit.class);
        when(commit.getTimestamp()).thenReturn(new Date(42));

        TestModel testModelA = new TestModel("A", 42);
        TestModel testModelB = new TestModel("B", -42);

        List<OpenEngSBModel> list = new ArrayList<>();

        list.add((OpenEngSBModel) testModelA);
        list.add((OpenEngSBModel) testModelB);

        engine.execute(new InsertOperation(commit, testIndex, list));

        testModelB.setTestInteger(43);

        IndexCommit updateCommit = mock(IndexCommit.class);
        when(updateCommit.getTimestamp()).thenReturn(new Date(84));
        engine.execute(new UpdateOperation(updateCommit, testIndex, new ArrayList(Arrays.asList(testModelB))));
View Full Code Here

        engine.create(testIndex);

        IndexCommit commit = mock(IndexCommit.class);
        when(commit.getTimestamp()).thenReturn(new Date(42));

        TestModel testModelA = new TestModel("A", 42);
        TestModel testModelB = new TestModel("B", -42);

        engine.execute(new InsertOperation(commit, testIndex, new ArrayList(Arrays.asList(testModelA, testModelB))));

        IndexCommit deleteCommit = mock(IndexCommit.class);
        when(deleteCommit.getTimestamp()).thenReturn(new Date(84));
View Full Code Here

        when(commit.getTimestamp()).thenReturn(new Date(42));
        // TODO: mock entire commit

        List models = new ArrayList<>();

        models.add(new TestModel("A", 42));
        models.add(new TestModel("B", -42));

        InsertOperation operation = new InsertOperation(commit, testIndex, models);

        engine.execute(operation);
View Full Code Here

        engine.create(testIndex);

        IndexCommit commit = mock(IndexCommit.class);
        when(commit.getTimestamp()).thenReturn(new Date(42));

        TestModel testModelA = new TestModel("A", 42);
        TestModel testModelB = new TestModel("B", -42);

        engine.execute(new InsertOperation(commit, testIndex, new ArrayList(Arrays.asList(testModelA, testModelB))));

        testModelB.setTestInteger(43);

        IndexCommit updateCommit = mock(IndexCommit.class);
        when(updateCommit.getTimestamp()).thenReturn(new Date(84));
        engine.execute(new UpdateOperation(updateCommit, testIndex,
            new ArrayList(Arrays.asList(testModelA, testModelB))));
View Full Code Here

        engine.create(testIndex);

        IndexCommit commit = mock(IndexCommit.class);
        when(commit.getTimestamp()).thenReturn(new Date(42));

        TestModel testModelA = new TestModel("A", 42);
        TestModel testModelB = new TestModel("B", -42);

        engine.execute(new InsertOperation(commit, testIndex, new ArrayList(Arrays.asList(testModelA, testModelB))));

        IndexCommit deleteCommit = mock(IndexCommit.class);
        when(deleteCommit.getTimestamp()).thenReturn(new Date(84));
View Full Code Here

    public void commit_createsIndexInherently() throws Exception {
        assertFalse(engine.indexExists(TestModel.class));
        assertEquals(0, jdbc().queryForInt("SELECT COUNT(*) FROM INDEX_INFORMATION"));

        IndexCommit commit = newTestCommit()
            .insert(new TestModel("foo", 1))
            .get();

        engine.commit(commit);

        assertEquals(1, jdbc().queryForInt("SELECT COUNT(*) FROM INDEX_INFORMATION"));
View Full Code Here

    public void commit_insertWithSubmodel_shouldProperlyInsertRecords() throws Exception {
        SubTestModel submodel = new SubTestModel(11);

        IndexCommit commit = newTestCommit()
            .insert(submodel)
            .insert(new TestModel("foo", 1, submodel))
            .insert(new TestModel("bar", 2))
            .get();

        engine.commit(commit);

        assertEquals(2,
View Full Code Here

        assertEquals("testInstance", record.get("REV_INSTANCEID"));
    }

    @Test
    public void commit_update_updatesTablesCorrectly() throws Exception {
        TestModel entity = new TestModel("foo", 1);

        // initial insert
        IndexCommit insertCommit = newTestCommit().insert(entity).get();
        engine.commit(insertCommit);

        // update
        entity.setTestInteger(42);
        IndexCommit updateCommit = newTestCommit().update(entity).get();
        engine.commit(updateCommit);

        // assert
View Full Code Here

        assertFalse(rowset.next());
    }

    @Test
    public void commit_delete_updatesTablesCorrectly() throws Exception {
        TestModel entity = new TestModel("foo", 1);

        // initial insert
        IndexCommit insertCommit = newTestCommit().insert(entity).get();
        engine.commit(insertCommit);
View Full Code Here

TOP

Related Classes of org.openengsb.core.edbi.models.TestModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.