Package com.impetus.kundera.graph

Examples of com.impetus.kundera.graph.Node


     * .
     */
    @Test
    public void testHandleRollback()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleRollback(storeNode);
    }
View Full Code Here


     * .
     */
    @Test
    public void testHandleFind()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleFind(storeNode);
    }
View Full Code Here

     * .
     */
    @Test
    public void testHandleGetReference()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleGetReference(storeNode);
    }
View Full Code Here

     * .
     */
    @Test
    public void testHandleContains()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleContains(storeNode);
    }
View Full Code Here

     * .
     */
    @Test
    public void testHandleClear()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleClear(storeNode);
    }
View Full Code Here

     * .
     */
    @Test
    public void testHandleFlush()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handleFlush(storeNode);
    }
View Full Code Here

     */
    @Test
    public void testMoveNodeToNextState()
    {
        NodeState nodeState = new TransientState();
        NodeStateContext node = new Node("1", PersonnelDTO.class, nodeState, pc, "1", null);
        nodeState.moveNodeToNextState(node, new ManagedState());
        Assert.assertEquals(ManagedState.class, node.getCurrentNodeState().getClass());
    }
View Full Code Here

    @Test
    public void testRecursivelyPerformOperation()
    {
        // Persist operation
        NodeState state = new TransientState();
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.recursivelyPerformOperation(storeNode, OPERATION.PERSIST);
        Assert.assertEquals(TransientState.class, storeNode.getCurrentNodeState().getClass());

        for (Node childNode : storeNode.getChildren().values())
        {
            Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
//            Assert.assertEquals(ManagedState.class, childNode.getCurrentNodeState().getClass());
        }

        // Merge operation
        state = new DetachedState();
        storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.MERGE);
        state.recursivelyPerformOperation(storeNode, OPERATION.MERGE);
        Assert.assertEquals(DetachedState.class, storeNode.getCurrentNodeState().getClass());

        for (Node childNode : storeNode.getChildren().values())
        {
            Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
//            Assert.assertEquals(ManagedState.class, childNode.getCurrentNodeState().getClass());
        }

        // Remove Operation
        state = new ManagedState();
        storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.REMOVE);
        state.recursivelyPerformOperation(storeNode, OPERATION.REMOVE);
        Assert.assertEquals(ManagedState.class, storeNode.getCurrentNodeState().getClass());

        for (Node childNode : storeNode.getChildren().values())
        {
            Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
//            Assert.assertEquals(RemovedState.class, childNode.getCurrentNodeState().getClass());
        }

        // Refresh Operation
        state = new DetachedState();
        storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.REFRESH);
        try
        {
            state.recursivelyPerformOperation(storeNode, OPERATION.REFRESH);
            Assert.fail("Refresh operation in Detached state should have thrown an exception");
        }
        catch (Exception e)
        {
            Assert.assertEquals(IllegalArgumentException.class, e.getClass());
        }

        // Remove Operation
        state = new ManagedState();
        storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.DETACH);
        state.recursivelyPerformOperation(storeNode, OPERATION.DETACH);
        Assert.assertEquals(ManagedState.class, storeNode.getCurrentNodeState().getClass());

        for (Node childNode : storeNode.getChildren().values())
        {
            Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
//            Assert.assertEquals(DetachedState.class, childNode.getCurrentNodeState().getClass());
        }
View Full Code Here

     * .
     */
    @Test
    public void testInitialize()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.initialize(storeNode);
        Assert.assertNotNull(pc);
    }
View Full Code Here

     * .
     */
    @Test
    public void testHandlePersist()
    {
        Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.PERSIST);
        state.handlePersist(storeNode);

        Assert.assertEquals(ManagedState.class, storeNode.getCurrentNodeState().getClass());

//        for (Node childNode : storeNode.getChildren().values())
//        {
//            Assert.assertEquals(BillingCounter.class, childNode.getDataClass());
//            Assert.assertEquals(ManagedState.class, childNode.getCurrentNodeState().getClass());
View Full Code Here

TOP

Related Classes of com.impetus.kundera.graph.Node

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.