From 93b74e515787ab961fd164d322fd3e979eea63c6 Mon Sep 17 00:00:00 2001 From: Cleverson Sacramento Date: Fri, 27 Sep 2013 14:40:39 -0300 Subject: [PATCH] REOPENED - issue FWK-97: Seleção do producer em Beans.getReference() é aleatória --- impl/core/src/test/java/util/beans/BeansTest.java | 12 ++++++------ impl/core/src/test/java/util/beans/DummyQualified.java | 40 ++++++++++++++++++++++++++++++++++++++++ impl/core/src/test/java/util/beans/DummyQualifiedOne.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ impl/core/src/test/java/util/beans/DummyQualifiedTwo.java | 41 +++++++++++++++++++++++++++++++++++++++++ impl/core/src/test/java/util/beans/DummyQualifier.java | 40 ---------------------------------------- impl/core/src/test/java/util/beans/DummyQualifierOne.java | 41 ----------------------------------------- impl/core/src/test/java/util/beans/DummyQualifierTwo.java | 41 ----------------------------------------- 7 files changed, 131 insertions(+), 128 deletions(-) create mode 100644 impl/core/src/test/java/util/beans/DummyQualified.java create mode 100644 impl/core/src/test/java/util/beans/DummyQualifiedOne.java create mode 100644 impl/core/src/test/java/util/beans/DummyQualifiedTwo.java delete mode 100644 impl/core/src/test/java/util/beans/DummyQualifier.java delete mode 100644 impl/core/src/test/java/util/beans/DummyQualifierOne.java delete mode 100644 impl/core/src/test/java/util/beans/DummyQualifierTwo.java diff --git a/impl/core/src/test/java/util/beans/BeansTest.java b/impl/core/src/test/java/util/beans/BeansTest.java index 4ade19c..a64ec55 100644 --- a/impl/core/src/test/java/util/beans/BeansTest.java +++ b/impl/core/src/test/java/util/beans/BeansTest.java @@ -62,17 +62,17 @@ public class BeansTest { @Test public void beanClassAndQualifierTest() { - assertEquals(DummyQualifierOne.class, - (Beans.getReference(DummyQualifier.class, DummyQualifierOne.class.getAnnotations())).getClass()); - assertEquals(DummyQualifierTwo.class, - (Beans.getReference(DummyQualifier.class, DummyQualifierTwo.class.getAnnotations())).getClass()); + assertEquals(DummyQualifiedOne.class, + (Beans.getReference(DummyQualified.class, DummyQualifiedOne.class.getAnnotations())).getClass()); + assertEquals(DummyQualifiedTwo.class, + (Beans.getReference(DummyQualified.class, DummyQualifiedTwo.class.getAnnotations())).getClass()); } @Test public void beanClassAndQualifierExceptionTest() { try { - Beans.getReference(DummyQualifier.class, DummyQualifierOne.class.getAnnotations()[0], - DummyQualifierTwo.class.getAnnotations()[0]); + Beans.getReference(DummyQualified.class, DummyQualifiedOne.class.getAnnotations()[0], + DummyQualifiedTwo.class.getAnnotations()[0]); fail(); } catch (DemoiselleException cause) { assertEquals(NoSuchElementException.class, cause.getCause().getClass()); diff --git a/impl/core/src/test/java/util/beans/DummyQualified.java b/impl/core/src/test/java/util/beans/DummyQualified.java new file mode 100644 index 0000000..fc30c88 --- /dev/null +++ b/impl/core/src/test/java/util/beans/DummyQualified.java @@ -0,0 +1,40 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package util.beans; + +public interface DummyQualified { +} diff --git a/impl/core/src/test/java/util/beans/DummyQualifiedOne.java b/impl/core/src/test/java/util/beans/DummyQualifiedOne.java new file mode 100644 index 0000000..9ec1c5a --- /dev/null +++ b/impl/core/src/test/java/util/beans/DummyQualifiedOne.java @@ -0,0 +1,44 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package util.beans; + +import javax.enterprise.inject.Alternative; + +@Alternative +@QualifierOne +public class DummyQualifiedOne implements DummyQualified { +} diff --git a/impl/core/src/test/java/util/beans/DummyQualifiedTwo.java b/impl/core/src/test/java/util/beans/DummyQualifiedTwo.java new file mode 100644 index 0000000..395927d --- /dev/null +++ b/impl/core/src/test/java/util/beans/DummyQualifiedTwo.java @@ -0,0 +1,41 @@ +/* + * Demoiselle Framework + * Copyright (C) 2010 SERPRO + * ---------------------------------------------------------------------------- + * This file is part of Demoiselle Framework. + * + * Demoiselle Framework is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License version 3 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License version 3 + * along with this program; if not, see + * or write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301, USA. + * ---------------------------------------------------------------------------- + * Este arquivo é parte do Framework Demoiselle. + * + * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou + * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação + * do Software Livre (FSF). + * + * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA + * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou + * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português + * para maiores detalhes. + * + * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título + * "LICENCA.txt", junto com esse programa. Se não, acesse + * ou escreva para a Fundação do Software Livre (FSF) Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. + */ +package util.beans; + +@QualifierTwo +public class DummyQualifiedTwo implements DummyQualified{ +} diff --git a/impl/core/src/test/java/util/beans/DummyQualifier.java b/impl/core/src/test/java/util/beans/DummyQualifier.java deleted file mode 100644 index e0fecf5..0000000 --- a/impl/core/src/test/java/util/beans/DummyQualifier.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package util.beans; - -public interface DummyQualifier { -} diff --git a/impl/core/src/test/java/util/beans/DummyQualifierOne.java b/impl/core/src/test/java/util/beans/DummyQualifierOne.java deleted file mode 100644 index b6afffd..0000000 --- a/impl/core/src/test/java/util/beans/DummyQualifierOne.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package util.beans; - -@QualifierOne -public class DummyQualifierOne implements DummyQualifier { -} diff --git a/impl/core/src/test/java/util/beans/DummyQualifierTwo.java b/impl/core/src/test/java/util/beans/DummyQualifierTwo.java deleted file mode 100644 index 547bda0..0000000 --- a/impl/core/src/test/java/util/beans/DummyQualifierTwo.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package util.beans; - -@QualifierTwo -public class DummyQualifierTwo implements DummyQualifier{ -} -- libgit2 0.21.2