Commit f58f76d88df4bf6ef95d103b466211fa3dd988ba
Exists in
master
Merge branch 'master' of git@github.com:demoiselle/framework.git
Showing
8 changed files
with
337 additions
and
36 deletions
Show diff stats
impl/extension/jta/src/test/java/br/gov/frameworkdemoiselle/transaction/JTATransactionTest.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 | + */ | |
| 37 | + | |
| 1 | 38 | package br.gov.frameworkdemoiselle.transaction; |
| 2 | 39 | |
| 3 | 40 | import static org.easymock.EasyMock.createMock; | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletRequestProducerTest.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 static org.easymock.EasyMock.replay; |
| ... | ... | @@ -5,20 +41,18 @@ import static org.powermock.api.easymock.PowerMock.createMock; |
| 5 | 41 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
| 6 | 42 | |
| 7 | 43 | import javax.servlet.http.HttpServletRequest; |
| 8 | -import javax.servlet.http.HttpServletResponse; | |
| 9 | 44 | |
| 10 | 45 | import junit.framework.Assert; |
| 11 | 46 | |
| 12 | 47 | import org.junit.Test; |
| 13 | 48 | import org.powermock.reflect.Whitebox; |
| 14 | 49 | |
| 15 | - | |
| 16 | 50 | public class HttpServletRequestProducerTest { |
| 17 | 51 | |
| 18 | 52 | private HttpServletRequestProducer httpServletRequestProducer; |
| 19 | - | |
| 53 | + | |
| 20 | 54 | private HttpServletRequest request; |
| 21 | - | |
| 55 | + | |
| 22 | 56 | @Test |
| 23 | 57 | public void testCreate() { |
| 24 | 58 | request = createMock(HttpServletRequest.class); |
| ... | ... | @@ -28,10 +62,10 @@ public class HttpServletRequestProducerTest { |
| 28 | 62 | Whitebox.setInternalState(httpServletRequestProducer, "request", request); |
| 29 | 63 | |
| 30 | 64 | Assert.assertEquals(httpServletRequestProducer.create(), request); |
| 31 | - | |
| 65 | + | |
| 32 | 66 | verifyAll(); |
| 33 | 67 | } |
| 34 | - | |
| 68 | + | |
| 35 | 69 | @Test |
| 36 | 70 | public void testSetDelegate() { |
| 37 | 71 | request = createMock(HttpServletRequest.class); |
| ... | ... | @@ -40,9 +74,9 @@ public class HttpServletRequestProducerTest { |
| 40 | 74 | httpServletRequestProducer = new HttpServletRequestProducer(); |
| 41 | 75 | |
| 42 | 76 | httpServletRequestProducer.setDelegate(request); |
| 43 | - Assert.assertEquals(Whitebox.getInternalState(httpServletRequestProducer, "request"),request); | |
| 44 | - | |
| 77 | + Assert.assertEquals(Whitebox.getInternalState(httpServletRequestProducer, "request"), request); | |
| 78 | + | |
| 45 | 79 | verifyAll(); |
| 46 | - } | |
| 47 | - | |
| 80 | + } | |
| 81 | + | |
| 48 | 82 | } | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpServletResponseProducerTest.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 static org.easymock.EasyMock.replay; |
| 4 | 40 | import static org.powermock.api.easymock.PowerMock.createMock; |
| 5 | 41 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
| 6 | 42 | |
| 7 | -import javax.servlet.http.HttpServletRequest; | |
| 8 | 43 | import javax.servlet.http.HttpServletResponse; |
| 9 | 44 | |
| 10 | 45 | import junit.framework.Assert; |
| ... | ... | @@ -12,13 +47,12 @@ import junit.framework.Assert; |
| 12 | 47 | import org.junit.Test; |
| 13 | 48 | import org.powermock.reflect.Whitebox; |
| 14 | 49 | |
| 15 | - | |
| 16 | 50 | public class HttpServletResponseProducerTest { |
| 17 | 51 | |
| 18 | 52 | private HttpServletResponseProducer httpServletResponseProducer; |
| 19 | - | |
| 53 | + | |
| 20 | 54 | private HttpServletResponse response; |
| 21 | - | |
| 55 | + | |
| 22 | 56 | @Test |
| 23 | 57 | public void testCreate() { |
| 24 | 58 | response = createMock(HttpServletResponse.class); |
| ... | ... | @@ -28,10 +62,10 @@ public class HttpServletResponseProducerTest { |
| 28 | 62 | Whitebox.setInternalState(httpServletResponseProducer, "response", response); |
| 29 | 63 | |
| 30 | 64 | Assert.assertEquals(httpServletResponseProducer.create(), response); |
| 31 | - | |
| 65 | + | |
| 32 | 66 | verifyAll(); |
| 33 | 67 | } |
| 34 | - | |
| 68 | + | |
| 35 | 69 | @Test |
| 36 | 70 | public void testSetDelegate() { |
| 37 | 71 | response = createMock(HttpServletResponse.class); |
| ... | ... | @@ -41,8 +75,8 @@ public class HttpServletResponseProducerTest { |
| 41 | 75 | |
| 42 | 76 | httpServletResponseProducer.setDelegate(response); |
| 43 | 77 | Assert.assertEquals(Whitebox.getInternalState(httpServletResponseProducer, "response"), response); |
| 44 | - | |
| 78 | + | |
| 45 | 79 | verifyAll(); |
| 46 | - } | |
| 47 | - | |
| 80 | + } | |
| 81 | + | |
| 48 | 82 | } | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/HttpSessionProducerTest.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 static org.easymock.EasyMock.createMock; | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/producer/ServletLocaleProducerTest.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 static org.easymock.EasyMock.createMock; |
| ... | ... | @@ -36,7 +72,7 @@ public class ServletLocaleProducerTest { |
| 36 | 72 | |
| 37 | 73 | verifyAll(); |
| 38 | 74 | } |
| 39 | - | |
| 75 | + | |
| 40 | 76 | @Test |
| 41 | 77 | public void testCreate2() { |
| 42 | 78 | servletLocaleProducer = new ServletLocaleProducer(); | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/internal/proxy/HttpServletRequestProxyTest.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.proxy; |
| 2 | 38 | |
| 3 | 39 | import org.junit.runner.RunWith; |
| ... | ... | @@ -6,6 +42,4 @@ import org.powermock.modules.junit4.PowerMockRunner; |
| 6 | 42 | @RunWith(PowerMockRunner.class) |
| 7 | 43 | public class HttpServletRequestProxyTest { |
| 8 | 44 | |
| 9 | - | |
| 10 | - | |
| 11 | 45 | } | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletFilterTest.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.util; |
| 2 | 38 | |
| 3 | 39 | import static org.easymock.EasyMock.expect; |
| 4 | 40 | import static org.powermock.api.easymock.PowerMock.createMock; |
| 5 | 41 | import static org.powermock.api.easymock.PowerMock.mockStatic; |
| 6 | -import static org.powermock.api.easymock.PowerMock.replayAll; | |
| 42 | +import static org.powermock.api.easymock.PowerMock.replay; | |
| 7 | 43 | import static org.powermock.api.easymock.PowerMock.verifyAll; |
| 8 | 44 | |
| 9 | 45 | import java.io.IOException; |
| 10 | 46 | |
| 11 | 47 | import javax.servlet.FilterChain; |
| 48 | +import javax.servlet.FilterConfig; | |
| 12 | 49 | import javax.servlet.ServletException; |
| 13 | 50 | import javax.servlet.http.HttpServletRequest; |
| 14 | 51 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -29,9 +66,21 @@ public class ServletFilterTest { |
| 29 | 66 | private ServletFilter filter; |
| 30 | 67 | |
| 31 | 68 | @Test |
| 69 | + public void testInit() throws ServletException { | |
| 70 | + FilterConfig config = createMock(FilterConfig.class); | |
| 71 | + replay(config); | |
| 72 | + | |
| 73 | + filter = new ServletFilter(); | |
| 74 | + filter.init(config); | |
| 75 | + | |
| 76 | + verifyAll(); | |
| 77 | + } | |
| 78 | + | |
| 79 | + @Test | |
| 32 | 80 | public void testDoFilter() throws IOException, ServletException { |
| 33 | 81 | HttpServletRequest request = createMock(HttpServletRequest.class); |
| 34 | 82 | HttpServletResponse response = createMock(HttpServletResponse.class); |
| 83 | + | |
| 35 | 84 | FilterChain chain = createMock(FilterChain.class); |
| 36 | 85 | HttpServletRequestProducer requestProducer = createMock(HttpServletRequestProducer.class); |
| 37 | 86 | HttpServletResponseProducer responseProducer = createMock(HttpServletResponseProducer.class); |
| ... | ... | @@ -46,13 +95,18 @@ public class ServletFilterTest { |
| 46 | 95 | chain.doFilter(request, response); |
| 47 | 96 | PowerMock.expectLastCall().times(1); |
| 48 | 97 | |
| 49 | - replayAll(); | |
| 98 | + replay(Beans.class, request, response, chain, requestProducer, responseProducer); | |
| 50 | 99 | |
| 51 | 100 | filter = new ServletFilter(); |
| 52 | - | |
| 53 | 101 | filter.doFilter(request, response, chain); |
| 54 | 102 | |
| 55 | 103 | verifyAll(); |
| 56 | 104 | } |
| 57 | 105 | |
| 106 | + @Test | |
| 107 | + public void testDestroy() { | |
| 108 | + filter = new ServletFilter(); | |
| 109 | + filter.destroy(); | |
| 110 | + verifyAll(); | |
| 111 | + } | |
| 58 | 112 | } | ... | ... |
impl/extension/servlet/src/test/java/br/gov/frameworkdemoiselle/util/ServletListenerTest.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.util; |
| 2 | 38 | |
| 3 | 39 | import static org.easymock.EasyMock.createMock; |
| ... | ... | @@ -24,41 +60,41 @@ import br.gov.frameworkdemoiselle.lifecycle.AfterStartupProccess; |
| 24 | 60 | public class ServletListenerTest { |
| 25 | 61 | |
| 26 | 62 | private ServletListener listener; |
| 27 | - | |
| 63 | + | |
| 28 | 64 | @Test |
| 29 | 65 | public void testContextInitialized() { |
| 30 | 66 | ServletContextEvent event = createMock(ServletContextEvent.class); |
| 31 | 67 | BeanManager beanManager = PowerMock.createMock(BeanManager.class); |
| 32 | - | |
| 68 | + | |
| 33 | 69 | mockStatic(Beans.class); |
| 34 | 70 | expect(Beans.getBeanManager()).andReturn(beanManager); |
| 35 | 71 | beanManager.fireEvent(EasyMock.anyObject(AfterStartupProccess.class)); |
| 36 | 72 | PowerMock.expectLastCall().times(1); |
| 37 | - | |
| 73 | + | |
| 38 | 74 | replayAll(); |
| 39 | - | |
| 75 | + | |
| 40 | 76 | listener = new ServletListener(); |
| 41 | 77 | listener.contextInitialized(event); |
| 42 | - | |
| 78 | + | |
| 43 | 79 | verifyAll(); |
| 44 | 80 | } |
| 45 | - | |
| 81 | + | |
| 46 | 82 | @Test |
| 47 | 83 | public void testContextDestroyed() { |
| 48 | 84 | ServletContextEvent event = createMock(ServletContextEvent.class); |
| 49 | 85 | BeanManager beanManager = PowerMock.createMock(BeanManager.class); |
| 50 | - | |
| 86 | + | |
| 51 | 87 | mockStatic(Beans.class); |
| 52 | 88 | expect(Beans.getBeanManager()).andReturn(beanManager); |
| 53 | 89 | beanManager.fireEvent(EasyMock.anyObject(ShutdownBootstrap.class)); |
| 54 | 90 | PowerMock.expectLastCall().times(1); |
| 55 | - | |
| 91 | + | |
| 56 | 92 | replayAll(); |
| 57 | - | |
| 93 | + | |
| 58 | 94 | listener = new ServletListener(); |
| 59 | 95 | listener.contextDestroyed(event); |
| 60 | - | |
| 96 | + | |
| 61 | 97 | verifyAll(); |
| 62 | 98 | } |
| 63 | - | |
| 99 | + | |
| 64 | 100 | } | ... | ... |