From a71d341f7d8ec50004b16f44d28703ca3afd5632 Mon Sep 17 00:00:00 2001 From: Cleverson Sacramento Date: Thu, 6 Sep 2012 13:36:46 -0300 Subject: [PATCH] Remoção do ramo example --- example/.gitignore | 5 ----- example/initializer/.gitignore | 5 ----- example/initializer/pom.xml | 74 -------------------------------------------------------------------------- example/initializer/src/main/java/example/Hello.java | 86 -------------------------------------------------------------------------------------- example/initializer/src/main/resources/META-INF/beans.xml | 40 ---------------------------------------- example/initializer/src/main/resources/demoiselle.properties | 34 ---------------------------------- example/initializer/src/test/java/example/InitializerAdvancedTest.java | 90 ------------------------------------------------------------------------------------------ example/initializer/src/test/java/example/InitializerSimpleTest.java | 69 --------------------------------------------------------------------- example/initializer/src/test/resources/META-INF/beans.xml | 47 ----------------------------------------------- example/initializer/src/test/resources/log4j.properties | 39 --------------------------------------- example/pom.xml | 89 ----------------------------------------------------------------------------------------- example/security/.gitignore | 5 ----- example/security/pom.xml | 74 -------------------------------------------------------------------------- example/security/src/main/java/example/Hello.java | 64 ---------------------------------------------------------------- example/security/src/main/java/example/MyAuthenticator.java | 81 --------------------------------------------------------------------------------- example/security/src/main/java/example/MyAuthorizer.java | 71 ----------------------------------------------------------------------- example/security/src/main/java/example/MyCredentials.java | 79 ------------------------------------------------------------------------------- example/security/src/main/java/example/MyUser.java | 70 ---------------------------------------------------------------------- example/security/src/main/resources/META-INF/beans.xml | 39 --------------------------------------- example/security/src/main/resources/demoiselle.properties | 34 ---------------------------------- example/security/src/test/java/example/AunthenticationTest.java | 83 ----------------------------------------------------------------------------------- example/security/src/test/java/example/AunthorizationTest.java | 99 --------------------------------------------------------------------------------------------------- example/security/src/test/resources/META-INF/beans.xml | 47 ----------------------------------------------- example/security/src/test/resources/log4j.properties | 39 --------------------------------------- 24 files changed, 0 insertions(+), 1363 deletions(-) delete mode 100755 example/.gitignore delete mode 100755 example/initializer/.gitignore delete mode 100755 example/initializer/pom.xml delete mode 100755 example/initializer/src/main/java/example/Hello.java delete mode 100755 example/initializer/src/main/resources/META-INF/beans.xml delete mode 100755 example/initializer/src/main/resources/demoiselle.properties delete mode 100755 example/initializer/src/test/java/example/InitializerAdvancedTest.java delete mode 100755 example/initializer/src/test/java/example/InitializerSimpleTest.java delete mode 100755 example/initializer/src/test/resources/META-INF/beans.xml delete mode 100755 example/initializer/src/test/resources/log4j.properties delete mode 100755 example/pom.xml delete mode 100755 example/security/.gitignore delete mode 100755 example/security/pom.xml delete mode 100755 example/security/src/main/java/example/Hello.java delete mode 100755 example/security/src/main/java/example/MyAuthenticator.java delete mode 100755 example/security/src/main/java/example/MyAuthorizer.java delete mode 100755 example/security/src/main/java/example/MyCredentials.java delete mode 100644 example/security/src/main/java/example/MyUser.java delete mode 100755 example/security/src/main/resources/META-INF/beans.xml delete mode 100755 example/security/src/main/resources/demoiselle.properties delete mode 100755 example/security/src/test/java/example/AunthenticationTest.java delete mode 100644 example/security/src/test/java/example/AunthorizationTest.java delete mode 100644 example/security/src/test/resources/META-INF/beans.xml delete mode 100755 example/security/src/test/resources/log4j.properties diff --git a/example/.gitignore b/example/.gitignore deleted file mode 100755 index 221c8fc..0000000 --- a/example/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.project -/.classpath -/.settings -/.externalToolBuilders diff --git a/example/initializer/.gitignore b/example/initializer/.gitignore deleted file mode 100755 index 221c8fc..0000000 --- a/example/initializer/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.project -/.classpath -/.settings -/.externalToolBuilders diff --git a/example/initializer/pom.xml b/example/initializer/pom.xml deleted file mode 100755 index 776353f..0000000 --- a/example/initializer/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - demoiselle-initializer-example - jar - - - - - - - br.gov.frameworkdemoiselle - demoiselle-minimal-parent - 2.3.0-RC1-SNAPSHOT - ../../parent/minimal/pom.xml - - - - - org.slf4j - slf4j-log4j12 - test - - - - - - demoiselle.sourceforge.net-release - http://demoiselle.sourceforge.net/repository/release - - - - - 2.3.0-RC1-SNAPSHOT - - diff --git a/example/initializer/src/main/java/example/Hello.java b/example/initializer/src/main/java/example/Hello.java deleted file mode 100755 index 80e493a..0000000 --- a/example/initializer/src/main/java/example/Hello.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 example; - -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.Startup; -import br.gov.frameworkdemoiselle.lifecycle.Shutdown; - -@ApplicationScoped -public class Hello { - - private List list = new ArrayList(); - - public List getList() { - return list; - } - - public void say() { - list.add("Hello World"); - } - - @Startup - public void load() { - list.add("Startup: Priority Not Defined"); - } - - @Startup - @Priority(MIN_PRIORITY) - public void loadWithMinPriority() { - list.add("Startup: Min Priority"); - } - - @Shutdown - @Priority(1) - public void unload() { - list.add("Shutdown: Priority 1"); - } - - @Shutdown - @Priority(MAX_PRIORITY) - public void unloadWithMaxPriority() { - list.add("Shutdown: Max Priority"); - } -} diff --git a/example/initializer/src/main/resources/META-INF/beans.xml b/example/initializer/src/main/resources/META-INF/beans.xml deleted file mode 100755 index b131cc9..0000000 --- a/example/initializer/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - diff --git a/example/initializer/src/main/resources/demoiselle.properties b/example/initializer/src/main/resources/demoiselle.properties deleted file mode 100755 index 2df6d7f..0000000 --- a/example/initializer/src/main/resources/demoiselle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# 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. \ No newline at end of file diff --git a/example/initializer/src/test/java/example/InitializerAdvancedTest.java b/example/initializer/src/test/java/example/InitializerAdvancedTest.java deleted file mode 100755 index d301120..0000000 --- a/example/initializer/src/test/java/example/InitializerAdvancedTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 example; - -import static junit.framework.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner; -import br.gov.frameworkdemoiselle.util.Beans; - -@RunWith(DemoiselleRunner.class) -public class InitializerAdvancedTest { - - private static Hello hello = Beans.getReference(Hello.class); - - private static List expected = new ArrayList(); - - @BeforeClass - public static void beforeClass() { - expected.add("Startup: Priority Not Defined"); - expected.add("Startup: Min Priority"); - - assertEquals(expected, hello.getList()); - } - - @Test - public void enqueueingAfterStartup() { - hello.say(); - expected.add("Hello World"); - - assertEquals(expected, hello.getList()); - } - - @Test - public void enqueueingAfterStartupAgain() { - hello.say(); - expected.add("Hello World"); - - assertEquals(expected, hello.getList()); - } - - @AfterClass - public static void afterClass() { - expected.add("Shutdown: Max Priority"); - expected.add("Shutdown: Priority 1"); - - assertEquals(expected, hello.getList()); - } -} diff --git a/example/initializer/src/test/java/example/InitializerSimpleTest.java b/example/initializer/src/test/java/example/InitializerSimpleTest.java deleted file mode 100755 index cc4126c..0000000 --- a/example/initializer/src/test/java/example/InitializerSimpleTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 example; - -import static junit.framework.Assert.assertEquals; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner; -import br.gov.frameworkdemoiselle.util.Beans; - -@RunWith(DemoiselleRunner.class) -public class InitializerSimpleTest { - - private static Hello hello = Beans.getReference(Hello.class); - - @BeforeClass - public static void beforeClass() { - assertEquals(2, hello.getList().size()); - } - - @Test - public void enqueueingAfterStartup() { - hello.say(); - assertEquals(3, hello.getList().size()); - } - - @AfterClass - public static void afterClass() { - assertEquals(5, hello.getList().size()); - } -} diff --git a/example/initializer/src/test/resources/META-INF/beans.xml b/example/initializer/src/test/resources/META-INF/beans.xml deleted file mode 100755 index b042a89..0000000 --- a/example/initializer/src/test/resources/META-INF/beans.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - br.gov.frameworkdemoiselle.internal.interceptor.ExceptionHandlerInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.RequiredPermissionInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.RequiredRoleInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.TransactionalInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.ConfigurationInterceptor - - - \ No newline at end of file diff --git a/example/initializer/src/test/resources/log4j.properties b/example/initializer/src/test/resources/log4j.properties deleted file mode 100755 index 4505013..0000000 --- a/example/initializer/src/test/resources/log4j.properties +++ /dev/null @@ -1,39 +0,0 @@ -# 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. - -log4j.rootLogger=INFO, A1 -log4j.appender.A1=org.apache.log4j.ConsoleAppender -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n diff --git a/example/pom.xml b/example/pom.xml deleted file mode 100755 index 0d3ebea..0000000 --- a/example/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - 4.0.0 - - br.gov.frameworkdemoiselle - demoiselle-framework-example-build - 2.3.0-RC1-SNAPSHOT - pom - - Examples Build Aggregator - Demoiselle Examples Build Aggregator - - - initializer - security - - - - - - org.codehaus.mojo - wagon-maven-plugin - - . - true - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - - - - - - - - - - - - file://${project.build.directory}/tmp - - - diff --git a/example/security/.gitignore b/example/security/.gitignore deleted file mode 100755 index 221c8fc..0000000 --- a/example/security/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -/.project -/.classpath -/.settings -/.externalToolBuilders diff --git a/example/security/pom.xml b/example/security/pom.xml deleted file mode 100755 index 8c6305f..0000000 --- a/example/security/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - demoiselle-security-example - jar - - - - - - - br.gov.frameworkdemoiselle - demoiselle-minimal-parent - 2.3.0-RC1-SNAPSHOT - ../../parent/minimal/pom.xml - - - - - org.slf4j - slf4j-log4j12 - test - - - - - - demoiselle.sourceforge.net-release - http://demoiselle.sourceforge.net/repository/release - - - - - 2.3.0-RC1-SNAPSHOT - - \ No newline at end of file diff --git a/example/security/src/main/java/example/Hello.java b/example/security/src/main/java/example/Hello.java deleted file mode 100755 index 881ba9e..0000000 --- a/example/security/src/main/java/example/Hello.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 example; - -import br.gov.frameworkdemoiselle.security.RequiredPermission; -import br.gov.frameworkdemoiselle.security.RequiredRole; - -public class Hello { - - @RequiredPermission(resource = "Hello") - public void say1() { - System.out.println("Hello 1"); - } - - @RequiredPermission(resource = "World", operation = "scream") - public void say2() { - System.out.println("Hello 2"); - } - - @RequiredRole("admin") - public void say3() { - System.out.println("Hello 3"); - } - - @RequiredRole("jedi") - @RequiredPermission(resource = "World", operation = "say4") - public void say4() { - System.out.println("Hello 4"); - } -} diff --git a/example/security/src/main/java/example/MyAuthenticator.java b/example/security/src/main/java/example/MyAuthenticator.java deleted file mode 100755 index e256b8d..0000000 --- a/example/security/src/main/java/example/MyAuthenticator.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 example; - -import javax.enterprise.context.SessionScoped; -import javax.inject.Inject; - -import br.gov.frameworkdemoiselle.security.Authenticator; -import br.gov.frameworkdemoiselle.security.User; - -@SessionScoped -public class MyAuthenticator implements Authenticator { - - private static final long serialVersionUID = 1L; - - @Inject - private MyCredentials credentials; - - private User user; - - @Override - public boolean authenticate() { - boolean authenticated = false; - - String username = credentials.getUsername(); - String password = credentials.getPassword(); - - if ("santos.dumont".equals(username) && "secret".equals(password)) { - user = new MyUser(credentials.getUsername()); - user.setAttribute("roles", credentials.getRoles()); - - authenticated = true; - } - - return authenticated; - } - - @Override - public User getUser() { - return user; - } - - @Override - public void unAuthenticate() { - user = null; - } -} diff --git a/example/security/src/main/java/example/MyAuthorizer.java b/example/security/src/main/java/example/MyAuthorizer.java deleted file mode 100755 index 725dfc8..0000000 --- a/example/security/src/main/java/example/MyAuthorizer.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 example; - -import java.util.List; - -import javax.inject.Inject; - -import br.gov.frameworkdemoiselle.security.Authorizer; -import br.gov.frameworkdemoiselle.security.SecurityContext; - -public class MyAuthorizer implements Authorizer { - - private static final long serialVersionUID = 1L; - - @Inject - private SecurityContext securityContext; - - @Override - @SuppressWarnings("unchecked") - public boolean hasRole(String role) { - List roles = (List) securityContext.getUser().getAttribute("roles"); - - return roles.contains(role); - } - - @Override - public boolean hasPermission(String resource, String operation) { - boolean permitted = false; - - if (resource.equals("Hello") && operation.equals("say1")) { - permitted = true; - } - - return permitted; - } -} diff --git a/example/security/src/main/java/example/MyCredentials.java b/example/security/src/main/java/example/MyCredentials.java deleted file mode 100755 index 362be82..0000000 --- a/example/security/src/main/java/example/MyCredentials.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 example; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.enterprise.context.RequestScoped; - -@RequestScoped -public class MyCredentials implements Serializable { - - private static final long serialVersionUID = 1L; - - private String username; - - private String password; - - private List roles = new ArrayList(); - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public List getRoles() { - return roles; - } - - public void addRole(String role) { - this.roles.add(role); - } -} diff --git a/example/security/src/main/java/example/MyUser.java b/example/security/src/main/java/example/MyUser.java deleted file mode 100644 index e11d852..0000000 --- a/example/security/src/main/java/example/MyUser.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 example; - -import java.util.HashMap; -import java.util.Map; - -import br.gov.frameworkdemoiselle.security.User; - -public class MyUser implements User { - - private static final long serialVersionUID = 1L; - - private final String username; - - private Map attrs = new HashMap(); - - public MyUser(String username) { - this.username = username; - } - - @Override - public String getId() { - return this.username; - } - - @Override - public Object getAttribute(Object key) { - return this.attrs.get(key); - } - - @Override - public void setAttribute(Object key, Object value) { - this.attrs.put((String) key, value); - } -} diff --git a/example/security/src/main/resources/META-INF/beans.xml b/example/security/src/main/resources/META-INF/beans.xml deleted file mode 100755 index 0048adf..0000000 --- a/example/security/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - diff --git a/example/security/src/main/resources/demoiselle.properties b/example/security/src/main/resources/demoiselle.properties deleted file mode 100755 index 3f1fa2e..0000000 --- a/example/security/src/main/resources/demoiselle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# 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. diff --git a/example/security/src/test/java/example/AunthenticationTest.java b/example/security/src/test/java/example/AunthenticationTest.java deleted file mode 100755 index b378bd9..0000000 --- a/example/security/src/test/java/example/AunthenticationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 example; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; - -import javax.inject.Inject; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner; -import br.gov.frameworkdemoiselle.security.SecurityContext; - -@RunWith(DemoiselleRunner.class) -public class AunthenticationTest { - - @Inject - private MyCredentials credential; - - @Inject - private SecurityContext securityContext; - - @Test - public void isNotLogged() { - assertFalse(securityContext.isLoggedIn()); - } - - @Test - public void loginFailed() { - credential.setUsername("santos.dumont"); - credential.setPassword("123"); - securityContext.login(); - - assertFalse(securityContext.isLoggedIn()); - } - - @Test - public void loginSuccessful() { - credential.setUsername("santos.dumont"); - credential.setPassword("secret"); - securityContext.login(); - - assertTrue(securityContext.isLoggedIn()); - - securityContext.logout(); - } -} diff --git a/example/security/src/test/java/example/AunthorizationTest.java b/example/security/src/test/java/example/AunthorizationTest.java deleted file mode 100644 index 0701089..0000000 --- a/example/security/src/test/java/example/AunthorizationTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 example; - -import static junit.framework.Assert.fail; - -import javax.inject.Inject; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import br.gov.frameworkdemoiselle.junit.DemoiselleRunner; -import br.gov.frameworkdemoiselle.security.AuthorizationException; -import br.gov.frameworkdemoiselle.security.SecurityContext; -import br.gov.frameworkdemoiselle.util.Beans; - -@RunWith(DemoiselleRunner.class) -public class AunthorizationTest { - - @Inject - private Hello hello; - - @Before - public void before() { - MyCredentials myCredentials = Beans.getReference(MyCredentials.class); - - myCredentials.setUsername("santos.dumont"); - myCredentials.setPassword("secret"); - myCredentials.addRole("admin"); - myCredentials.addRole("jedi"); - - SecurityContext securityContext = Beans.getReference(SecurityContext.class); - securityContext.login(); - } - - @After - public void after() { - SecurityContext securityContext = Beans.getReference(SecurityContext.class); - securityContext.logout(); - } - - @Test - public void accessSuccessfulSaying1() { - hello.say1(); - } - - @Test(expected = AuthorizationException.class) - public void accessFailedSaying2() { - hello.say2(); - fail(); - } - - @Test - public void accessFailedSaying3() { - hello.say3(); - } - - @Test(expected = AuthorizationException.class) - public void accessFailedSaying4() { - hello.say4(); - fail(); - } -} diff --git a/example/security/src/test/resources/META-INF/beans.xml b/example/security/src/test/resources/META-INF/beans.xml deleted file mode 100644 index 3d535ff..0000000 --- a/example/security/src/test/resources/META-INF/beans.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - br.gov.frameworkdemoiselle.internal.interceptor.ExceptionHandlerInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.RequiredPermissionInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.RequiredRoleInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.TransactionalInterceptor - br.gov.frameworkdemoiselle.internal.interceptor.ConfigurationInterceptor - - - diff --git a/example/security/src/test/resources/log4j.properties b/example/security/src/test/resources/log4j.properties deleted file mode 100755 index 4505013..0000000 --- a/example/security/src/test/resources/log4j.properties +++ /dev/null @@ -1,39 +0,0 @@ -# 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. - -log4j.rootLogger=INFO, A1 -log4j.appender.A1=org.apache.log4j.ConsoleAppender -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r %-5p %c - %m%n -- libgit2 0.21.2