Package org.openengsb.core.edb.api

Examples of org.openengsb.core.edb.api.EngineeringDatabaseService


    private QueryInterfaceService service;

    @Before
    public void setup() {
        this.service = new QueryInterfaceService();
        EngineeringDatabaseService edbService = mock(EngineeringDatabaseService.class);

        EDBObject edbObject = new EDBObject("testoid");
        edbObject.putEDBObjectEntry("id", "testid");
        edbObject.putEDBObjectEntry("date", new Date());
        edbObject.putEDBObjectEntry("name", "testname");
        edbObject.putEDBObjectEntry("enumeration", "A", ENUM.class);
        edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 0), "blub");
        edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 1), "blab");
        edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 2), "blob");
        edbObject.putEDBObjectEntry("sub", "suboid1", SubModel.class);
        edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 0), "suboid2", SubModel.class);
        edbObject.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 1), "suboid3", SubModel.class);
        edbObject.putEDBObjectEntry("number", Integer.valueOf(42));
        edbObject.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel.class.getName());

        EDBObject edbObjectImpl = new EDBObject("testoidimpl");
        edbObjectImpl.putEDBObjectEntry("id", "testid");
        edbObjectImpl.putEDBObjectEntry("date", new Date());
        edbObjectImpl.putEDBObjectEntry("name", "testname");
        edbObjectImpl.putEDBObjectEntry("enumeration", "A", ENUM.class);
        edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 0), "blub");
        edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 1), "blab");
        edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("list", 2), "blob");
        edbObjectImpl.putEDBObjectEntry("sub", "suboid1", SubModel.class);
        edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 0), "suboid2", SubModel.class);
        edbObjectImpl.putEDBObjectEntry(EDBConverter.getEntryNameForList("subs", 1), "suboid3", SubModel.class);
        edbObjectImpl.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel2.class.getName());

        EDBObject mapTest = new EDBObject("mapoid");
        mapTest.putEDBObjectEntry("id", "testid");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 0), "keyA");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 0), "valueA");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 1), "keyB");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 1), "valueB");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapKey("map", 2), "keyC");
        mapTest.putEDBObjectEntry(EDBConverter.getEntryNameForMapValue("map", 2), "valueC");
        mapTest.putEDBObjectEntry("number", Integer.valueOf(42));
        mapTest.putEDBObjectEntry(EDBConstants.MODEL_TYPE, TestModel.class.getName());

        EDBObject subObject1 = new EDBObject("suboid1");
        subObject1.putEDBObjectEntry("id", "testid");
        subObject1.putEDBObjectEntry("value", "testvalue");
        subObject1.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());

        EDBObject subObject2 = new EDBObject("suboid2");
        subObject2.putEDBObjectEntry("id", "AAAAA");
        subObject2.putEDBObjectEntry("value", "BBBBB");
        subObject2.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());

        EDBObject subObject3 = new EDBObject("suboid3");
        subObject3.putEDBObjectEntry("id", "CCCCC");
        subObject3.putEDBObjectEntry("value", "DDDDD");
        subObject3.putEDBObjectEntry(EDBConstants.MODEL_TYPE, SubModel.class.getName());

        when(edbService.getObject(eq("testoid"), anyLong())).thenReturn(edbObject);
        when(edbService.getObject(eq("testoidimpl"), anyLong())).thenReturn(edbObjectImpl);
        when(edbService.getObject(eq("mapoid"), anyLong())).thenReturn(mapTest);
        when(edbService.getObject(eq("suboid1"), anyLong())).thenReturn(subObject1);
        when(edbService.getObject(eq("suboid2"), anyLong())).thenReturn(subObject2);
        when(edbService.getObject(eq("suboid3"), anyLong())).thenReturn(subObject3);
        when(edbService.getObject("testoid")).thenReturn(edbObject);
        when(edbService.getObject("testoidimpl")).thenReturn(edbObjectImpl);
        when(edbService.getObject("mapoid")).thenReturn(mapTest);
        when(edbService.getObject("suboid1")).thenReturn(subObject1);
        when(edbService.getObject("suboid2")).thenReturn(subObject2);
        when(edbService.getObject("suboid3")).thenReturn(subObject3);

        service.setEdbService(edbService);
        service.setEdbConverter(new EDBConverter(edbService));
        List<QueryParser> parsers = new ArrayList<>();
        parsers.add(new DefaultQueryParser());
View Full Code Here


public class PersistInterfaceServiceTest {
    private PersistInterfaceService service;

    @Before
    public void setUp() {
        EngineeringDatabaseService edbService = mock(EngineeringDatabaseService.class);
        EDBConverter converter = new EDBConverter(edbService);
        List<EKBPreCommitHook> preHooks = new ArrayList<EKBPreCommitHook>();
        List<EKBPostCommitHook> postHooks = new ArrayList<EKBPostCommitHook>();
        List<EKBErrorHook> errorHooks = new ArrayList<EKBErrorHook>();
        EDBCommit result = mock(EDBCommit.class);
        when(edbService.createEDBCommit(anyListOf(EDBObject.class), anyListOf(EDBObject.class),
            anyListOf(EDBObject.class))).thenReturn(result);
        this.service = new PersistInterfaceService(edbService, converter, preHooks, postHooks, errorHooks
            , "DEACTIVED");
        ContextHolder.get().setCurrentContextId("test");
    }
View Full Code Here

        this.mode = mode;
    }

    @Before
    public void setup() {
        EngineeringDatabaseService edbService = new TestEngineeringDatabaseService();
        EDBConverter edbConverter = new EDBConverter(edbService);
        TransformationEngine transformationEngine = new TestTransformationEngine();
        ModelRegistry modelRegistry = new TestModelRegistry();
        enhancer = new EngineeringObjectEnhancer(edbService, edbConverter,
            transformationEngine, modelRegistry, mode.toString());
View Full Code Here

TOP

Related Classes of org.openengsb.core.edb.api.EngineeringDatabaseService

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.