Commit bfb1b79f526977d8560399c84b35149852521142
Exists in
master
Merge remote-tracking branch 'origin/master'
Showing
52 changed files
with
1591 additions
and
971 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/Name.java
| ... | ... | @@ -66,14 +66,14 @@ import javax.inject.Qualifier; |
| 66 | 66 | * <pre> |
| 67 | 67 | * public class NameConfig { |
| 68 | 68 | * |
| 69 | - * @Name("other.name.attrib") | |
| 69 | + * @AmbiguousQualifier("other.name.attrib") | |
| 70 | 70 | * private int nameOfAttribute; |
| 71 | 71 | * ... |
| 72 | 72 | * } |
| 73 | 73 | * |
| 74 | 74 | * public class NameResourceBundle { |
| 75 | 75 | * |
| 76 | - * @Name("other.name.bundle") | |
| 76 | + * @AmbiguousQualifier("other.name.bundle") | |
| 77 | 77 | * @Inject |
| 78 | 78 | * private ResourceBundle bundle; |
| 79 | 79 | * ... | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/annotation/OperationParameter.java
| ... | ... | @@ -60,7 +60,7 @@ import javax.enterprise.util.Nonbinding; |
| 60 | 60 | public @interface OperationParameter { |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Name that will be used to publish this operation's parameter to clients. | |
| 63 | + * AmbiguousQualifier that will be used to publish this operation's parameter to clients. | |
| 64 | 64 | */ |
| 65 | 65 | @Nonbinding |
| 66 | 66 | String name(); | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/implementation/Management.java
| ... | ... | @@ -121,7 +121,7 @@ public class Management implements Serializable { |
| 121 | 121 | * A type annotated with {@link ManagementController}. This method will create an (or obtain an already |
| 122 | 122 | * created) instance of this type and invoke the operation over it. |
| 123 | 123 | * @param actionName |
| 124 | - * Name of method to be invoked, the type must have this operation on it's list | |
| 124 | + * AmbiguousQualifier of method to be invoked, the type must have this operation on it's list | |
| 125 | 125 | * @param params |
| 126 | 126 | * List of values for the operation parameters. Can be <code>null</code> if the operation require no |
| 127 | 127 | * parameters. | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/producer/LoggerProducer.java
| ... | ... | @@ -89,7 +89,7 @@ public class LoggerProducer implements Serializable { |
| 89 | 89 | type = Reflections.forName(canonicalName); |
| 90 | 90 | |
| 91 | 91 | } catch (ClassCastException cause) { |
| 92 | - // TODO Colocar a mensgaem apropriada mostrando como utilizar a anotação @Name corretamente com a injeção de | |
| 92 | + // TODO Colocar a mensgaem apropriada mostrando como utilizar a anotação @AmbiguousQualifier corretamente com a injeção de | |
| 93 | 93 | // Logger. |
| 94 | 94 | throw new DemoiselleException(null, cause); |
| 95 | 95 | } | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/security/RequiredPermissionInterceptor.java
| ... | ... | @@ -99,12 +99,12 @@ public class RequiredPermissionInterceptor implements Serializable { |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * Returns the resource defined in {@code @RequiredPermission} annotation, the name defined in {@code @Name} | |
| 102 | + * Returns the resource defined in {@code @RequiredPermission} annotation, the name defined in {@code @AmbiguousQualifier} | |
| 103 | 103 | * annotation or the class name itself |
| 104 | 104 | * |
| 105 | 105 | * @param ic |
| 106 | 106 | * the {@code InvocationContext} in which the method is being called |
| 107 | - * @return the resource defined in {@code @RequiredPermission} annotation, the name defined in {@code @Name} | |
| 107 | + * @return the resource defined in {@code @RequiredPermission} annotation, the name defined in {@code @AmbiguousQualifier} | |
| 108 | 108 | * annotation or the class name itself |
| 109 | 109 | */ |
| 110 | 110 | private String getResource(InvocationContext ic) { |
| ... | ... | @@ -127,12 +127,12 @@ public class RequiredPermissionInterceptor implements Serializable { |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | - * Returns the operation defined in {@code @RequiredPermission} annotation, the name defined in {@code @Name} | |
| 130 | + * Returns the operation defined in {@code @RequiredPermission} annotation, the name defined in {@code @AmbiguousQualifier} | |
| 131 | 131 | * annotation or the method's name itself |
| 132 | 132 | * |
| 133 | 133 | * @param ic |
| 134 | 134 | * the {@code InvocationContext} in which the method is being called |
| 135 | - * @return the operation defined in {@code @RequiredPermission} annotation, the name defined in {@code @Name} | |
| 135 | + * @return the operation defined in {@code @RequiredPermission} annotation, the name defined in {@code @AmbiguousQualifier} | |
| 136 | 136 | * annotation or the method's name itself |
| 137 | 137 | */ |
| 138 | 138 | private String getOperation(InvocationContext ic) { | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/Beans.java
| ... | ... | @@ -45,6 +45,7 @@ import java.util.NoSuchElementException; |
| 45 | 45 | import java.util.Set; |
| 46 | 46 | |
| 47 | 47 | import javax.enterprise.context.spi.CreationalContext; |
| 48 | +import javax.enterprise.inject.AmbiguousResolutionException; | |
| 48 | 49 | import javax.enterprise.inject.spi.Annotated; |
| 49 | 50 | import javax.enterprise.inject.spi.Bean; |
| 50 | 51 | import javax.enterprise.inject.spi.BeanManager; |
| ... | ... | @@ -64,7 +65,7 @@ import br.gov.frameworkdemoiselle.DemoiselleException; |
| 64 | 65 | public final class Beans { |
| 65 | 66 | |
| 66 | 67 | private static BeanManager beanManager = null; |
| 67 | - | |
| 68 | + | |
| 68 | 69 | private Beans() { |
| 69 | 70 | } |
| 70 | 71 | |
| ... | ... | @@ -75,7 +76,7 @@ public final class Beans { |
| 75 | 76 | public static BeanManager getBeanManager() { |
| 76 | 77 | return beanManager; |
| 77 | 78 | } |
| 78 | - | |
| 79 | + | |
| 79 | 80 | /** |
| 80 | 81 | * Obtains a injectble instance of a bean, which have the given required type and qualifiers, and are available for |
| 81 | 82 | * injection in the point where this method was call. |
| ... | ... | @@ -161,11 +162,12 @@ public final class Beans { |
| 161 | 162 | |
| 162 | 163 | @SuppressWarnings("unchecked") |
| 163 | 164 | private static <T> T getReference(Set<Bean<?>> beans, Class<T> beanClass, Annotation... qualifiers) { |
| 164 | - Bean<?> bean = beans.iterator().next(); | |
| 165 | - | |
| 166 | - // TODO Esta mudança só deve ser submetida com os testes passando. Esta mudança quebra os testes. | |
| 167 | - // Bean<?> bean = getBeanManager().resolve( beans ); | |
| 165 | + if (beans.size() > 1) { | |
| 166 | + String message = getBundle().getString("ambiguous-bean-resolution", beanClass.getName(), beans.toString()); | |
| 167 | + throw new DemoiselleException(message, new AmbiguousResolutionException()); | |
| 168 | + } | |
| 168 | 169 | |
| 170 | + Bean<?> bean = beans.iterator().next(); | |
| 169 | 171 | CreationalContext<?> context = getBeanManager().createCreationalContext(bean); |
| 170 | 172 | Type beanType = beanClass == null ? bean.getBeanClass() : beanClass; |
| 171 | 173 | InjectionPoint injectionPoint = new CustomInjectionPoint(bean, beanType, qualifiers); | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/util/NameQualifier.java
| ... | ... | @@ -41,11 +41,11 @@ import javax.enterprise.util.AnnotationLiteral; |
| 41 | 41 | import br.gov.frameworkdemoiselle.annotation.Name; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Creates a instance of an java annotation, specifically for qualification @Name. | |
| 44 | + * Creates a instance of an java annotation, specifically for qualification @AmbiguousQualifier. | |
| 45 | 45 | * This is required to get some classes by calling Beans.getReference method. |
| 46 | 46 | * |
| 47 | 47 | * @see Beans |
| 48 | - * @see Name | |
| 48 | + * @see AmbiguousQualifier | |
| 49 | 49 | * |
| 50 | 50 | * @author SERPRO |
| 51 | 51 | */ | ... | ... |
impl/core/src/main/resources/demoiselle-core-bundle.properties
| ... | ... | @@ -37,6 +37,7 @@ engine-on=Ligando os motores do Demoiselle ${project.version} |
| 37 | 37 | resource-not-found=Arquivo {0} n\u00E3o foi encontrado |
| 38 | 38 | key-not-found=A chave {0} n\u00E3o foi encontrada |
| 39 | 39 | ambiguous-strategy-resolution=Foi detectada ambiguidade da interface {0} com as seguintes implementa\u00E7\u00F5es\: {1}. Para resolver o conflito, defina explicitamente a implementa\u00E7\u00E3o no demoiselle.properties. |
| 40 | +ambiguous-bean-resolution=Falha ao obter {0} pois foi detectada ambiguidade nas seguintes implementa\u00E7\u00F5es\: {1} | |
| 40 | 41 | bean-not-found=Voc\u00EA est\u00E1 tentando obter um objeto n\u00E3o reconhecido pelo CDI via Beans.getReference({0}) |
| 41 | 42 | more-than-one-exceptionhandler-defined-for-same-class=Foi definido mais de um m\u00E9todo na classe {0} para tratar a exce\u00E7\u00E3o {1} |
| 42 | 43 | handling-exception=Tratando a exce\u00E7\u00E3o {0} | ... | ... |
impl/core/src/test/java/management/basic/ManagementTest.java
| ... | ... | @@ -72,13 +72,13 @@ public class ManagementTest { |
| 72 | 72 | @Test |
| 73 | 73 | public void readProperty() { |
| 74 | 74 | DummyManagedClass managedClass = Beans.getReference(DummyManagedClass.class); |
| 75 | - managedClass.setName("Test Name"); | |
| 75 | + managedClass.setName("Test AmbiguousQualifier"); | |
| 76 | 76 | |
| 77 | 77 | // store é nossa extensão de gerenciamento falsa, então estamos testando um "cliente" acessando |
| 78 | 78 | // nosso tipo gerenciado DummyManagedClass remotamente. |
| 79 | 79 | ManagedClassStore store = Beans.getReference(ManagedClassStore.class); |
| 80 | 80 | Object name = store.getProperty(DummyManagedClass.class, "name"); |
| 81 | - Assert.assertEquals("Test Name", name); | |
| 81 | + Assert.assertEquals("Test AmbiguousQualifier", name); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | @Test |
| ... | ... | @@ -86,10 +86,10 @@ public class ManagementTest { |
| 86 | 86 | // store é nossa extensão de gerenciamento falsa, então estamos testando um "cliente" definindo |
| 87 | 87 | // um novo valor em uma propriedade de nosso tipo gerenciado DummyManagedClass remotamente. |
| 88 | 88 | ManagedClassStore store = Beans.getReference(ManagedClassStore.class); |
| 89 | - store.setProperty(DummyManagedClass.class, "name", "Test Name"); | |
| 89 | + store.setProperty(DummyManagedClass.class, "name", "Test AmbiguousQualifier"); | |
| 90 | 90 | |
| 91 | 91 | DummyManagedClass managedClass = Beans.getReference(DummyManagedClass.class); |
| 92 | - Assert.assertEquals("Test Name", managedClass.getName()); | |
| 92 | + Assert.assertEquals("Test AmbiguousQualifier", managedClass.getName()); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | @Test | ... | ... |
impl/core/src/test/java/management/testclasses/DummyNotificationListener.java
| ... | ... | @@ -46,7 +46,7 @@ import br.gov.frameworkdemoiselle.management.ManagementNotificationEvent; |
| 46 | 46 | import br.gov.frameworkdemoiselle.management.NotificationManager; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * Dummy class to test receiving of notifications sent by the {@link NotificationManager} | |
| 49 | + * Bean class to test receiving of notifications sent by the {@link NotificationManager} | |
| 50 | 50 | * |
| 51 | 51 | * @author SERPRO |
| 52 | 52 | * | ... | ... |
impl/core/src/test/java/management/testclasses/ManagedClassStore.java
| ... | ... | @@ -47,7 +47,7 @@ import br.gov.frameworkdemoiselle.internal.implementation.Management; |
| 47 | 47 | import br.gov.frameworkdemoiselle.util.Beans; |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Dummy class that stores managed types detected by the management bootstrap | |
| 50 | + * Bean class that stores managed types detected by the management bootstrap | |
| 51 | 51 | * and can read/write properties and invoke operations on them, simulating a management |
| 52 | 52 | * extension like JMX or SNMP. |
| 53 | 53 | * | ... | ... |
impl/core/src/test/java/util/ExceptionsTest.java
| ... | ... | @@ -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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertFalse; | |
| 40 | -import static org.junit.Assert.assertTrue; | |
| 41 | -import static org.junit.Assert.fail; | |
| 42 | - | |
| 43 | -import org.junit.Test; | |
| 44 | - | |
| 45 | -import br.gov.frameworkdemoiselle.exception.ApplicationException; | |
| 46 | -import br.gov.frameworkdemoiselle.util.Exceptions; | |
| 47 | - | |
| 48 | -public class ExceptionsTest { | |
| 49 | - | |
| 50 | - @Test | |
| 51 | - public void testIsApplicationException() { | |
| 52 | - assertTrue(Exceptions.isApplicationException(new MyException())); | |
| 53 | - assertFalse(Exceptions.isApplicationException(new Exception())); | |
| 54 | - } | |
| 55 | - | |
| 56 | - @Test | |
| 57 | - public void testHandleRuntimeException() { | |
| 58 | - try { | |
| 59 | - Exceptions.handleToRuntimeException(new SomeRuntimeException()); | |
| 60 | - fail(); | |
| 61 | - } catch (Throwable t) { | |
| 62 | - if (!RuntimeException.class.isInstance(t)) { | |
| 63 | - fail(); | |
| 64 | - } | |
| 65 | - } | |
| 66 | - | |
| 67 | - try { | |
| 68 | - Exceptions.handleToRuntimeException(new Exception()); | |
| 69 | - fail(); | |
| 70 | - } catch (Throwable t) { | |
| 71 | - if (!RuntimeException.class.isInstance(t)) { | |
| 72 | - fail(); | |
| 73 | - } | |
| 74 | - } | |
| 75 | - | |
| 76 | - } | |
| 77 | - | |
| 78 | -} | |
| 79 | - | |
| 80 | -@ApplicationException | |
| 81 | -class MyException extends Exception { | |
| 82 | - | |
| 83 | - private static final long serialVersionUID = 1L; | |
| 84 | -} | |
| 85 | - | |
| 86 | -class SomeRuntimeException extends RuntimeException { | |
| 87 | - | |
| 88 | - private static final long serialVersionUID = 1L; | |
| 89 | - | |
| 90 | -} |
impl/core/src/test/java/util/ReflectionsTest.java
| ... | ... | @@ -1,75 +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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | - | |
| 41 | -import java.lang.reflect.Member; | |
| 42 | - | |
| 43 | -import org.junit.Test; | |
| 44 | - | |
| 45 | -import br.gov.frameworkdemoiselle.util.Reflections; | |
| 46 | - | |
| 47 | -public class ReflectionsTest { | |
| 48 | - | |
| 49 | - @Test | |
| 50 | - public void testGetGenericTypeArgumentClass() { | |
| 51 | - assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0)); | |
| 52 | - assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1)); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @Test | |
| 56 | - public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException { | |
| 57 | - Member[] members = OtherClass.class.getFields(); | |
| 58 | - assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0)); | |
| 59 | - assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0)); | |
| 60 | - } | |
| 61 | -} | |
| 62 | - | |
| 63 | -class SomeClass<T, I> { | |
| 64 | - | |
| 65 | - public void setNumber(final T t) { | |
| 66 | - | |
| 67 | - } | |
| 68 | -} | |
| 69 | - | |
| 70 | -class OtherClass extends SomeClass<Long, String> { | |
| 71 | - | |
| 72 | - public Class<Long> number; | |
| 73 | - | |
| 74 | - public Class<String> text; | |
| 75 | -} |
impl/core/src/test/java/util/ResourceBundleTest.java
| ... | ... | @@ -1,66 +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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | - | |
| 41 | -import java.util.Locale; | |
| 42 | - | |
| 43 | -import org.junit.Before; | |
| 44 | -import org.junit.Test; | |
| 45 | - | |
| 46 | -import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 47 | - | |
| 48 | -public class ResourceBundleTest { | |
| 49 | - | |
| 50 | - private ResourceBundle resourceBundle; | |
| 51 | - | |
| 52 | - @Before | |
| 53 | - public void setUp() throws Exception { | |
| 54 | - resourceBundle = new ResourceBundle("resourcebundle/resource-bundle", new Locale("pt")); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @Test | |
| 58 | - public void getString() { | |
| 59 | - assertEquals("no params", resourceBundle.getString("msgWithoutParams")); | |
| 60 | - | |
| 61 | - assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b")); | |
| 62 | - | |
| 63 | - assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams")); | |
| 64 | - } | |
| 65 | - | |
| 66 | -} |
impl/core/src/test/java/util/StringsTest.java
| ... | ... | @@ -1,202 +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 util; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | -import static org.junit.Assert.assertFalse; | |
| 41 | -import static org.junit.Assert.assertNull; | |
| 42 | -import static org.junit.Assert.assertTrue; | |
| 43 | - | |
| 44 | -import org.junit.Test; | |
| 45 | - | |
| 46 | -import br.gov.frameworkdemoiselle.annotation.Ignore; | |
| 47 | -import br.gov.frameworkdemoiselle.util.Strings; | |
| 48 | - | |
| 49 | -public class StringsTest { | |
| 50 | - | |
| 51 | - @Test | |
| 52 | - public void getString() { | |
| 53 | - testEqualsGetString("teste", "teste"); | |
| 54 | - testEqualsGetString("", ""); | |
| 55 | - testEqualsGetString(null, null); | |
| 56 | - testEqualsGetString(null, null, "teste"); | |
| 57 | - testEqualsGetString("{0}", "teste", "teste"); | |
| 58 | - testEqualsGetString("teste", "teste", (Object[]) null); | |
| 59 | - testEqualsGetString("teste {0}", "teste 1", "1"); | |
| 60 | - testEqualsGetString("{0} teste", "Um teste", "Um"); | |
| 61 | - testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas"); | |
| 62 | - testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null); | |
| 63 | - testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto"); | |
| 64 | - testEqualsGetString("teste", "teste", "1", "2"); | |
| 65 | - testEqualsGetString("teste {0}.", "teste \\.", "\\"); | |
| 66 | - } | |
| 67 | - | |
| 68 | - @Test | |
| 69 | - public void isEmpty() { | |
| 70 | - assertTrue(Strings.isEmpty(null)); | |
| 71 | - assertTrue(Strings.isEmpty("")); | |
| 72 | - assertTrue(Strings.isEmpty(" ")); | |
| 73 | - assertTrue(Strings.isEmpty(" ")); | |
| 74 | - | |
| 75 | - assertFalse(Strings.isEmpty(" _ ")); | |
| 76 | - assertFalse(Strings.isEmpty(".")); | |
| 77 | - assertFalse(Strings.isEmpty("null")); | |
| 78 | - } | |
| 79 | - | |
| 80 | - @Test | |
| 81 | - public void isResourceBundleKeyFormat() { | |
| 82 | - assertTrue(Strings.isResourceBundleKeyFormat("{x}")); | |
| 83 | - assertTrue(Strings.isResourceBundleKeyFormat("{.}")); | |
| 84 | - assertTrue(Strings.isResourceBundleKeyFormat("{*}")); | |
| 85 | - assertTrue(Strings.isResourceBundleKeyFormat("{$}")); | |
| 86 | - assertFalse(Strings.isResourceBundleKeyFormat("{}")); | |
| 87 | - assertFalse(Strings.isResourceBundleKeyFormat("")); | |
| 88 | - assertFalse(Strings.isResourceBundleKeyFormat(" ")); | |
| 89 | - assertFalse(Strings.isResourceBundleKeyFormat(null)); | |
| 90 | - assertFalse(Strings.isResourceBundleKeyFormat("a{a}a")); | |
| 91 | - assertFalse(Strings.isResourceBundleKeyFormat("a{a}")); | |
| 92 | - assertFalse(Strings.isResourceBundleKeyFormat("{a}a")); | |
| 93 | - assertFalse(Strings.isResourceBundleKeyFormat(" {a} ")); | |
| 94 | - assertFalse(Strings.isResourceBundleKeyFormat("{a")); | |
| 95 | - assertFalse(Strings.isResourceBundleKeyFormat("a}")); | |
| 96 | - } | |
| 97 | - | |
| 98 | - @Test | |
| 99 | - public void camelCaseToSymbolSeparated() { | |
| 100 | - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null)); | |
| 101 | - assertEquals(null, Strings.camelCaseToSymbolSeparated(null, ".")); | |
| 102 | - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null)); | |
| 103 | - assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", "")); | |
| 104 | - assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", ".")); | |
| 105 | - assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-")); | |
| 106 | - assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?")); | |
| 107 | - assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___")); | |
| 108 | - } | |
| 109 | - | |
| 110 | - @Test | |
| 111 | - public void firstToUpper() { | |
| 112 | - assertNull(Strings.firstToUpper(null)); | |
| 113 | - assertEquals("", Strings.firstToUpper("")); | |
| 114 | - assertEquals("A", Strings.firstToUpper("a")); | |
| 115 | - assertEquals("A", Strings.firstToUpper("A")); | |
| 116 | - assertEquals("Ab", Strings.firstToUpper("Ab")); | |
| 117 | - assertEquals("AB", Strings.firstToUpper("AB")); | |
| 118 | - assertEquals("Ab", Strings.firstToUpper("ab")); | |
| 119 | - assertEquals("AB", Strings.firstToUpper("aB")); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Test | |
| 123 | - public void toStringWhenObjectIsNull() { | |
| 124 | - assertEquals("", Strings.toString(null)); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Test | |
| 128 | - public void classToString() throws SecurityException, NoSuchFieldException { | |
| 129 | - @SuppressWarnings("unused") | |
| 130 | - class Test { | |
| 131 | - | |
| 132 | - private String name = "myName"; | |
| 133 | - | |
| 134 | - private String lastname = "myLastname"; | |
| 135 | - | |
| 136 | - private String nullField = null; | |
| 137 | - | |
| 138 | - @Ignore | |
| 139 | - private String ignore = "ignoreMe"; | |
| 140 | - | |
| 141 | - } | |
| 142 | - | |
| 143 | - String result = Strings.toString(new Test()); | |
| 144 | - assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this")); | |
| 145 | - } | |
| 146 | - | |
| 147 | - private void testEqualsGetString(final String in, final String expected, final Object... params) { | |
| 148 | - String out = Strings.getString(in, params); | |
| 149 | - assertEquals(expected, out); | |
| 150 | - } | |
| 151 | - | |
| 152 | - @Test | |
| 153 | - public void removeBraces() { | |
| 154 | - assertNull(Strings.removeBraces(null)); | |
| 155 | - assertEquals("", Strings.removeBraces("")); | |
| 156 | - assertEquals(" ", Strings.removeBraces(" ")); | |
| 157 | - assertEquals(" {x} ", Strings.removeBraces(" {x} ")); | |
| 158 | - assertEquals("{x} ", Strings.removeBraces("{x} ")); | |
| 159 | - assertEquals(" {x}", Strings.removeBraces(" {x}")); | |
| 160 | - assertEquals("x", Strings.removeBraces("{x}")); | |
| 161 | - assertEquals("a b c", Strings.removeBraces("{a b c}")); | |
| 162 | - assertEquals("{}", Strings.removeBraces("{}")); | |
| 163 | - assertEquals("{}", Strings.removeBraces("{{}}")); | |
| 164 | - assertEquals("?", Strings.removeBraces("{?}")); | |
| 165 | - assertEquals("*", Strings.removeBraces("{*}")); | |
| 166 | - } | |
| 167 | - | |
| 168 | - @Test | |
| 169 | - public void insertBraces() { | |
| 170 | - assertNull(Strings.insertBraces(null)); | |
| 171 | - assertEquals("", Strings.insertBraces("")); | |
| 172 | - assertEquals(" ", Strings.insertBraces(" ")); | |
| 173 | - assertEquals("{ x }", Strings.insertBraces(" x ")); | |
| 174 | - assertEquals("{ {x} }", Strings.insertBraces(" {x} ")); | |
| 175 | - assertEquals("{{x}", Strings.insertBraces("{x")); | |
| 176 | - assertEquals("{*}", Strings.insertBraces("*")); | |
| 177 | - assertEquals("{?}", Strings.insertBraces("?")); | |
| 178 | - } | |
| 179 | - | |
| 180 | - @Test | |
| 181 | - public void removeCharsWhenStringIsNull() { | |
| 182 | - assertEquals(null, Strings.removeChars(null, 'a')); | |
| 183 | - } | |
| 184 | - | |
| 185 | - @Test | |
| 186 | - public void removeCharsWhenStringIsNotNull() { | |
| 187 | - String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis."; | |
| 188 | - string = Strings.removeChars(string, 'L', 'l'); | |
| 189 | - assertEquals(-1, string.indexOf('L')); | |
| 190 | - assertEquals(-1, string.indexOf('l')); | |
| 191 | - } | |
| 192 | - | |
| 193 | - @Test | |
| 194 | - public void insertZeros() { | |
| 195 | - String string = "Lorem ipsum"; | |
| 196 | - assertEquals("00000", Strings.insertZeros(null, 5)); | |
| 197 | - assertEquals(string, Strings.insertZeros(string, string.length() - 1)); | |
| 198 | - assertEquals(string, Strings.insertZeros(string, string.length())); | |
| 199 | - assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1)); | |
| 200 | - assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2)); | |
| 201 | - } | |
| 202 | -} |
impl/core/src/test/java/util/beans/BeansTest.java
| ... | ... | @@ -1,111 +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 util.beans; | |
| 38 | - | |
| 39 | -import static org.junit.Assert.assertEquals; | |
| 40 | -import static org.junit.Assert.fail; | |
| 41 | - | |
| 42 | -import java.util.NoSuchElementException; | |
| 43 | - | |
| 44 | -import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | -import org.jboss.arquillian.junit.Arquillian; | |
| 46 | -import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | -import org.junit.Test; | |
| 48 | -import org.junit.runner.RunWith; | |
| 49 | - | |
| 50 | -import test.Tests; | |
| 51 | -import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | -import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | - | |
| 54 | -@RunWith(Arquillian.class) | |
| 55 | -public class BeansTest { | |
| 56 | - | |
| 57 | - @Deployment | |
| 58 | - public static JavaArchive createDeployment() { | |
| 59 | - JavaArchive deployment = Tests.createDeployment(BeansTest.class); | |
| 60 | - return deployment; | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Test | |
| 64 | - public void beanClassAndQualifierTest() { | |
| 65 | - assertEquals(DummyQualifierOne.class, | |
| 66 | - (Beans.getReference(DummyQualifier.class, DummyQualifierOne.class.getAnnotations())).getClass()); | |
| 67 | - assertEquals(DummyQualifierTwo.class, | |
| 68 | - (Beans.getReference(DummyQualifier.class, DummyQualifierTwo.class.getAnnotations())).getClass()); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Test | |
| 72 | - public void beanClassAndQualifierExceptionTest() { | |
| 73 | - try { | |
| 74 | - Beans.getReference(DummyQualifier.class, DummyQualifierOne.class.getAnnotations()[0], | |
| 75 | - DummyQualifierTwo.class.getAnnotations()[0]); | |
| 76 | - fail(); | |
| 77 | - } catch (DemoiselleException cause) { | |
| 78 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - | |
| 82 | - @Test | |
| 83 | - public void beanClassTest() { | |
| 84 | - assertEquals(DummyImplementation.class, Beans.getReference(Dummy.class).getClass()); | |
| 85 | - } | |
| 86 | - | |
| 87 | - @Test | |
| 88 | - public void beanClassExceptionTest() { | |
| 89 | - try { | |
| 90 | - Beans.getReference(InexistentImplementationInterface.class); | |
| 91 | - fail(); | |
| 92 | - } catch (DemoiselleException cause) { | |
| 93 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - | |
| 97 | - @Test | |
| 98 | - public void beanNameTest() { | |
| 99 | - assertEquals(DummyEL.class, Beans.getReference("DummyClass").getClass()); | |
| 100 | - } | |
| 101 | - | |
| 102 | - @Test | |
| 103 | - public void beanNameExceptionTest() { | |
| 104 | - try { | |
| 105 | - Beans.getReference("DummyEL"); | |
| 106 | - fail(); | |
| 107 | - } catch (DemoiselleException cause) { | |
| 108 | - assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 109 | - } | |
| 110 | - } | |
| 111 | -} |
impl/core/src/test/java/util/beans/Dummy.java
| ... | ... | @@ -1,42 +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 util.beans; | |
| 38 | - | |
| 39 | -public interface Dummy { | |
| 40 | - | |
| 41 | - public void dummyMethod(); | |
| 42 | -} |
impl/core/src/test/java/util/beans/DummyEL.java
| ... | ... | @@ -1,43 +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 util.beans; | |
| 38 | - | |
| 39 | -import javax.inject.Named; | |
| 40 | - | |
| 41 | -@Named("DummyClass") | |
| 42 | -public class DummyEL { | |
| 43 | -} |
impl/core/src/test/java/util/beans/DummyImplementation.java
| ... | ... | @@ -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 | -package util.beans; | |
| 38 | - | |
| 39 | -import br.gov.frameworkdemoiselle.annotation.Priority; | |
| 40 | - | |
| 41 | -@Priority(value = 1) | |
| 42 | -public class DummyImplementation implements Dummy { | |
| 43 | - | |
| 44 | - @Override | |
| 45 | - public void dummyMethod() { | |
| 46 | - } | |
| 47 | -} |
impl/core/src/test/java/util/beans/DummyQualifier.java
| ... | ... | @@ -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 | -package util.beans; | |
| 38 | - | |
| 39 | -public interface DummyQualifier { | |
| 40 | -} |
impl/core/src/test/java/util/beans/DummyQualifierOne.java
| ... | ... | @@ -1,41 +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 util.beans; | |
| 38 | - | |
| 39 | -@QualifierOne | |
| 40 | -public class DummyQualifierOne implements DummyQualifier { | |
| 41 | -} |
impl/core/src/test/java/util/beans/DummyQualifierTwo.java
| ... | ... | @@ -1,41 +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 util.beans; | |
| 38 | - | |
| 39 | -@QualifierTwo | |
| 40 | -public class DummyQualifierTwo implements DummyQualifier{ | |
| 41 | -} |
impl/core/src/test/java/util/beans/InexistentImplementationInterface.java
| ... | ... | @@ -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 | -package util.beans; | |
| 38 | - | |
| 39 | -public interface InexistentImplementationInterface { | |
| 40 | -} |
impl/core/src/test/java/util/beans/QualifierOne.java
| ... | ... | @@ -1,54 +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 util.beans; | |
| 38 | - | |
| 39 | -import static java.lang.annotation.ElementType.FIELD; | |
| 40 | -import static java.lang.annotation.ElementType.METHOD; | |
| 41 | -import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | -import static java.lang.annotation.ElementType.TYPE; | |
| 43 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | - | |
| 45 | -import java.lang.annotation.Retention; | |
| 46 | -import java.lang.annotation.Target; | |
| 47 | - | |
| 48 | -import javax.inject.Qualifier; | |
| 49 | - | |
| 50 | -@Qualifier | |
| 51 | -@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | -@Retention(RUNTIME) | |
| 53 | -public @interface QualifierOne { | |
| 54 | -} |
impl/core/src/test/java/util/beans/QualifierTwo.java
| ... | ... | @@ -1,54 +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 util.beans; | |
| 38 | - | |
| 39 | -import static java.lang.annotation.ElementType.FIELD; | |
| 40 | -import static java.lang.annotation.ElementType.METHOD; | |
| 41 | -import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | -import static java.lang.annotation.ElementType.TYPE; | |
| 43 | -import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | - | |
| 45 | -import java.lang.annotation.Retention; | |
| 46 | -import java.lang.annotation.Target; | |
| 47 | - | |
| 48 | -import javax.inject.Qualifier; | |
| 49 | - | |
| 50 | -@Qualifier | |
| 51 | -@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | -@Retention(RUNTIME) | |
| 53 | -public @interface QualifierTwo { | |
| 54 | -} | |
| 55 | 0 | \ No newline at end of file |
impl/core/src/test/java/util/beans/ambiguous/AmbiguousBeansTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,100 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +import static junit.framework.Assert.assertEquals; | |
| 40 | + | |
| 41 | +import javax.enterprise.inject.AmbiguousResolutionException; | |
| 42 | +import javax.enterprise.util.AnnotationLiteral; | |
| 43 | + | |
| 44 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | +import org.jboss.arquillian.junit.Arquillian; | |
| 46 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | +import org.junit.Test; | |
| 48 | +import org.junit.runner.RunWith; | |
| 49 | + | |
| 50 | +import test.Tests; | |
| 51 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | + | |
| 54 | +@RunWith(Arquillian.class) | |
| 55 | +public class AmbiguousBeansTest { | |
| 56 | + | |
| 57 | + @Deployment | |
| 58 | + public static JavaArchive createDeployment() { | |
| 59 | + JavaArchive deployment = Tests.createDeployment(AmbiguousBeansTest.class); | |
| 60 | + return deployment; | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void failOnAmbiguousBeansImplementationsTest() { | |
| 65 | + try { | |
| 66 | + Beans.getReference(Bean.class); | |
| 67 | + } catch (DemoiselleException cause) { | |
| 68 | + assertEquals(AmbiguousResolutionException.class, cause.getCause().getClass()); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Test | |
| 73 | + public void failOnAmbiguousQualifiedBeansImplementationsTest() { | |
| 74 | + try { | |
| 75 | + Beans.getReference(Bean.class, new AnnotationLiteral<AmbiguousQualifier>() { | |
| 76 | + | |
| 77 | + private static final long serialVersionUID = 1L; | |
| 78 | + }); | |
| 79 | + } catch (DemoiselleException cause) { | |
| 80 | + assertEquals(AmbiguousResolutionException.class, cause.getCause().getClass()); | |
| 81 | + } | |
| 82 | + } | |
| 83 | + | |
| 84 | + @Test | |
| 85 | + public void ambiguityResolvedByQualifiersTest() { | |
| 86 | + Bean bean; | |
| 87 | + | |
| 88 | + bean = Beans.getReference(Bean.class, new AnnotationLiteral<FirstValidQualifier>() { | |
| 89 | + | |
| 90 | + private static final long serialVersionUID = 1L; | |
| 91 | + }); | |
| 92 | + assertEquals(FirstValidQualifiedBean.class, bean.getClass()); | |
| 93 | + | |
| 94 | + bean = Beans.getReference(Bean.class, new AnnotationLiteral<SecondValidQualifier>() { | |
| 95 | + | |
| 96 | + private static final long serialVersionUID = 1L; | |
| 97 | + }); | |
| 98 | + assertEquals(SecondValidQualifiedBean.class, bean.getClass()); | |
| 99 | + } | |
| 100 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/AmbiguousQualifier.java
0 → 100644
| ... | ... | @@ -0,0 +1,57 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Inherited; | |
| 46 | +import java.lang.annotation.Retention; | |
| 47 | +import java.lang.annotation.Target; | |
| 48 | + | |
| 49 | +import javax.inject.Qualifier; | |
| 50 | + | |
| 51 | +@Qualifier | |
| 52 | +@Inherited | |
| 53 | +@Retention(RUNTIME) | |
| 54 | +@Target({ TYPE, FIELD, METHOD, PARAMETER }) | |
| 55 | +public @interface AmbiguousQualifier { | |
| 56 | + | |
| 57 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +public interface Bean { | |
| 40 | + | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/FirstAmbiguousBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +public class FirstAmbiguousBean implements Bean { | |
| 40 | + | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/FirstAmbiguousQualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,42 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +@AmbiguousQualifier | |
| 40 | +public class FirstAmbiguousQualifiedBean implements Bean { | |
| 41 | + | |
| 42 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/FirstValidQualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,42 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +@FirstValidQualifier | |
| 40 | +public class FirstValidQualifiedBean implements Bean { | |
| 41 | + | |
| 42 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/FirstValidQualifier.java
0 → 100644
| ... | ... | @@ -0,0 +1,57 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Inherited; | |
| 46 | +import java.lang.annotation.Retention; | |
| 47 | +import java.lang.annotation.Target; | |
| 48 | + | |
| 49 | +import javax.inject.Qualifier; | |
| 50 | + | |
| 51 | +@Qualifier | |
| 52 | +@Inherited | |
| 53 | +@Retention(RUNTIME) | |
| 54 | +@Target({ TYPE, FIELD, METHOD, PARAMETER }) | |
| 55 | +public @interface FirstValidQualifier { | |
| 56 | + | |
| 57 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/SecondAmbiguousBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +public class SecondAmbiguousBean implements Bean { | |
| 40 | + | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/SecondAmbiguousQualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,42 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +@AmbiguousQualifier | |
| 40 | +public class SecondAmbiguousQualifiedBean implements Bean { | |
| 41 | + | |
| 42 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/SecondValidQualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,42 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +@SecondValidQualifier | |
| 40 | +public class SecondValidQualifiedBean implements Bean { | |
| 41 | + | |
| 42 | +} | ... | ... |
impl/core/src/test/java/util/beans/ambiguous/SecondValidQualifier.java
0 → 100644
| ... | ... | @@ -0,0 +1,57 @@ |
| 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 util.beans.ambiguous; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Inherited; | |
| 46 | +import java.lang.annotation.Retention; | |
| 47 | +import java.lang.annotation.Target; | |
| 48 | + | |
| 49 | +import javax.inject.Qualifier; | |
| 50 | + | |
| 51 | +@Qualifier | |
| 52 | +@Inherited | |
| 53 | +@Retention(RUNTIME) | |
| 54 | +@Target({ TYPE, FIELD, METHOD, PARAMETER }) | |
| 55 | +public @interface SecondValidQualifier { | |
| 56 | + | |
| 57 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,40 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +public interface QualifiedBean { | |
| 40 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeanOne.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +@QualifierOne | |
| 40 | +public class QualifiedBeanOne implements QualifiedBean { | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeanTwo.java
0 → 100644
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +@QualifierTwo | |
| 40 | +public class QualifiedBeanTwo implements QualifiedBean{ | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifiedBeansTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,81 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.fail; | |
| 41 | + | |
| 42 | +import java.util.NoSuchElementException; | |
| 43 | + | |
| 44 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | +import org.jboss.arquillian.junit.Arquillian; | |
| 46 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | +import org.junit.Test; | |
| 48 | +import org.junit.runner.RunWith; | |
| 49 | + | |
| 50 | +import test.Tests; | |
| 51 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | + | |
| 54 | +@RunWith(Arquillian.class) | |
| 55 | +public class QualifiedBeansTest { | |
| 56 | + | |
| 57 | + @Deployment | |
| 58 | + public static JavaArchive createDeployment() { | |
| 59 | + JavaArchive deployment = Tests.createDeployment(QualifiedBeansTest.class); | |
| 60 | + return deployment; | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void beanClassAndQualifierTest() { | |
| 65 | + assertEquals(QualifiedBeanOne.class, | |
| 66 | + (Beans.getReference(QualifiedBean.class, QualifiedBeanOne.class.getAnnotations())).getClass()); | |
| 67 | + assertEquals(QualifiedBeanTwo.class, | |
| 68 | + (Beans.getReference(QualifiedBean.class, QualifiedBeanTwo.class.getAnnotations())).getClass()); | |
| 69 | + } | |
| 70 | + | |
| 71 | + @Test | |
| 72 | + public void beanClassAndQualifierExceptionTest() { | |
| 73 | + try { | |
| 74 | + Beans.getReference(QualifiedBean.class, QualifiedBeanOne.class.getAnnotations()[0], | |
| 75 | + QualifiedBeanTwo.class.getAnnotations()[0]); | |
| 76 | + fail(); | |
| 77 | + } catch (DemoiselleException cause) { | |
| 78 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 79 | + } | |
| 80 | + } | |
| 81 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifierOne.java
0 → 100644
| ... | ... | @@ -0,0 +1,54 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Retention; | |
| 46 | +import java.lang.annotation.Target; | |
| 47 | + | |
| 48 | +import javax.inject.Qualifier; | |
| 49 | + | |
| 50 | +@Qualifier | |
| 51 | +@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | +@Retention(RUNTIME) | |
| 53 | +public @interface QualifierOne { | |
| 54 | +} | ... | ... |
impl/core/src/test/java/util/beans/qualifier/QualifierTwo.java
0 → 100644
| ... | ... | @@ -0,0 +1,54 @@ |
| 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 util.beans.qualifier; | |
| 38 | + | |
| 39 | +import static java.lang.annotation.ElementType.FIELD; | |
| 40 | +import static java.lang.annotation.ElementType.METHOD; | |
| 41 | +import static java.lang.annotation.ElementType.PARAMETER; | |
| 42 | +import static java.lang.annotation.ElementType.TYPE; | |
| 43 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 44 | + | |
| 45 | +import java.lang.annotation.Retention; | |
| 46 | +import java.lang.annotation.Target; | |
| 47 | + | |
| 48 | +import javax.inject.Qualifier; | |
| 49 | + | |
| 50 | +@Qualifier | |
| 51 | +@Target({TYPE, METHOD, PARAMETER, FIELD}) | |
| 52 | +@Retention(RUNTIME) | |
| 53 | +public @interface QualifierTwo { | |
| 54 | +} | |
| 0 | 55 | \ No newline at end of file | ... | ... |
impl/core/src/test/java/util/beans/simple/AloneBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,40 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +public interface AloneBean { | |
| 40 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +public interface Bean { | |
| 40 | + | |
| 41 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,41 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +public class BeanImpl implements Bean { | |
| 40 | + | |
| 41 | +} | ... | ... |
impl/core/src/test/java/util/beans/simple/NamedBean.java
0 → 100644
| ... | ... | @@ -0,0 +1,43 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +import javax.inject.Named; | |
| 40 | + | |
| 41 | +@Named | |
| 42 | +public class NamedBean { | |
| 43 | +} | ... | ... |
impl/core/src/test/java/util/beans/simple/SimpleBeansTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,92 @@ |
| 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 util.beans.simple; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.fail; | |
| 41 | + | |
| 42 | +import java.util.NoSuchElementException; | |
| 43 | + | |
| 44 | +import org.jboss.arquillian.container.test.api.Deployment; | |
| 45 | +import org.jboss.arquillian.junit.Arquillian; | |
| 46 | +import org.jboss.shrinkwrap.api.spec.JavaArchive; | |
| 47 | +import org.junit.Test; | |
| 48 | +import org.junit.runner.RunWith; | |
| 49 | + | |
| 50 | +import test.Tests; | |
| 51 | +import br.gov.frameworkdemoiselle.DemoiselleException; | |
| 52 | +import br.gov.frameworkdemoiselle.util.Beans; | |
| 53 | + | |
| 54 | +@RunWith(Arquillian.class) | |
| 55 | +public class SimpleBeansTest { | |
| 56 | + | |
| 57 | + @Deployment | |
| 58 | + public static JavaArchive createDeployment() { | |
| 59 | + JavaArchive deployment = Tests.createDeployment(SimpleBeansTest.class); | |
| 60 | + return deployment; | |
| 61 | + } | |
| 62 | + | |
| 63 | + @Test | |
| 64 | + public void defaultBeanImplementationTest() { | |
| 65 | + assertEquals(BeanImpl.class, Beans.getReference(Bean.class).getClass()); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Test | |
| 69 | + public void failOnGetBeanInterfaceWithoutImplementationTest() { | |
| 70 | + try { | |
| 71 | + Beans.getReference(AloneBean.class); | |
| 72 | + fail(); | |
| 73 | + } catch (DemoiselleException cause) { | |
| 74 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + @Test | |
| 79 | + public void validBeanNameTest() { | |
| 80 | + assertEquals(NamedBean.class, Beans.getReference("namedBean").getClass()); | |
| 81 | + } | |
| 82 | + | |
| 83 | + @Test | |
| 84 | + public void invalidBeanNameTest() { | |
| 85 | + try { | |
| 86 | + Beans.getReference("wrongNamedBean"); | |
| 87 | + fail(); | |
| 88 | + } catch (DemoiselleException cause) { | |
| 89 | + assertEquals(NoSuchElementException.class, cause.getCause().getClass()); | |
| 90 | + } | |
| 91 | + } | |
| 92 | +} | ... | ... |
impl/core/src/test/java/util/exception/ExceptionsTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,90 @@ |
| 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 util.exception; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertFalse; | |
| 40 | +import static org.junit.Assert.assertTrue; | |
| 41 | +import static org.junit.Assert.fail; | |
| 42 | + | |
| 43 | +import org.junit.Test; | |
| 44 | + | |
| 45 | +import br.gov.frameworkdemoiselle.exception.ApplicationException; | |
| 46 | +import br.gov.frameworkdemoiselle.util.Exceptions; | |
| 47 | + | |
| 48 | +public class ExceptionsTest { | |
| 49 | + | |
| 50 | + @Test | |
| 51 | + public void testIsApplicationException() { | |
| 52 | + assertTrue(Exceptions.isApplicationException(new MyException())); | |
| 53 | + assertFalse(Exceptions.isApplicationException(new Exception())); | |
| 54 | + } | |
| 55 | + | |
| 56 | + @Test | |
| 57 | + public void testHandleRuntimeException() { | |
| 58 | + try { | |
| 59 | + Exceptions.handleToRuntimeException(new SomeRuntimeException()); | |
| 60 | + fail(); | |
| 61 | + } catch (Throwable t) { | |
| 62 | + if (!RuntimeException.class.isInstance(t)) { | |
| 63 | + fail(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + | |
| 67 | + try { | |
| 68 | + Exceptions.handleToRuntimeException(new Exception()); | |
| 69 | + fail(); | |
| 70 | + } catch (Throwable t) { | |
| 71 | + if (!RuntimeException.class.isInstance(t)) { | |
| 72 | + fail(); | |
| 73 | + } | |
| 74 | + } | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | +} | |
| 79 | + | |
| 80 | +@ApplicationException | |
| 81 | +class MyException extends Exception { | |
| 82 | + | |
| 83 | + private static final long serialVersionUID = 1L; | |
| 84 | +} | |
| 85 | + | |
| 86 | +class SomeRuntimeException extends RuntimeException { | |
| 87 | + | |
| 88 | + private static final long serialVersionUID = 1L; | |
| 89 | + | |
| 90 | +} | ... | ... |
impl/core/src/test/java/util/reflection/ReflectionsTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,75 @@ |
| 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 util.reflection; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | + | |
| 41 | +import java.lang.reflect.Member; | |
| 42 | + | |
| 43 | +import org.junit.Test; | |
| 44 | + | |
| 45 | +import br.gov.frameworkdemoiselle.util.Reflections; | |
| 46 | + | |
| 47 | +public class ReflectionsTest { | |
| 48 | + | |
| 49 | + @Test | |
| 50 | + public void testGetGenericTypeArgumentClass() { | |
| 51 | + assertEquals(Long.class, Reflections.getGenericTypeArgument(OtherClass.class, 0)); | |
| 52 | + assertEquals(String.class, Reflections.getGenericTypeArgument(OtherClass.class, 1)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Test | |
| 56 | + public void testGetGenericTypeArgumentMember() throws SecurityException, NoSuchFieldException { | |
| 57 | + Member[] members = OtherClass.class.getFields(); | |
| 58 | + assertEquals(Long.class, Reflections.getGenericTypeArgument(members[0], 0)); | |
| 59 | + assertEquals(String.class, Reflections.getGenericTypeArgument(members[1], 0)); | |
| 60 | + } | |
| 61 | +} | |
| 62 | + | |
| 63 | +class SomeClass<T, I> { | |
| 64 | + | |
| 65 | + public void setNumber(final T t) { | |
| 66 | + | |
| 67 | + } | |
| 68 | +} | |
| 69 | + | |
| 70 | +class OtherClass extends SomeClass<Long, String> { | |
| 71 | + | |
| 72 | + public Class<Long> number; | |
| 73 | + | |
| 74 | + public Class<String> text; | |
| 75 | +} | ... | ... |
impl/core/src/test/java/util/resourcebundle/ResourceBundleTest.java
0 → 100644
| ... | ... | @@ -0,0 +1,66 @@ |
| 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 util.resourcebundle; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | + | |
| 41 | +import java.util.Locale; | |
| 42 | + | |
| 43 | +import org.junit.Before; | |
| 44 | +import org.junit.Test; | |
| 45 | + | |
| 46 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | |
| 47 | + | |
| 48 | +public class ResourceBundleTest { | |
| 49 | + | |
| 50 | + private ResourceBundle resourceBundle; | |
| 51 | + | |
| 52 | + @Before | |
| 53 | + public void setUp() throws Exception { | |
| 54 | + resourceBundle = new ResourceBundle("resourcebundle/resource-bundle", new Locale("pt")); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Test | |
| 58 | + public void getString() { | |
| 59 | + assertEquals("no params", resourceBundle.getString("msgWithoutParams")); | |
| 60 | + | |
| 61 | + assertEquals("params: a, b", resourceBundle.getString("msgWithParams", "a", "b")); | |
| 62 | + | |
| 63 | + assertEquals("params: {0}, {1}", resourceBundle.getString("msgWithParams")); | |
| 64 | + } | |
| 65 | + | |
| 66 | +} | ... | ... |
| ... | ... | @@ -0,0 +1,202 @@ |
| 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 util.string; | |
| 38 | + | |
| 39 | +import static org.junit.Assert.assertEquals; | |
| 40 | +import static org.junit.Assert.assertFalse; | |
| 41 | +import static org.junit.Assert.assertNull; | |
| 42 | +import static org.junit.Assert.assertTrue; | |
| 43 | + | |
| 44 | +import org.junit.Test; | |
| 45 | + | |
| 46 | +import br.gov.frameworkdemoiselle.annotation.Ignore; | |
| 47 | +import br.gov.frameworkdemoiselle.util.Strings; | |
| 48 | + | |
| 49 | +public class StringsTest { | |
| 50 | + | |
| 51 | + @Test | |
| 52 | + public void getString() { | |
| 53 | + testEqualsGetString("teste", "teste"); | |
| 54 | + testEqualsGetString("", ""); | |
| 55 | + testEqualsGetString(null, null); | |
| 56 | + testEqualsGetString(null, null, "teste"); | |
| 57 | + testEqualsGetString("{0}", "teste", "teste"); | |
| 58 | + testEqualsGetString("teste", "teste", (Object[]) null); | |
| 59 | + testEqualsGetString("teste {0}", "teste 1", "1"); | |
| 60 | + testEqualsGetString("{0} teste", "Um teste", "Um"); | |
| 61 | + testEqualsGetString("{1} testando {0}", "Apenas testando novamente", "novamente", "Apenas"); | |
| 62 | + testEqualsGetString("{0} testando {1}", "Apenas testando {1}", "Apenas", null); | |
| 63 | + testEqualsGetString("testando {1} novamente", "testando isto novamente", "aquilo", "isto"); | |
| 64 | + testEqualsGetString("teste", "teste", "1", "2"); | |
| 65 | + testEqualsGetString("teste {0}.", "teste \\.", "\\"); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @Test | |
| 69 | + public void isEmpty() { | |
| 70 | + assertTrue(Strings.isEmpty(null)); | |
| 71 | + assertTrue(Strings.isEmpty("")); | |
| 72 | + assertTrue(Strings.isEmpty(" ")); | |
| 73 | + assertTrue(Strings.isEmpty(" ")); | |
| 74 | + | |
| 75 | + assertFalse(Strings.isEmpty(" _ ")); | |
| 76 | + assertFalse(Strings.isEmpty(".")); | |
| 77 | + assertFalse(Strings.isEmpty("null")); | |
| 78 | + } | |
| 79 | + | |
| 80 | + @Test | |
| 81 | + public void isResourceBundleKeyFormat() { | |
| 82 | + assertTrue(Strings.isResourceBundleKeyFormat("{x}")); | |
| 83 | + assertTrue(Strings.isResourceBundleKeyFormat("{.}")); | |
| 84 | + assertTrue(Strings.isResourceBundleKeyFormat("{*}")); | |
| 85 | + assertTrue(Strings.isResourceBundleKeyFormat("{$}")); | |
| 86 | + assertFalse(Strings.isResourceBundleKeyFormat("{}")); | |
| 87 | + assertFalse(Strings.isResourceBundleKeyFormat("")); | |
| 88 | + assertFalse(Strings.isResourceBundleKeyFormat(" ")); | |
| 89 | + assertFalse(Strings.isResourceBundleKeyFormat(null)); | |
| 90 | + assertFalse(Strings.isResourceBundleKeyFormat("a{a}a")); | |
| 91 | + assertFalse(Strings.isResourceBundleKeyFormat("a{a}")); | |
| 92 | + assertFalse(Strings.isResourceBundleKeyFormat("{a}a")); | |
| 93 | + assertFalse(Strings.isResourceBundleKeyFormat(" {a} ")); | |
| 94 | + assertFalse(Strings.isResourceBundleKeyFormat("{a")); | |
| 95 | + assertFalse(Strings.isResourceBundleKeyFormat("a}")); | |
| 96 | + } | |
| 97 | + | |
| 98 | + @Test | |
| 99 | + public void camelCaseToSymbolSeparated() { | |
| 100 | + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, null)); | |
| 101 | + assertEquals(null, Strings.camelCaseToSymbolSeparated(null, ".")); | |
| 102 | + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", null)); | |
| 103 | + assertEquals("myvar", Strings.camelCaseToSymbolSeparated("myVar", "")); | |
| 104 | + assertEquals("my.var", Strings.camelCaseToSymbolSeparated("myVar", ".")); | |
| 105 | + assertEquals("my-var", Strings.camelCaseToSymbolSeparated("MyVar", "-")); | |
| 106 | + assertEquals("my?var?name", Strings.camelCaseToSymbolSeparated("myVarName", "?")); | |
| 107 | + assertEquals("my___var___name", Strings.camelCaseToSymbolSeparated("myVarName", "___")); | |
| 108 | + } | |
| 109 | + | |
| 110 | + @Test | |
| 111 | + public void firstToUpper() { | |
| 112 | + assertNull(Strings.firstToUpper(null)); | |
| 113 | + assertEquals("", Strings.firstToUpper("")); | |
| 114 | + assertEquals("A", Strings.firstToUpper("a")); | |
| 115 | + assertEquals("A", Strings.firstToUpper("A")); | |
| 116 | + assertEquals("Ab", Strings.firstToUpper("Ab")); | |
| 117 | + assertEquals("AB", Strings.firstToUpper("AB")); | |
| 118 | + assertEquals("Ab", Strings.firstToUpper("ab")); | |
| 119 | + assertEquals("AB", Strings.firstToUpper("aB")); | |
| 120 | + } | |
| 121 | + | |
| 122 | + @Test | |
| 123 | + public void toStringWhenObjectIsNull() { | |
| 124 | + assertEquals("", Strings.toString(null)); | |
| 125 | + } | |
| 126 | + | |
| 127 | + @Test | |
| 128 | + public void classToString() throws SecurityException, NoSuchFieldException { | |
| 129 | + @SuppressWarnings("unused") | |
| 130 | + class Test { | |
| 131 | + | |
| 132 | + private String name = "myName"; | |
| 133 | + | |
| 134 | + private String lastname = "myLastname"; | |
| 135 | + | |
| 136 | + private String nullField = null; | |
| 137 | + | |
| 138 | + @Ignore | |
| 139 | + private String ignore = "ignoreMe"; | |
| 140 | + | |
| 141 | + } | |
| 142 | + | |
| 143 | + String result = Strings.toString(new Test()); | |
| 144 | + assertTrue(result.contains("Test [name=myName, lastname=myLastname, nullField=null, this")); | |
| 145 | + } | |
| 146 | + | |
| 147 | + private void testEqualsGetString(final String in, final String expected, final Object... params) { | |
| 148 | + String out = Strings.getString(in, params); | |
| 149 | + assertEquals(expected, out); | |
| 150 | + } | |
| 151 | + | |
| 152 | + @Test | |
| 153 | + public void removeBraces() { | |
| 154 | + assertNull(Strings.removeBraces(null)); | |
| 155 | + assertEquals("", Strings.removeBraces("")); | |
| 156 | + assertEquals(" ", Strings.removeBraces(" ")); | |
| 157 | + assertEquals(" {x} ", Strings.removeBraces(" {x} ")); | |
| 158 | + assertEquals("{x} ", Strings.removeBraces("{x} ")); | |
| 159 | + assertEquals(" {x}", Strings.removeBraces(" {x}")); | |
| 160 | + assertEquals("x", Strings.removeBraces("{x}")); | |
| 161 | + assertEquals("a b c", Strings.removeBraces("{a b c}")); | |
| 162 | + assertEquals("{}", Strings.removeBraces("{}")); | |
| 163 | + assertEquals("{}", Strings.removeBraces("{{}}")); | |
| 164 | + assertEquals("?", Strings.removeBraces("{?}")); | |
| 165 | + assertEquals("*", Strings.removeBraces("{*}")); | |
| 166 | + } | |
| 167 | + | |
| 168 | + @Test | |
| 169 | + public void insertBraces() { | |
| 170 | + assertNull(Strings.insertBraces(null)); | |
| 171 | + assertEquals("", Strings.insertBraces("")); | |
| 172 | + assertEquals(" ", Strings.insertBraces(" ")); | |
| 173 | + assertEquals("{ x }", Strings.insertBraces(" x ")); | |
| 174 | + assertEquals("{ {x} }", Strings.insertBraces(" {x} ")); | |
| 175 | + assertEquals("{{x}", Strings.insertBraces("{x")); | |
| 176 | + assertEquals("{*}", Strings.insertBraces("*")); | |
| 177 | + assertEquals("{?}", Strings.insertBraces("?")); | |
| 178 | + } | |
| 179 | + | |
| 180 | + @Test | |
| 181 | + public void removeCharsWhenStringIsNull() { | |
| 182 | + assertEquals(null, Strings.removeChars(null, 'a')); | |
| 183 | + } | |
| 184 | + | |
| 185 | + @Test | |
| 186 | + public void removeCharsWhenStringIsNotNull() { | |
| 187 | + String string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus lobortis."; | |
| 188 | + string = Strings.removeChars(string, 'L', 'l'); | |
| 189 | + assertEquals(-1, string.indexOf('L')); | |
| 190 | + assertEquals(-1, string.indexOf('l')); | |
| 191 | + } | |
| 192 | + | |
| 193 | + @Test | |
| 194 | + public void insertZeros() { | |
| 195 | + String string = "Lorem ipsum"; | |
| 196 | + assertEquals("00000", Strings.insertZeros(null, 5)); | |
| 197 | + assertEquals(string, Strings.insertZeros(string, string.length() - 1)); | |
| 198 | + assertEquals(string, Strings.insertZeros(string, string.length())); | |
| 199 | + assertEquals("0" + string, Strings.insertZeros(string, string.length() + 1)); | |
| 200 | + assertEquals("00" + string, Strings.insertZeros(string, string.length() + 2)); | |
| 201 | + } | |
| 202 | +} | ... | ... |
impl/extension/jpa/src/main/java/br/gov/frameworkdemoiselle/internal/producer/EntityManagerProducer.java
| ... | ... | @@ -111,7 +111,7 @@ public class EntityManagerProducer implements Serializable{ |
| 111 | 111 | /** |
| 112 | 112 | * |
| 113 | 113 | * <p> |
| 114 | - * Factory that reads the {@link Name} qualifier and creates an entity manager with | |
| 114 | + * Factory that reads the {@link AmbiguousQualifier} qualifier and creates an entity manager with | |
| 115 | 115 | * a matching persistence unit name. |
| 116 | 116 | * </p> |
| 117 | 117 | * |
| ... | ... | @@ -149,7 +149,7 @@ public class EntityManagerProducer implements Serializable{ |
| 149 | 149 | * Uses persistence.xml to get informations about which persistence unit to use. Throws DemoiselleException if more |
| 150 | 150 | * than one Persistence Unit is defined. |
| 151 | 151 | * |
| 152 | - * @return Persistence Unit Name | |
| 152 | + * @return Persistence Unit AmbiguousQualifier | |
| 153 | 153 | */ |
| 154 | 154 | private String getFromXML() { |
| 155 | 155 | Set<String> persistenceUnits = factory.getCache().keySet(); | ... | ... |