Commit 0ffc9345d612993906c91a762d1c77baeb8dc885

Authored by Ednara Oliveira
1 parent 76c84182
Exists in master

Pacotes para testes de lifecycle

impl/core/src/test/java/lifecycle/LifecycleClassWithPriority.java
... ... @@ -1,89 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import static br.gov.frameworkdemoiselle.annotation.Priority.MAX_PRIORITY;
40   -import static br.gov.frameworkdemoiselle.annotation.Priority.MIN_PRIORITY;
41   -
42   -import java.util.ArrayList;
43   -import java.util.List;
44   -
45   -import javax.enterprise.context.ApplicationScoped;
46   -
47   -import br.gov.frameworkdemoiselle.annotation.Priority;
48   -import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
49   -import br.gov.frameworkdemoiselle.lifecycle.Startup;
50   -
51   -@ApplicationScoped
52   -public class LifecycleClassWithPriority {
53   -
54   - private List<Integer> priorityStartup = new ArrayList<Integer>();
55   -
56   - private List<Integer> priorityShutdown = new ArrayList<Integer>();
57   -
58   - public List<Integer> getPriorityStartup() {
59   - return priorityStartup;
60   - }
61   -
62   - public List<Integer> getPriorityShutdown() {
63   - return priorityShutdown;
64   - }
65   -
66   - @Startup
67   - @Priority(MIN_PRIORITY)
68   - public void loadWithMinPriority() {
69   - priorityStartup.add(2);
70   - }
71   -
72   - @Startup
73   - @Priority(MAX_PRIORITY)
74   - public void loadWithMaxPriority() {
75   - priorityStartup.add(1);
76   - }
77   -
78   - @Shutdown
79   - @Priority(MIN_PRIORITY)
80   - public void unloadWithMinPriority() {
81   - priorityShutdown.add(1);
82   - }
83   -
84   - @Shutdown
85   - @Priority(MAX_PRIORITY)
86   - public void unloadWithMaxPriority() {
87   - priorityShutdown.add(2);
88   - }
89   -}
impl/core/src/test/java/lifecycle/LifecycleSimple.java
... ... @@ -1,68 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import javax.enterprise.context.ApplicationScoped;
40   -
41   -import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
42   -import br.gov.frameworkdemoiselle.lifecycle.Startup;
43   -
44   -@ApplicationScoped
45   -public class LifecycleSimple {
46   -
47   - private boolean startup = false;
48   -
49   - private boolean shutdown = false;
50   -
51   - public boolean isStartup() {
52   - return startup;
53   - }
54   -
55   - public boolean isShutdown() {
56   - return shutdown;
57   - }
58   -
59   - @Startup
60   - public void load() {
61   - startup = true;
62   - }
63   -
64   - @Shutdown
65   - public void unload() {
66   - shutdown = true;
67   - }
68   -}
impl/core/src/test/java/lifecycle/LifecycleSimpleTest.java
... ... @@ -1,83 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import javax.inject.Inject;
40   -
41   -import junit.framework.Assert;
42   -
43   -import org.jboss.arquillian.container.test.api.Deployment;
44   -import org.jboss.arquillian.junit.Arquillian;
45   -import org.jboss.shrinkwrap.api.spec.JavaArchive;
46   -import org.junit.Test;
47   -import org.junit.runner.RunWith;
48   -
49   -import test.Tests;
50   -import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
51   -import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
52   -import br.gov.frameworkdemoiselle.util.Beans;
53   -
54   -@RunWith(Arquillian.class)
55   -public class LifecycleSimpleTest {
56   -
57   - @Inject
58   - private LifecycleSimple simpleClass;
59   -
60   - @Deployment
61   - public static JavaArchive createDeployment() {
62   - JavaArchive deployment = Tests.createDeployment(LifecycleSimpleTest.class);
63   - return deployment;
64   - }
65   -
66   - @Test
67   - public void testStartup() {
68   - Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
69   - });
70   -
71   - Assert.assertEquals(true, simpleClass.isStartup());
72   - }
73   -
74   - @Test
75   - public void testShutdown() {
76   - Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
77   - });
78   -
79   - Assert.assertEquals(true, simpleClass.isShutdown());
80   - }
81   -
82   -}
83   -
impl/core/src/test/java/lifecycle/LifecycleWithPriorityTest.java
... ... @@ -1,91 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import java.util.ArrayList;
40   -import java.util.List;
41   -
42   -import javax.inject.Inject;
43   -
44   -import junit.framework.Assert;
45   -
46   -import org.jboss.arquillian.container.test.api.Deployment;
47   -import org.jboss.arquillian.junit.Arquillian;
48   -import org.jboss.shrinkwrap.api.spec.JavaArchive;
49   -import org.junit.Test;
50   -import org.junit.runner.RunWith;
51   -
52   -import test.Tests;
53   -import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
54   -import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
55   -import br.gov.frameworkdemoiselle.util.Beans;
56   -
57   -@RunWith(Arquillian.class)
58   -public class LifecycleWithPriorityTest {
59   -
60   - @Inject
61   - private LifecycleClassWithPriority lifecycleClassWithPriority;
62   -
63   - List<Integer> expected = new ArrayList<Integer>();
64   -
65   - @Deployment
66   - public static JavaArchive createDeployment() {
67   - JavaArchive deployment = Tests.createDeployment(LifecycleWithPriorityTest.class);
68   - return deployment;
69   - }
70   -
71   - @Test
72   - public void testStartup() {
73   - Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
74   - });
75   - expected.add(1);
76   - expected.add(2);
77   -
78   - Assert.assertEquals(expected, lifecycleClassWithPriority.getPriorityStartup());
79   - }
80   -
81   - @Test
82   - public void testShutdown() {
83   - Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
84   - });
85   - expected.clear();
86   - expected.add(2);
87   - expected.add(1);
88   -
89   - Assert.assertEquals(expected, lifecycleClassWithPriority.getPriorityShutdown());
90   - }
91   -}
impl/core/src/test/java/lifecycle/LifecycleWithoutPriority.java
... ... @@ -1,92 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import java.util.ArrayList;
40   -import java.util.List;
41   -
42   -import javax.enterprise.context.ApplicationScoped;
43   -
44   -import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
45   -import br.gov.frameworkdemoiselle.lifecycle.Startup;
46   -
47   -@ApplicationScoped
48   -public class LifecycleWithoutPriority {
49   -
50   - private List<Integer> priorityStartup = new ArrayList<Integer>();
51   -
52   - private List<Integer> priorityShutdown = new ArrayList<Integer>();
53   -
54   - public List<Integer> getPriorityStartup() {
55   - return priorityStartup;
56   - }
57   -
58   - public List<Integer> getPriorityShutdown() {
59   - return priorityShutdown;
60   - }
61   -
62   - @Startup
63   - public void loadWithoutPriorityFirst() {
64   - priorityStartup.add(1);
65   - }
66   -
67   - @Startup
68   - public void loadWithoutPrioritySecond() {
69   - priorityStartup.add(3);
70   - }
71   -
72   - @Startup
73   - public void loadWithoutPriorityThird() {
74   - priorityStartup.add(2);
75   - }
76   -
77   - @Shutdown
78   - public void unloadWithoutPriorityFirst() {
79   - priorityShutdown.add(3);
80   - }
81   -
82   - @Shutdown
83   - public void unloadWithoutPrioritySecond() {
84   - priorityShutdown.add(2);
85   - }
86   -
87   - @Shutdown
88   - public void unloadWithoutPriorityThird() {
89   - priorityShutdown.add(1);
90   - }
91   -
92   -}
impl/core/src/test/java/lifecycle/LifecycleWithoutPriorityTest.java
... ... @@ -1,94 +0,0 @@
1   -/*
2   - * Demoiselle Framework
3   - * Copyright (C) 2010 SERPRO
4   - * ----------------------------------------------------------------------------
5   - * This file is part of Demoiselle Framework.
6   - *
7   - * Demoiselle Framework is free software; you can redistribute it and/or
8   - * modify it under the terms of the GNU Lesser General Public License version 3
9   - * as published by the Free Software Foundation.
10   - *
11   - * This program is distributed in the hope that it will be useful,
12   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14   - * GNU General Public License for more details.
15   - *
16   - * You should have received a copy of the GNU Lesser General Public License version 3
17   - * along with this program; if not, see <http://www.gnu.org/licenses/>
18   - * or write to the Free Software Foundation, Inc., 51 Franklin Street,
19   - * Fifth Floor, Boston, MA 02110-1301, USA.
20   - * ----------------------------------------------------------------------------
21   - * Este arquivo é parte do Framework Demoiselle.
22   - *
23   - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
24   - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
25   - * do Software Livre (FSF).
26   - *
27   - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
28   - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
29   - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
30   - * para maiores detalhes.
31   - *
32   - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
33   - * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
34   - * ou escreva para a Fundação do Software Livre (FSF) Inc.,
35   - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
36   - */
37   -package lifecycle;
38   -
39   -import java.util.ArrayList;
40   -import java.util.List;
41   -
42   -import javax.inject.Inject;
43   -
44   -import junit.framework.Assert;
45   -
46   -import org.jboss.arquillian.container.test.api.Deployment;
47   -import org.jboss.arquillian.junit.Arquillian;
48   -import org.jboss.shrinkwrap.api.spec.JavaArchive;
49   -import org.junit.Test;
50   -import org.junit.runner.RunWith;
51   -
52   -import test.Tests;
53   -import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
54   -import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
55   -import br.gov.frameworkdemoiselle.util.Beans;
56   -
57   -@RunWith(Arquillian.class)
58   -public class LifecycleWithoutPriorityTest {
59   -
60   - @Inject
61   - private LifecycleWithoutPriority lifecycleWithoutPriority;
62   -
63   - List<Integer> expected = new ArrayList<Integer>();
64   -
65   - @Deployment
66   - public static JavaArchive createDeployment() {
67   - JavaArchive deployment = Tests.createDeployment(LifecycleWithoutPriorityTest.class);
68   - return deployment;
69   - }
70   -
71   - @Test
72   - public void testStartup() {
73   - Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
74   - });
75   - expected.add(1);
76   - expected.add(3);
77   - expected.add(2);
78   -
79   - Assert.assertEquals(expected, lifecycleWithoutPriority.getPriorityStartup());
80   - }
81   -
82   - @Test
83   - public void testShutdown() {
84   - Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
85   - });
86   - expected.clear();
87   - expected.add(3);
88   - expected.add(2);
89   - expected.add(1);
90   -
91   - Assert.assertEquals(expected, lifecycleWithoutPriority.getPriorityShutdown());
92   - }
93   -
94   -}
impl/core/src/test/java/lifecycle/shutdown/priority/ShutdownWithPriority.java 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.shutdown.priority;
  38 +
  39 +import static br.gov.frameworkdemoiselle.annotation.Priority.MAX_PRIORITY;
  40 +import static br.gov.frameworkdemoiselle.annotation.Priority.MIN_PRIORITY;
  41 +
  42 +import java.util.ArrayList;
  43 +import java.util.List;
  44 +
  45 +import javax.enterprise.context.ApplicationScoped;
  46 +
  47 +import br.gov.frameworkdemoiselle.annotation.Priority;
  48 +import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
  49 +
  50 +@ApplicationScoped
  51 +public class ShutdownWithPriority {
  52 +
  53 + private List<Integer> listShutdown = new ArrayList<Integer>();
  54 +
  55 + public List<Integer> getListShutdown() {
  56 + return listShutdown;
  57 + }
  58 +
  59 + @Shutdown
  60 + @Priority(MIN_PRIORITY)
  61 + public void unloadWithMinPriority() {
  62 + listShutdown.add(3);
  63 + }
  64 +
  65 + @Shutdown
  66 + @Priority(1)
  67 + public void unloadWithPriority1() {
  68 + listShutdown.add(2);
  69 + }
  70 +
  71 + @Shutdown
  72 + @Priority(MAX_PRIORITY)
  73 + public void unloadWithMaxPriority() {
  74 + listShutdown.add(1);
  75 + }
  76 +}
... ...
impl/core/src/test/java/lifecycle/shutdown/priority/ShutdownWithPriorityTest.java 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.shutdown.priority;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.inject.Inject;
  43 +
  44 +import junit.framework.Assert;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Before;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import test.Tests;
  54 +import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
  55 +import br.gov.frameworkdemoiselle.util.Beans;
  56 +
  57 +@RunWith(Arquillian.class)
  58 +public class ShutdownWithPriorityTest {
  59 +
  60 + @Inject
  61 + private ShutdownWithPriority shutdownWithPriority;
  62 +
  63 + List<Integer> expected = new ArrayList<Integer>();
  64 +
  65 + @Deployment
  66 + public static JavaArchive createDeployment() {
  67 + JavaArchive deployment = Tests.createDeployment(ShutdownWithPriorityTest.class);
  68 + return deployment;
  69 + }
  70 +
  71 + @Before
  72 + public void fireEvent() {
  73 + Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
  74 + });
  75 + }
  76 +
  77 + @Test
  78 + public void shutdownWithPriority() {
  79 + expected.add(1);
  80 + expected.add(2);
  81 + expected.add(3);
  82 +
  83 + Assert.assertEquals(expected, shutdownWithPriority.getListShutdown());
  84 + }
  85 +}
... ...
impl/core/src/test/java/lifecycle/shutdown/simple/ShutdownSimple.java 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.shutdown.simple;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.enterprise.context.ApplicationScoped;
  43 +
  44 +import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
  45 +
  46 +@ApplicationScoped
  47 +public class ShutdownSimple {
  48 +
  49 + private List<Integer> listShutdown = new ArrayList<Integer>();
  50 +
  51 + public List<Integer> getListShutdown() {
  52 + return listShutdown;
  53 + }
  54 +
  55 + @Shutdown
  56 + public void unloadWithoutPriorityFirst() {
  57 + listShutdown.add(3);
  58 + }
  59 +
  60 + @Shutdown
  61 + public void unloadWithoutPrioritySecond() {
  62 + listShutdown.add(2);
  63 + }
  64 +
  65 + @Shutdown
  66 + public void unloadWithoutPriorityThird() {
  67 + listShutdown.add(1);
  68 + }
  69 +}
... ...
impl/core/src/test/java/lifecycle/shutdown/simple/ShutdownSimpleTest.java 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.shutdown.simple;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.inject.Inject;
  43 +
  44 +import junit.framework.Assert;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Before;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import test.Tests;
  54 +import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
  55 +import br.gov.frameworkdemoiselle.util.Beans;
  56 +
  57 +@RunWith(Arquillian.class)
  58 +public class ShutdownSimpleTest {
  59 +
  60 + @Inject
  61 + private ShutdownSimple shutdownSimple;
  62 +
  63 + List<Integer> expected = new ArrayList<Integer>();
  64 +
  65 + @Deployment
  66 + public static JavaArchive createDeployment() {
  67 + JavaArchive deployment = Tests.createDeployment(ShutdownSimpleTest.class);
  68 + return deployment;
  69 + }
  70 +
  71 + @Before
  72 + public void fireEvent() {
  73 + Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
  74 + });
  75 + }
  76 +
  77 + @Test
  78 + public void testShutdown() {
  79 + expected.add(3);
  80 + expected.add(2);
  81 + expected.add(1);
  82 +
  83 + Assert.assertEquals(expected, shutdownSimple.getListShutdown());
  84 + }
  85 +}
... ...
impl/core/src/test/java/lifecycle/startup/priority/StartupWithPriority.java 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.startup.priority;
  38 +
  39 +import static br.gov.frameworkdemoiselle.annotation.Priority.MAX_PRIORITY;
  40 +import static br.gov.frameworkdemoiselle.annotation.Priority.MIN_PRIORITY;
  41 +
  42 +import java.util.ArrayList;
  43 +import java.util.List;
  44 +
  45 +import javax.enterprise.context.ApplicationScoped;
  46 +
  47 +import br.gov.frameworkdemoiselle.annotation.Priority;
  48 +import br.gov.frameworkdemoiselle.lifecycle.Startup;
  49 +
  50 +@ApplicationScoped
  51 +public class StartupWithPriority {
  52 +
  53 + private List<Integer> priorityStartup = new ArrayList<Integer>();
  54 +
  55 + public List<Integer> getPriorityStartup() {
  56 + return priorityStartup;
  57 + }
  58 +
  59 + @Startup
  60 + @Priority(MIN_PRIORITY)
  61 + public void loadWithMinPriority() {
  62 + priorityStartup.add(3);
  63 + }
  64 +
  65 + @Startup
  66 + @Priority(1)
  67 + public void loadWithPriority1() {
  68 + priorityStartup.add(2);
  69 + }
  70 +
  71 + @Startup
  72 + @Priority(MAX_PRIORITY)
  73 + public void loadWithMaxPriority() {
  74 + priorityStartup.add(1);
  75 + }
  76 +}
... ...
impl/core/src/test/java/lifecycle/startup/priority/StartupWithPriorityTest.java 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.startup.priority;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.inject.Inject;
  43 +
  44 +import junit.framework.Assert;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Before;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import test.Tests;
  54 +import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
  55 +import br.gov.frameworkdemoiselle.util.Beans;
  56 +
  57 +@RunWith(Arquillian.class)
  58 +public class StartupWithPriorityTest {
  59 +
  60 + @Inject
  61 + private StartupWithPriority stratupWithPriority;
  62 +
  63 + List<Integer> expected = new ArrayList<Integer>();
  64 +
  65 + @Deployment
  66 + public static JavaArchive createDeployment() {
  67 + JavaArchive deployment = Tests.createDeployment(StartupWithPriorityTest.class);
  68 + return deployment;
  69 + }
  70 +
  71 + @Before
  72 + public void fireEvent() {
  73 + Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
  74 + });
  75 + }
  76 +
  77 + @Test
  78 + public void startupWithPriority() {
  79 + expected.add(1);
  80 + expected.add(2);
  81 + expected.add(3);
  82 +
  83 + Assert.assertEquals(expected, stratupWithPriority.getPriorityStartup());
  84 + }
  85 +}
... ...
impl/core/src/test/java/lifecycle/startup/simple/StartupSimple.java 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.startup.simple;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.enterprise.context.ApplicationScoped;
  43 +
  44 +import br.gov.frameworkdemoiselle.lifecycle.Startup;
  45 +
  46 +@ApplicationScoped
  47 +public class StartupSimple {
  48 +
  49 + private List<Integer> listStartup = new ArrayList<Integer>();
  50 +
  51 + public List<Integer> getListStartup() {
  52 + return listStartup;
  53 + }
  54 +
  55 + @Startup
  56 + public void loadWithoutPriorityFirst() {
  57 + listStartup.add(1);
  58 + }
  59 +
  60 + @Startup
  61 + public void loadWithoutPrioritySecond() {
  62 + listStartup.add(3);
  63 + }
  64 +
  65 + @Startup
  66 + public void loadWithoutPriorityThird() {
  67 + listStartup.add(2);
  68 + }
  69 +}
... ...
impl/core/src/test/java/lifecycle/startup/simple/StartupSimpleTest.java 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +/*
  2 + * Demoiselle Framework
  3 + * Copyright (C) 2010 SERPRO
  4 + * ----------------------------------------------------------------------------
  5 + * This file is part of Demoiselle Framework.
  6 + *
  7 + * Demoiselle Framework is free software; you can redistribute it and/or
  8 + * modify it under the terms of the GNU Lesser General Public License version 3
  9 + * as published by the Free Software Foundation.
  10 + *
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
  15 + *
  16 + * You should have received a copy of the GNU Lesser General Public License version 3
  17 + * along with this program; if not, see <http://www.gnu.org/licenses/>
  18 + * or write to the Free Software Foundation, Inc., 51 Franklin Street,
  19 + * Fifth Floor, Boston, MA 02110-1301, USA.
  20 + * ----------------------------------------------------------------------------
  21 + * Este arquivo é parte do Framework Demoiselle.
  22 + *
  23 + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
  24 + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
  25 + * do Software Livre (FSF).
  26 + *
  27 + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
  28 + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
  29 + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
  30 + * para maiores detalhes.
  31 + *
  32 + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
  33 + * "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>
  34 + * ou escreva para a Fundação do Software Livre (FSF) Inc.,
  35 + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
  36 + */
  37 +package lifecycle.startup.simple;
  38 +
  39 +import java.util.ArrayList;
  40 +import java.util.List;
  41 +
  42 +import javax.inject.Inject;
  43 +
  44 +import junit.framework.Assert;
  45 +
  46 +import org.jboss.arquillian.container.test.api.Deployment;
  47 +import org.jboss.arquillian.junit.Arquillian;
  48 +import org.jboss.shrinkwrap.api.spec.JavaArchive;
  49 +import org.junit.Before;
  50 +import org.junit.Test;
  51 +import org.junit.runner.RunWith;
  52 +
  53 +import test.Tests;
  54 +import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
  55 +import br.gov.frameworkdemoiselle.util.Beans;
  56 +
  57 +@RunWith(Arquillian.class)
  58 +public class StartupSimpleTest {
  59 +
  60 + @Inject
  61 + private StartupSimple startupSimple;
  62 +
  63 + List<Integer> expected = new ArrayList<Integer>();
  64 +
  65 + @Deployment
  66 + public static JavaArchive createDeployment() {
  67 + JavaArchive deployment = Tests.createDeployment(StartupSimpleTest.class);
  68 + return deployment;
  69 + }
  70 +
  71 + @Before
  72 + public void fireEvent() {
  73 + Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
  74 + });
  75 + }
  76 +
  77 + @Test
  78 + public void startup() {
  79 + expected.add(1);
  80 + expected.add(3);
  81 + expected.add(2);
  82 +
  83 + Assert.assertEquals(expected, startupSimple.getListStartup());
  84 + }
  85 +}
  86 +
... ...