package br.net.mirante.singular.test;

import br.net.mirante.singular.Definicao;
import br.net.mirante.singular.InstanciaDefinicao;
import br.net.mirante.singular.TestDAO;
import br.net.mirante.singular.TestMBPMBean;
import br.net.mirante.singular.flow.core.MBPM;
import br.net.mirante.singular.persistence.entity.TaskType;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.*;

import javax.inject.Inject;
import javax.transaction.Transactional;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class DefinitionTest {

    @Inject
    private TestMBPMBean mbpmBean;

    @Inject
    private TestDAO testDAO;

    @Before
    public void setup() {
        assertNotNull(mbpmBean);
        MBPM.setConf(mbpmBean);
    }

    @Transactional
    @Test
    public void teste() {

        InstanciaDefinicao id = new InstanciaDefinicao();
        id.start();

        InstanciaDefinicao id2 = MBPM.findProcessInstance(id.getFullId());
        assertNotNull(id2);
        System.out.println("legal");
    }

    @Test
    public void loadTabelas() {
        List<TaskType> taskTypes = testDAO.listTaskType();
        assertEquals(4, taskTypes.size());
    }

    @Test
    public void testeInserir() {
        TaskType tt = new TaskType();
        tt.setAbbreviation("teste");

        testDAO.save(tt);

    }

}

@@ -36,50 +36,8 @@
 t;%0A%0A
-import br.net.mirante.singular.Definicao;%0A
 impo
@@ -83,16 +83,16 @@
 inicao;%0A
+
 import b
@@ -265,24 +265,113 @@
 .entity.
-TaskType
+*;%0Aimport br.net.mirante.singular.persistence.entity.Process;%0Aimport org.hibernate.SessionFactory
 ;%0Aimport
@@ -582,42 +582,8 @@
 ner;
-%0Aimport static org.junit.Assert.*;
 %0A%0Aim
@@ -672,16 +672,108 @@
 .List;%0A%0A
+import static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNotNull;%0A%0A
 @RunWith
@@ -983,16 +983,72 @@
 stDAO;%0A%0A
+    @Inject%0A    private SessionFactory sessionFactory;%0A%0A
     @Bef
@@ -1524,32 +1524,32 @@
 listTaskType();%0A
-
         assertEq
@@ -1574,32 +1574,1822 @@
 size());%0A    %7D%0A%0A
+    @Test%0A    @Transactional%0A    public void veriifcarAcessoEmTodasAsTabelas() %7B%0A        sessionFactory.getCurrentSession().createCriteria(Actor.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Category.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(ExecutionVariable.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Process.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(ProcessDefinition.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(ProcessInstance.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(ProcessRight.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(ProcessRightPK.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Role.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(RoleInstance.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Task.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskDefinition.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskHistoryType.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskInstance.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskInstanceHistory.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskRight.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(TaskType.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Transition.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(Variable.class).list();%0A        sessionFactory.getCurrentSession().createCriteria(VariableType.class).list();%0A    %7D%0A%0A
     @Test%0A    pu

Teste de acesso a tabelas.