diff --git a/impl/core/src/test/java/lifecycle/LifecycleClassWithPriority.java b/impl/core/src/test/java/lifecycle/LifecycleClassWithPriority.java
new file mode 100644
index 0000000..8bff24b
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleClassWithPriority.java
@@ -0,0 +1,89 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import static br.gov.frameworkdemoiselle.annotation.Priority.MAX_PRIORITY;
+import static br.gov.frameworkdemoiselle.annotation.Priority.MIN_PRIORITY;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import br.gov.frameworkdemoiselle.annotation.Priority;
+import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
+import br.gov.frameworkdemoiselle.lifecycle.Startup;
+
+@ApplicationScoped
+public class LifecycleClassWithPriority {
+
+ private List priorityStartup = new ArrayList();
+
+ private List priorityShutdown = new ArrayList();
+
+ public List getPriorityStartup() {
+ return priorityStartup;
+ }
+
+ public List getPriorityShutdown() {
+ return priorityShutdown;
+ }
+
+ @Startup
+ @Priority(MIN_PRIORITY)
+ public void loadWithMinPriority() {
+ priorityStartup.add(2);
+ }
+
+ @Startup
+ @Priority(MAX_PRIORITY)
+ public void loadWithMaxPriority() {
+ priorityStartup.add(1);
+ }
+
+ @Shutdown
+ @Priority(MIN_PRIORITY)
+ public void unloadWithMinPriority() {
+ priorityShutdown.add(1);
+ }
+
+ @Shutdown
+ @Priority(MAX_PRIORITY)
+ public void unloadWithMaxPriority() {
+ priorityShutdown.add(2);
+ }
+}
diff --git a/impl/core/src/test/java/lifecycle/LifecycleSimple.java b/impl/core/src/test/java/lifecycle/LifecycleSimple.java
new file mode 100644
index 0000000..2eb4c8a
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleSimple.java
@@ -0,0 +1,68 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
+import br.gov.frameworkdemoiselle.lifecycle.Startup;
+
+@ApplicationScoped
+public class LifecycleSimple {
+
+ private boolean startup = false;
+
+ private boolean shutdown = false;
+
+ public boolean isStartup() {
+ return startup;
+ }
+
+ public boolean isShutdown() {
+ return shutdown;
+ }
+
+ @Startup
+ public void load() {
+ startup = true;
+ }
+
+ @Shutdown
+ public void unload() {
+ shutdown = true;
+ }
+}
diff --git a/impl/core/src/test/java/lifecycle/LifecycleSimpleTest.java b/impl/core/src/test/java/lifecycle/LifecycleSimpleTest.java
new file mode 100644
index 0000000..f93819e
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleSimpleTest.java
@@ -0,0 +1,83 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import test.Tests;
+import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
+import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
+import br.gov.frameworkdemoiselle.util.Beans;
+
+@RunWith(Arquillian.class)
+public class LifecycleSimpleTest {
+
+ @Inject
+ private LifecycleSimple simpleClass;
+
+ @Deployment
+ public static JavaArchive createDeployment() {
+ JavaArchive deployment = Tests.createDeployment(LifecycleSimpleTest.class);
+ return deployment;
+ }
+
+ @Test
+ public void testStartup() {
+ Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
+ });
+
+ Assert.assertEquals(true, simpleClass.isStartup());
+ }
+
+ @Test
+ public void testShutdown() {
+ Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
+ });
+
+ Assert.assertEquals(true, simpleClass.isShutdown());
+ }
+
+}
+
diff --git a/impl/core/src/test/java/lifecycle/LifecycleWithPriorityTest.java b/impl/core/src/test/java/lifecycle/LifecycleWithPriorityTest.java
new file mode 100644
index 0000000..c2d400d
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleWithPriorityTest.java
@@ -0,0 +1,91 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import test.Tests;
+import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
+import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
+import br.gov.frameworkdemoiselle.util.Beans;
+
+@RunWith(Arquillian.class)
+public class LifecycleWithPriorityTest {
+
+ @Inject
+ private LifecycleClassWithPriority lifecycleClassWithPriority;
+
+ List expected = new ArrayList();
+
+ @Deployment
+ public static JavaArchive createDeployment() {
+ JavaArchive deployment = Tests.createDeployment(LifecycleWithPriorityTest.class);
+ return deployment;
+ }
+
+ @Test
+ public void testStartup() {
+ Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
+ });
+ expected.add(1);
+ expected.add(2);
+
+ Assert.assertEquals(expected, lifecycleClassWithPriority.getPriorityStartup());
+ }
+
+ @Test
+ public void testShutdown() {
+ Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
+ });
+ expected.clear();
+ expected.add(2);
+ expected.add(1);
+
+ Assert.assertEquals(expected, lifecycleClassWithPriority.getPriorityShutdown());
+ }
+}
diff --git a/impl/core/src/test/java/lifecycle/LifecycleWithoutPriority.java b/impl/core/src/test/java/lifecycle/LifecycleWithoutPriority.java
new file mode 100644
index 0000000..55fc7b3
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleWithoutPriority.java
@@ -0,0 +1,92 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import br.gov.frameworkdemoiselle.lifecycle.Shutdown;
+import br.gov.frameworkdemoiselle.lifecycle.Startup;
+
+@ApplicationScoped
+public class LifecycleWithoutPriority {
+
+ private List priorityStartup = new ArrayList();
+
+ private List priorityShutdown = new ArrayList();
+
+ public List getPriorityStartup() {
+ return priorityStartup;
+ }
+
+ public List getPriorityShutdown() {
+ return priorityShutdown;
+ }
+
+ @Startup
+ public void loadWithoutPriorityFirst() {
+ priorityStartup.add(1);
+ }
+
+ @Startup
+ public void loadWithoutPrioritySecond() {
+ priorityStartup.add(3);
+ }
+
+ @Startup
+ public void loadWithoutPriorityThird() {
+ priorityStartup.add(2);
+ }
+
+ @Shutdown
+ public void unloadWithoutPriorityFirst() {
+ priorityShutdown.add(3);
+ }
+
+ @Shutdown
+ public void unloadWithoutPrioritySecond() {
+ priorityShutdown.add(2);
+ }
+
+ @Shutdown
+ public void unloadWithoutPriorityThird() {
+ priorityShutdown.add(1);
+ }
+
+}
diff --git a/impl/core/src/test/java/lifecycle/LifecycleWithoutPriorityTest.java b/impl/core/src/test/java/lifecycle/LifecycleWithoutPriorityTest.java
new file mode 100644
index 0000000..58e56ce
--- /dev/null
+++ b/impl/core/src/test/java/lifecycle/LifecycleWithoutPriorityTest.java
@@ -0,0 +1,94 @@
+/*
+ * Demoiselle Framework
+ * Copyright (C) 2010 SERPRO
+ * ----------------------------------------------------------------------------
+ * This file is part of Demoiselle Framework.
+ *
+ * Demoiselle Framework is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License version 3
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License version 3
+ * along with this program; if not, see
+ * or write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ * ----------------------------------------------------------------------------
+ * Este arquivo é parte do Framework Demoiselle.
+ *
+ * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou
+ * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação
+ * do Software Livre (FSF).
+ *
+ * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA
+ * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou
+ * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português
+ * para maiores detalhes.
+ *
+ * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título
+ * "LICENCA.txt", junto com esse programa. Se não, acesse
+ * ou escreva para a Fundação do Software Livre (FSF) Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.
+ */
+package lifecycle;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import test.Tests;
+import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
+import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess;
+import br.gov.frameworkdemoiselle.util.Beans;
+
+@RunWith(Arquillian.class)
+public class LifecycleWithoutPriorityTest {
+
+ @Inject
+ private LifecycleWithoutPriority lifecycleWithoutPriority;
+
+ List expected = new ArrayList();
+
+ @Deployment
+ public static JavaArchive createDeployment() {
+ JavaArchive deployment = Tests.createDeployment(LifecycleWithoutPriorityTest.class);
+ return deployment;
+ }
+
+ @Test
+ public void testStartup() {
+ Beans.getBeanManager().fireEvent(new AfterStartupProccess() {
+ });
+ expected.add(1);
+ expected.add(3);
+ expected.add(2);
+
+ Assert.assertEquals(expected, lifecycleWithoutPriority.getPriorityStartup());
+ }
+
+ @Test
+ public void testShutdown() {
+ Beans.getBeanManager().fireEvent(new AfterShutdownProccess() {
+ });
+ expected.clear();
+ expected.add(3);
+ expected.add(2);
+ expected.add(1);
+
+ Assert.assertEquals(expected, lifecycleWithoutPriority.getPriorityShutdown());
+ }
+
+}
--
libgit2 0.21.2