Commit e698525ace98539631f5cf496eda64a839997436

Authored by Ednara Oliveira
2 parents 91e81174 2aac7753
Exists in master

Merge branch 'master' of git@github.com:demoiselle/framework.git

impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrapTest.java
... ... @@ -39,27 +39,20 @@ package br.gov.frameworkdemoiselle.internal.bootstrap;
39 39 import static org.easymock.EasyMock.expect;
40 40 import static org.powermock.api.easymock.PowerMock.createMock;
41 41 import static org.powermock.api.easymock.PowerMock.mockStatic;
42   -import static org.powermock.api.easymock.PowerMock.replayAll;
43 42 import static org.powermock.api.easymock.PowerMock.replay;
44 43 import static org.powermock.api.easymock.PowerMock.verifyAll;
45   -import static org.powermock.api.easymock.PowerMock.verify;
46 44  
47   -import java.lang.annotation.Annotation;
48 45 import java.util.ArrayList;
49 46 import java.util.List;
50 47 import java.util.Locale;
51 48  
52   -import javax.enterprise.context.spi.Contextual;
53   -import javax.enterprise.context.spi.CreationalContext;
54 49 import javax.enterprise.inject.spi.AfterBeanDiscovery;
55 50 import javax.enterprise.inject.spi.AfterDeploymentValidation;
56 51  
57 52 import junit.framework.Assert;
58 53  
59   -import org.easymock.EasyMock;
60 54 import org.junit.Before;
61 55 import org.junit.Test;
62   -import org.junit.rules.TemporaryFolder;
63 56 import org.junit.runner.RunWith;
64 57 import org.powermock.core.classloader.annotations.PrepareForTest;
65 58 import org.powermock.modules.junit4.PowerMockRunner;
... ...
impl/extension/se/src/main/java/br/gov/frameworkdemoiselle/internal/producer/SeLocaleProducer.java
  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 + */
1 37 package br.gov.frameworkdemoiselle.internal.producer;
2 38  
3 39 import java.util.Locale;
... ...
impl/extension/se/src/test/java/br/gov/frameworkdemoiselle/internal/bootstrap/SeBootstrapTest.java 0 → 100644
... ... @@ -0,0 +1,102 @@
  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 br.gov.frameworkdemoiselle.internal.bootstrap;
  38 +
  39 +import static org.easymock.EasyMock.expect;
  40 +import static org.powermock.api.easymock.PowerMock.createMock;
  41 +import static org.powermock.api.easymock.PowerMock.mockStatic;
  42 +import static org.powermock.api.easymock.PowerMock.replay;
  43 +import static org.powermock.api.easymock.PowerMock.verifyAll;
  44 +
  45 +import java.util.List;
  46 +import java.util.Locale;
  47 +
  48 +import javax.enterprise.inject.spi.AfterBeanDiscovery;
  49 +
  50 +import junit.framework.Assert;
  51 +
  52 +import org.junit.Before;
  53 +import org.junit.Test;
  54 +import org.junit.runner.RunWith;
  55 +import org.powermock.core.classloader.annotations.PrepareForTest;
  56 +import org.powermock.modules.junit4.PowerMockRunner;
  57 +import org.powermock.reflect.Whitebox;
  58 +
  59 +import br.gov.frameworkdemoiselle.internal.context.Contexts;
  60 +import br.gov.frameworkdemoiselle.internal.context.CustomContext;
  61 +import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess;
  62 +import br.gov.frameworkdemoiselle.util.Beans;
  63 +
  64 +@RunWith(PowerMockRunner.class)
  65 +@PrepareForTest({ Beans.class, Contexts.class })
  66 +public class SeBootstrapTest {
  67 +
  68 + private SeBootstrap seBootstrap;
  69 +
  70 + private AfterBeanDiscovery event;
  71 +
  72 + @Before
  73 + public void before() {
  74 + event = createMock(AfterBeanDiscovery.class);
  75 + mockStatic(Beans.class);
  76 + expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault()).anyTimes();
  77 + replay(Beans.class);
  78 + seBootstrap = new SeBootstrap();
  79 + }
  80 +
  81 + @Test
  82 + public void testStoreContext() {
  83 + seBootstrap.storeContexts(event);
  84 + replay(event);
  85 +
  86 + Assert.assertEquals(event, Whitebox.getInternalState(seBootstrap, "afterBeanDiscoveryEvent"));
  87 + List<CustomContext> context = Whitebox.getInternalState(seBootstrap, "tempContexts");
  88 + Assert.assertEquals(4, context.size());
  89 + verifyAll();
  90 + }
  91 +
  92 + @Test
  93 + public void testRemoveContexts() {
  94 + seBootstrap.storeContexts(event);
  95 +
  96 + AfterShutdownProccess afterShutdownProccess = createMock(AfterShutdownProccess.class);
  97 + replay(event, afterShutdownProccess);
  98 + seBootstrap.removeContexts(afterShutdownProccess);
  99 +
  100 + verifyAll();
  101 + }
  102 +}
... ...
impl/extension/se/src/test/java/br/gov/frameworkdemoiselle/internal/producer/SeLocaleProducerTest.java
  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 + */
1 37 package br.gov.frameworkdemoiselle.internal.producer;
2   -import org.junit.Ignore;
  38 +
3 39 import java.util.Locale;
4 40  
5 41 import junit.framework.Assert;
... ... @@ -10,11 +46,7 @@ public class SeLocaleProducerTest {
10 46  
11 47 @Test
12 48 public void testCreate() {
13   -
14 49 Locale locale = (new SeLocaleProducer()).create();
15   -
16 50 Assert.assertNotNull(locale);
17   -
18 51 }
19   -
20 52 }
... ...