Commit a71d341f7d8ec50004b16f44d28703ca3afd5632

Authored by Cleverson Sacramento
1 parent 385c7857
Exists in master

Remoção do ramo example

example/.gitignore
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -/target  
2 -/.project  
3 -/.classpath  
4 -/.settings  
5 -/.externalToolBuilders  
example/initializer/.gitignore
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -/target  
2 -/.project  
3 -/.classpath  
4 -/.settings  
5 -/.externalToolBuilders  
example/initializer/pom.xml
@@ -1,74 +0,0 @@ @@ -1,74 +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 -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"  
38 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  
39 -  
40 - <modelVersion>4.0.0</modelVersion>  
41 -  
42 - <artifactId>demoiselle-initializer-example</artifactId>  
43 - <packaging>jar</packaging>  
44 -  
45 - <name></name>  
46 - <description></description>  
47 - <url></url>  
48 -  
49 - <parent>  
50 - <groupId>br.gov.frameworkdemoiselle</groupId>  
51 - <artifactId>demoiselle-minimal-parent</artifactId>  
52 - <version>2.3.0-RC1-SNAPSHOT</version>  
53 - <relativePath>../../parent/minimal/pom.xml</relativePath>  
54 - </parent>  
55 -  
56 - <dependencies>  
57 - <dependency>  
58 - <groupId>org.slf4j</groupId>  
59 - <artifactId>slf4j-log4j12</artifactId>  
60 - <scope>test</scope>  
61 - </dependency>  
62 - </dependencies>  
63 -  
64 - <repositories>  
65 - <repository>  
66 - <id>demoiselle.sourceforge.net-release</id>  
67 - <url>http://demoiselle.sourceforge.net/repository/release</url>  
68 - </repository>  
69 - </repositories>  
70 -  
71 - <properties>  
72 - <demoiselle.junit.version>2.3.0-RC1-SNAPSHOT</demoiselle.junit.version>  
73 - </properties>  
74 -</project>  
example/initializer/src/main/java/example/Hello.java
@@ -1,86 +0,0 @@ @@ -1,86 +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 example;  
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 -import br.gov.frameworkdemoiselle.lifecycle.Shutdown;  
50 -  
51 -@ApplicationScoped  
52 -public class Hello {  
53 -  
54 - private List<String> list = new ArrayList<String>();  
55 -  
56 - public List<String> getList() {  
57 - return list;  
58 - }  
59 -  
60 - public void say() {  
61 - list.add("Hello World");  
62 - }  
63 -  
64 - @Startup  
65 - public void load() {  
66 - list.add("Startup: Priority Not Defined");  
67 - }  
68 -  
69 - @Startup  
70 - @Priority(MIN_PRIORITY)  
71 - public void loadWithMinPriority() {  
72 - list.add("Startup: Min Priority");  
73 - }  
74 -  
75 - @Shutdown  
76 - @Priority(1)  
77 - public void unload() {  
78 - list.add("Shutdown: Priority 1");  
79 - }  
80 -  
81 - @Shutdown  
82 - @Priority(MAX_PRIORITY)  
83 - public void unloadWithMaxPriority() {  
84 - list.add("Shutdown: Max Priority");  
85 - }  
86 -}  
example/initializer/src/main/resources/META-INF/beans.xml
@@ -1,40 +0,0 @@ @@ -1,40 +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 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
38 - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">  
39 -  
40 -</beans>  
example/initializer/src/main/resources/demoiselle.properties
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -# Demoiselle Framework  
2 -# Copyright (C) 2010 SERPRO  
3 -# ----------------------------------------------------------------------------  
4 -# This file is part of Demoiselle Framework.  
5 -#  
6 -# Demoiselle Framework is free software; you can redistribute it and/or  
7 -# modify it under the terms of the GNU Lesser General Public License version 3  
8 -# as published by the Free Software Foundation.  
9 -#  
10 -# This program is distributed in the hope that it will be useful,  
11 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
12 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
13 -# GNU General Public License for more details.  
14 -#  
15 -# You should have received a copy of the GNU Lesser General Public License version 3  
16 -# along with this program; if not, see <http://www.gnu.org/licenses/>  
17 -# or write to the Free Software Foundation, Inc., 51 Franklin Street,  
18 -# Fifth Floor, Boston, MA 02110-1301, USA.  
19 -# ----------------------------------------------------------------------------  
20 -# Este arquivo é parte do Framework Demoiselle.  
21 -#  
22 -# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
23 -# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
24 -# do Software Livre (FSF).  
25 -#  
26 -# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
27 -# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
28 -# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
29 -# para maiores detalhes.  
30 -#  
31 -# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
32 -# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
33 -# ou escreva para a Fundação do Software Livre (FSF) Inc.,  
34 -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
35 \ No newline at end of file 0 \ No newline at end of file
example/initializer/src/test/java/example/InitializerAdvancedTest.java
@@ -1,90 +0,0 @@ @@ -1,90 +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 example;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import java.util.ArrayList;  
42 -import java.util.List;  
43 -  
44 -import org.junit.AfterClass;  
45 -import org.junit.BeforeClass;  
46 -import org.junit.Test;  
47 -import org.junit.runner.RunWith;  
48 -  
49 -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner;  
50 -import br.gov.frameworkdemoiselle.util.Beans;  
51 -  
52 -@RunWith(DemoiselleRunner.class)  
53 -public class InitializerAdvancedTest {  
54 -  
55 - private static Hello hello = Beans.getReference(Hello.class);  
56 -  
57 - private static List<String> expected = new ArrayList<String>();  
58 -  
59 - @BeforeClass  
60 - public static void beforeClass() {  
61 - expected.add("Startup: Priority Not Defined");  
62 - expected.add("Startup: Min Priority");  
63 -  
64 - assertEquals(expected, hello.getList());  
65 - }  
66 -  
67 - @Test  
68 - public void enqueueingAfterStartup() {  
69 - hello.say();  
70 - expected.add("Hello World");  
71 -  
72 - assertEquals(expected, hello.getList());  
73 - }  
74 -  
75 - @Test  
76 - public void enqueueingAfterStartupAgain() {  
77 - hello.say();  
78 - expected.add("Hello World");  
79 -  
80 - assertEquals(expected, hello.getList());  
81 - }  
82 -  
83 - @AfterClass  
84 - public static void afterClass() {  
85 - expected.add("Shutdown: Max Priority");  
86 - expected.add("Shutdown: Priority 1");  
87 -  
88 - assertEquals(expected, hello.getList());  
89 - }  
90 -}  
example/initializer/src/test/java/example/InitializerSimpleTest.java
@@ -1,69 +0,0 @@ @@ -1,69 +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 example;  
38 -  
39 -import static junit.framework.Assert.assertEquals;  
40 -  
41 -import org.junit.AfterClass;  
42 -import org.junit.BeforeClass;  
43 -import org.junit.Test;  
44 -import org.junit.runner.RunWith;  
45 -  
46 -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner;  
47 -import br.gov.frameworkdemoiselle.util.Beans;  
48 -  
49 -@RunWith(DemoiselleRunner.class)  
50 -public class InitializerSimpleTest {  
51 -  
52 - private static Hello hello = Beans.getReference(Hello.class);  
53 -  
54 - @BeforeClass  
55 - public static void beforeClass() {  
56 - assertEquals(2, hello.getList().size());  
57 - }  
58 -  
59 - @Test  
60 - public void enqueueingAfterStartup() {  
61 - hello.say();  
62 - assertEquals(3, hello.getList().size());  
63 - }  
64 -  
65 - @AfterClass  
66 - public static void afterClass() {  
67 - assertEquals(5, hello.getList().size());  
68 - }  
69 -}  
example/initializer/src/test/resources/META-INF/beans.xml
@@ -1,47 +0,0 @@ @@ -1,47 +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 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">  
38 -  
39 - <interceptors>  
40 - <class>br.gov.frameworkdemoiselle.internal.interceptor.ExceptionHandlerInterceptor</class>  
41 - <class>br.gov.frameworkdemoiselle.internal.interceptor.RequiredPermissionInterceptor</class>  
42 - <class>br.gov.frameworkdemoiselle.internal.interceptor.RequiredRoleInterceptor</class>  
43 - <class>br.gov.frameworkdemoiselle.internal.interceptor.TransactionalInterceptor</class>  
44 - <class>br.gov.frameworkdemoiselle.internal.interceptor.ConfigurationInterceptor</class>  
45 - </interceptors>  
46 -  
47 -</beans>  
48 \ No newline at end of file 0 \ No newline at end of file
example/initializer/src/test/resources/log4j.properties
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -# Demoiselle Framework  
2 -# Copyright (C) 2010 SERPRO  
3 -# ----------------------------------------------------------------------------  
4 -# This file is part of Demoiselle Framework.  
5 -#  
6 -# Demoiselle Framework is free software; you can redistribute it and/or  
7 -# modify it under the terms of the GNU Lesser General Public License version 3  
8 -# as published by the Free Software Foundation.  
9 -#  
10 -# This program is distributed in the hope that it will be useful,  
11 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
12 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
13 -# GNU General Public License for more details.  
14 -#  
15 -# You should have received a copy of the GNU Lesser General Public License version 3  
16 -# along with this program; if not, see <http://www.gnu.org/licenses/>  
17 -# or write to the Free Software Foundation, Inc., 51 Franklin Street,  
18 -# Fifth Floor, Boston, MA 02110-1301, USA.  
19 -# ----------------------------------------------------------------------------  
20 -# Este arquivo é parte do Framework Demoiselle.  
21 -#  
22 -# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
23 -# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
24 -# do Software Livre (FSF).  
25 -#  
26 -# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
27 -# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
28 -# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
29 -# para maiores detalhes.  
30 -#  
31 -# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
32 -# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
33 -# ou escreva para a Fundação do Software Livre (FSF) Inc.,  
34 -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
35 -  
36 -log4j.rootLogger=INFO, A1  
37 -log4j.appender.A1=org.apache.log4j.ConsoleAppender  
38 -log4j.appender.A1.layout=org.apache.log4j.PatternLayout  
39 -log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n  
example/pom.xml
@@ -1,89 +0,0 @@ @@ -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 -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"  
38 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  
39 -  
40 - <modelVersion>4.0.0</modelVersion>  
41 -  
42 - <groupId>br.gov.frameworkdemoiselle</groupId>  
43 - <artifactId>demoiselle-framework-example-build</artifactId>  
44 - <version>2.3.0-RC1-SNAPSHOT</version>  
45 - <packaging>pom</packaging>  
46 -  
47 - <name>Examples Build Aggregator</name>  
48 - <description>Demoiselle Examples Build Aggregator</description>  
49 -  
50 - <modules>  
51 - <module>initializer</module>  
52 - <module>security</module>  
53 - </modules>  
54 -  
55 - <build>  
56 - <plugins>  
57 - <plugin>  
58 - <groupId>org.codehaus.mojo</groupId>  
59 - <artifactId>wagon-maven-plugin</artifactId>  
60 - <configuration>  
61 - <url>.</url>  
62 - <skip>true</skip>  
63 - </configuration>  
64 - </plugin>  
65 - <plugin>  
66 - <groupId>org.apache.maven.plugins</groupId>  
67 - <artifactId>maven-deploy-plugin</artifactId>  
68 - <configuration>  
69 - <skip>true</skip>  
70 - </configuration>  
71 - </plugin>  
72 - </plugins>  
73 - </build>  
74 -  
75 - <distributionManagement>  
76 - <repository>  
77 - <id />  
78 - <url />  
79 - </repository>  
80 - <snapshotRepository>  
81 - <id />  
82 - <url />  
83 - </snapshotRepository>  
84 - <site>  
85 - <id />  
86 - <url>file://${project.build.directory}/tmp</url>  
87 - </site>  
88 - </distributionManagement>  
89 -</project>  
example/security/.gitignore
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -/target  
2 -/.project  
3 -/.classpath  
4 -/.settings  
5 -/.externalToolBuilders  
example/security/pom.xml
@@ -1,74 +0,0 @@ @@ -1,74 +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 -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"  
38 - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">  
39 -  
40 - <modelVersion>4.0.0</modelVersion>  
41 -  
42 - <artifactId>demoiselle-security-example</artifactId>  
43 - <packaging>jar</packaging>  
44 -  
45 - <name></name>  
46 - <description></description>  
47 - <url></url>  
48 -  
49 - <parent>  
50 - <groupId>br.gov.frameworkdemoiselle</groupId>  
51 - <artifactId>demoiselle-minimal-parent</artifactId>  
52 - <version>2.3.0-RC1-SNAPSHOT</version>  
53 - <relativePath>../../parent/minimal/pom.xml</relativePath>  
54 - </parent>  
55 -  
56 - <dependencies>  
57 - <dependency>  
58 - <groupId>org.slf4j</groupId>  
59 - <artifactId>slf4j-log4j12</artifactId>  
60 - <scope>test</scope>  
61 - </dependency>  
62 - </dependencies>  
63 -  
64 - <repositories>  
65 - <repository>  
66 - <id>demoiselle.sourceforge.net-release</id>  
67 - <url>http://demoiselle.sourceforge.net/repository/release</url>  
68 - </repository>  
69 - </repositories>  
70 -  
71 - <properties>  
72 - <demoiselle.junit.version>2.3.0-RC1-SNAPSHOT</demoiselle.junit.version>  
73 - </properties>  
74 -</project>  
75 \ No newline at end of file 0 \ No newline at end of file
example/security/src/main/java/example/Hello.java
@@ -1,64 +0,0 @@ @@ -1,64 +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 example;  
38 -  
39 -import br.gov.frameworkdemoiselle.security.RequiredPermission;  
40 -import br.gov.frameworkdemoiselle.security.RequiredRole;  
41 -  
42 -public class Hello {  
43 -  
44 - @RequiredPermission(resource = "Hello")  
45 - public void say1() {  
46 - System.out.println("Hello 1");  
47 - }  
48 -  
49 - @RequiredPermission(resource = "World", operation = "scream")  
50 - public void say2() {  
51 - System.out.println("Hello 2");  
52 - }  
53 -  
54 - @RequiredRole("admin")  
55 - public void say3() {  
56 - System.out.println("Hello 3");  
57 - }  
58 -  
59 - @RequiredRole("jedi")  
60 - @RequiredPermission(resource = "World", operation = "say4")  
61 - public void say4() {  
62 - System.out.println("Hello 4");  
63 - }  
64 -}  
example/security/src/main/java/example/MyAuthenticator.java
@@ -1,81 +0,0 @@ @@ -1,81 +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 example;  
38 -  
39 -import javax.enterprise.context.SessionScoped;  
40 -import javax.inject.Inject;  
41 -  
42 -import br.gov.frameworkdemoiselle.security.Authenticator;  
43 -import br.gov.frameworkdemoiselle.security.User;  
44 -  
45 -@SessionScoped  
46 -public class MyAuthenticator implements Authenticator {  
47 -  
48 - private static final long serialVersionUID = 1L;  
49 -  
50 - @Inject  
51 - private MyCredentials credentials;  
52 -  
53 - private User user;  
54 -  
55 - @Override  
56 - public boolean authenticate() {  
57 - boolean authenticated = false;  
58 -  
59 - String username = credentials.getUsername();  
60 - String password = credentials.getPassword();  
61 -  
62 - if ("santos.dumont".equals(username) && "secret".equals(password)) {  
63 - user = new MyUser(credentials.getUsername());  
64 - user.setAttribute("roles", credentials.getRoles());  
65 -  
66 - authenticated = true;  
67 - }  
68 -  
69 - return authenticated;  
70 - }  
71 -  
72 - @Override  
73 - public User getUser() {  
74 - return user;  
75 - }  
76 -  
77 - @Override  
78 - public void unAuthenticate() {  
79 - user = null;  
80 - }  
81 -}  
example/security/src/main/java/example/MyAuthorizer.java
@@ -1,71 +0,0 @@ @@ -1,71 +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 example;  
38 -  
39 -import java.util.List;  
40 -  
41 -import javax.inject.Inject;  
42 -  
43 -import br.gov.frameworkdemoiselle.security.Authorizer;  
44 -import br.gov.frameworkdemoiselle.security.SecurityContext;  
45 -  
46 -public class MyAuthorizer implements Authorizer {  
47 -  
48 - private static final long serialVersionUID = 1L;  
49 -  
50 - @Inject  
51 - private SecurityContext securityContext;  
52 -  
53 - @Override  
54 - @SuppressWarnings("unchecked")  
55 - public boolean hasRole(String role) {  
56 - List<String> roles = (List<String>) securityContext.getUser().getAttribute("roles");  
57 -  
58 - return roles.contains(role);  
59 - }  
60 -  
61 - @Override  
62 - public boolean hasPermission(String resource, String operation) {  
63 - boolean permitted = false;  
64 -  
65 - if (resource.equals("Hello") && operation.equals("say1")) {  
66 - permitted = true;  
67 - }  
68 -  
69 - return permitted;  
70 - }  
71 -}  
example/security/src/main/java/example/MyCredentials.java
@@ -1,79 +0,0 @@ @@ -1,79 +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 example;  
38 -  
39 -import java.io.Serializable;  
40 -import java.util.ArrayList;  
41 -import java.util.List;  
42 -  
43 -import javax.enterprise.context.RequestScoped;  
44 -  
45 -@RequestScoped  
46 -public class MyCredentials implements Serializable {  
47 -  
48 - private static final long serialVersionUID = 1L;  
49 -  
50 - private String username;  
51 -  
52 - private String password;  
53 -  
54 - private List<String> roles = new ArrayList<String>();  
55 -  
56 - public String getUsername() {  
57 - return username;  
58 - }  
59 -  
60 - public void setUsername(String username) {  
61 - this.username = username;  
62 - }  
63 -  
64 - public String getPassword() {  
65 - return password;  
66 - }  
67 -  
68 - public void setPassword(String password) {  
69 - this.password = password;  
70 - }  
71 -  
72 - public List<String> getRoles() {  
73 - return roles;  
74 - }  
75 -  
76 - public void addRole(String role) {  
77 - this.roles.add(role);  
78 - }  
79 -}  
example/security/src/main/java/example/MyUser.java
@@ -1,70 +0,0 @@ @@ -1,70 +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 example;  
38 -  
39 -import java.util.HashMap;  
40 -import java.util.Map;  
41 -  
42 -import br.gov.frameworkdemoiselle.security.User;  
43 -  
44 -public class MyUser implements User {  
45 -  
46 - private static final long serialVersionUID = 1L;  
47 -  
48 - private final String username;  
49 -  
50 - private Map<String, Object> attrs = new HashMap<String, Object>();  
51 -  
52 - public MyUser(String username) {  
53 - this.username = username;  
54 - }  
55 -  
56 - @Override  
57 - public String getId() {  
58 - return this.username;  
59 - }  
60 -  
61 - @Override  
62 - public Object getAttribute(Object key) {  
63 - return this.attrs.get(key);  
64 - }  
65 -  
66 - @Override  
67 - public void setAttribute(Object key, Object value) {  
68 - this.attrs.put((String) key, value);  
69 - }  
70 -}  
example/security/src/main/resources/META-INF/beans.xml
@@ -1,39 +0,0 @@ @@ -1,39 +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 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">  
38 -  
39 -</beans>  
example/security/src/main/resources/demoiselle.properties
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -# Demoiselle Framework  
2 -# Copyright (C) 2010 SERPRO  
3 -# ----------------------------------------------------------------------------  
4 -# This file is part of Demoiselle Framework.  
5 -#  
6 -# Demoiselle Framework is free software; you can redistribute it and/or  
7 -# modify it under the terms of the GNU Lesser General Public License version 3  
8 -# as published by the Free Software Foundation.  
9 -#  
10 -# This program is distributed in the hope that it will be useful,  
11 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
12 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
13 -# GNU General Public License for more details.  
14 -#  
15 -# You should have received a copy of the GNU Lesser General Public License version 3  
16 -# along with this program; if not, see <http://www.gnu.org/licenses/>  
17 -# or write to the Free Software Foundation, Inc., 51 Franklin Street,  
18 -# Fifth Floor, Boston, MA 02110-1301, USA.  
19 -# ----------------------------------------------------------------------------  
20 -# Este arquivo é parte do Framework Demoiselle.  
21 -#  
22 -# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
23 -# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
24 -# do Software Livre (FSF).  
25 -#  
26 -# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
27 -# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
28 -# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
29 -# para maiores detalhes.  
30 -#  
31 -# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
32 -# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
33 -# ou escreva para a Fundação do Software Livre (FSF) Inc.,  
34 -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
example/security/src/test/java/example/AunthenticationTest.java
@@ -1,83 +0,0 @@ @@ -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 example;  
38 -  
39 -import static junit.framework.Assert.assertFalse;  
40 -import static junit.framework.Assert.assertTrue;  
41 -  
42 -import javax.inject.Inject;  
43 -  
44 -import org.junit.Test;  
45 -import org.junit.runner.RunWith;  
46 -  
47 -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner;  
48 -import br.gov.frameworkdemoiselle.security.SecurityContext;  
49 -  
50 -@RunWith(DemoiselleRunner.class)  
51 -public class AunthenticationTest {  
52 -  
53 - @Inject  
54 - private MyCredentials credential;  
55 -  
56 - @Inject  
57 - private SecurityContext securityContext;  
58 -  
59 - @Test  
60 - public void isNotLogged() {  
61 - assertFalse(securityContext.isLoggedIn());  
62 - }  
63 -  
64 - @Test  
65 - public void loginFailed() {  
66 - credential.setUsername("santos.dumont");  
67 - credential.setPassword("123");  
68 - securityContext.login();  
69 -  
70 - assertFalse(securityContext.isLoggedIn());  
71 - }  
72 -  
73 - @Test  
74 - public void loginSuccessful() {  
75 - credential.setUsername("santos.dumont");  
76 - credential.setPassword("secret");  
77 - securityContext.login();  
78 -  
79 - assertTrue(securityContext.isLoggedIn());  
80 -  
81 - securityContext.logout();  
82 - }  
83 -}  
example/security/src/test/java/example/AunthorizationTest.java
@@ -1,99 +0,0 @@ @@ -1,99 +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 example;  
38 -  
39 -import static junit.framework.Assert.fail;  
40 -  
41 -import javax.inject.Inject;  
42 -  
43 -import org.junit.After;  
44 -import org.junit.Before;  
45 -import org.junit.Test;  
46 -import org.junit.runner.RunWith;  
47 -  
48 -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner;  
49 -import br.gov.frameworkdemoiselle.security.AuthorizationException;  
50 -import br.gov.frameworkdemoiselle.security.SecurityContext;  
51 -import br.gov.frameworkdemoiselle.util.Beans;  
52 -  
53 -@RunWith(DemoiselleRunner.class)  
54 -public class AunthorizationTest {  
55 -  
56 - @Inject  
57 - private Hello hello;  
58 -  
59 - @Before  
60 - public void before() {  
61 - MyCredentials myCredentials = Beans.getReference(MyCredentials.class);  
62 -  
63 - myCredentials.setUsername("santos.dumont");  
64 - myCredentials.setPassword("secret");  
65 - myCredentials.addRole("admin");  
66 - myCredentials.addRole("jedi");  
67 -  
68 - SecurityContext securityContext = Beans.getReference(SecurityContext.class);  
69 - securityContext.login();  
70 - }  
71 -  
72 - @After  
73 - public void after() {  
74 - SecurityContext securityContext = Beans.getReference(SecurityContext.class);  
75 - securityContext.logout();  
76 - }  
77 -  
78 - @Test  
79 - public void accessSuccessfulSaying1() {  
80 - hello.say1();  
81 - }  
82 -  
83 - @Test(expected = AuthorizationException.class)  
84 - public void accessFailedSaying2() {  
85 - hello.say2();  
86 - fail();  
87 - }  
88 -  
89 - @Test  
90 - public void accessFailedSaying3() {  
91 - hello.say3();  
92 - }  
93 -  
94 - @Test(expected = AuthorizationException.class)  
95 - public void accessFailedSaying4() {  
96 - hello.say4();  
97 - fail();  
98 - }  
99 -}  
example/security/src/test/resources/META-INF/beans.xml
@@ -1,47 +0,0 @@ @@ -1,47 +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 -<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">  
38 -  
39 - <interceptors>  
40 - <class>br.gov.frameworkdemoiselle.internal.interceptor.ExceptionHandlerInterceptor</class>  
41 - <class>br.gov.frameworkdemoiselle.internal.interceptor.RequiredPermissionInterceptor</class>  
42 - <class>br.gov.frameworkdemoiselle.internal.interceptor.RequiredRoleInterceptor</class>  
43 - <class>br.gov.frameworkdemoiselle.internal.interceptor.TransactionalInterceptor</class>  
44 - <class>br.gov.frameworkdemoiselle.internal.interceptor.ConfigurationInterceptor</class>  
45 - </interceptors>  
46 -  
47 -</beans>  
example/security/src/test/resources/log4j.properties
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -# Demoiselle Framework  
2 -# Copyright (C) 2010 SERPRO  
3 -# ----------------------------------------------------------------------------  
4 -# This file is part of Demoiselle Framework.  
5 -#  
6 -# Demoiselle Framework is free software; you can redistribute it and/or  
7 -# modify it under the terms of the GNU Lesser General Public License version 3  
8 -# as published by the Free Software Foundation.  
9 -#  
10 -# This program is distributed in the hope that it will be useful,  
11 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
12 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
13 -# GNU General Public License for more details.  
14 -#  
15 -# You should have received a copy of the GNU Lesser General Public License version 3  
16 -# along with this program; if not, see <http://www.gnu.org/licenses/>  
17 -# or write to the Free Software Foundation, Inc., 51 Franklin Street,  
18 -# Fifth Floor, Boston, MA 02110-1301, USA.  
19 -# ----------------------------------------------------------------------------  
20 -# Este arquivo é parte do Framework Demoiselle.  
21 -#  
22 -# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou  
23 -# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação  
24 -# do Software Livre (FSF).  
25 -#  
26 -# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA  
27 -# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou  
28 -# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português  
29 -# para maiores detalhes.  
30 -#  
31 -# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título  
32 -# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/>  
33 -# ou escreva para a Fundação do Software Livre (FSF) Inc.,  
34 -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA.  
35 -  
36 -log4j.rootLogger=INFO, A1  
37 -log4j.appender.A1=org.apache.log4j.ConsoleAppender  
38 -log4j.appender.A1.layout=org.apache.log4j.PatternLayout  
39 -log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n