diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrapTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrapTest.java deleted file mode 100644 index 0f535fa..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/bootstrap/JsfBootstrapTest.java +++ /dev/null @@ -1,126 +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 br.gov.frameworkdemoiselle.internal.bootstrap; -// -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replay; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Locale; -// -//import javax.enterprise.inject.spi.AfterBeanDiscovery; -//import javax.enterprise.inject.spi.AfterDeploymentValidation; -// -//import junit.framework.Assert; -// -//import org.junit.Before; -//import org.junit.Ignore; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -// -//import br.gov.frameworkdemoiselle.internal.context.AbstractCustomContext; -//import br.gov.frameworkdemoiselle.internal.context.ContextManager; -//import br.gov.frameworkdemoiselle.internal.context.ViewContext; -//import br.gov.frameworkdemoiselle.lifecycle.AfterShutdownProccess; -//import br.gov.frameworkdemoiselle.util.Beans; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Beans.class, ContextManager.class }) -//@Ignore -//public class JsfBootstrapTest { -// -// private JsfBootstrap bootstrap; -// -// private AfterBeanDiscovery event; -// -// @Before -// public void before() { -// event = createMock(AfterBeanDiscovery.class); -// mockStatic(Beans.class); -// expect(Beans.getReference(Locale.class)).andReturn(Locale.getDefault()).anyTimes(); -// replay(Beans.class); -// bootstrap = new JsfBootstrap(); -// } -// -// @Test -// public void testStoreContexts() { -// bootstrap.storeContexts(event); -// replay(event); -// -// Assert.assertEquals(event, Whitebox.getInternalState(bootstrap, "afterBeanDiscoveryEvent")); -// List context = Whitebox.getInternalState(bootstrap, "tempContexts"); -// Assert.assertEquals(1, context.size()); -// verifyAll(); -// } -// -// @Test -// public void testAddContexts() { -// List tempContexts = new ArrayList(); -// AbstractCustomContext tempContext = new ViewContext(); -// tempContexts.add(tempContext); -// Whitebox.setInternalState(bootstrap, "tempContexts", tempContexts); -// Whitebox.setInternalState(bootstrap, "afterBeanDiscoveryEvent", event); -// -// AfterDeploymentValidation afterDeploymentValidation = createMock(AfterDeploymentValidation.class); -// -// event.addContext(tempContext); -// -// replay(event, afterDeploymentValidation); -// -// bootstrap.addContexts(afterDeploymentValidation); -// verifyAll(); -// } -// -// @Test -// public void testRemoveContexts() { -// bootstrap.storeContexts(event); -// -// AfterShutdownProccess afterShutdownProccess = createMock(AfterShutdownProccess.class); -// replay(event, afterShutdownProccess); -// bootstrap.removeContexts(afterShutdownProccess); -// -// verifyAll(); -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ExceptionHandlerConfigTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ExceptionHandlerConfigTest.java deleted file mode 100644 index 321f7d7..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/ExceptionHandlerConfigTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package br.gov.frameworkdemoiselle.internal.configuration; - -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - -public class ExceptionHandlerConfigTest { - - private ExceptionHandlerConfig config; - - @Before - public void setUP() throws Exception { - this.config = new ExceptionHandlerConfig(); - } - - @Test - public void testGetExceptionPage() { - assertEquals("/application_error", config.getDefaultRedirectExceptionPage()); - } - - @Test - public void testIsHandleApplicationException() { - assertEquals(true, config.isApplicationExceptionHandle()); - } - -} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/JsfSecurityConfigTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/JsfSecurityConfigTest.java deleted file mode 100644 index 70225de..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/configuration/JsfSecurityConfigTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package br.gov.frameworkdemoiselle.internal.configuration; - -import static org.junit.Assert.assertEquals; - -import org.junit.Before; -import org.junit.Test; - - -public class JsfSecurityConfigTest { - - private JsfSecurityConfig config; - - @Before - public void setUp() throws Exception { - this.config = new JsfSecurityConfig(); - } - - @Test - public void testGetLoginPage() { - assertEquals("/login", config.getLoginPage()); - } - - @Test - public void testGetRedirectAfterLogin() { - assertEquals("/index", config.getRedirectAfterLogin()); - } - - @Test - public void testGetRedirectAfterLogout() { - assertEquals("/login", config.getRedirectAfterLogout()); - } - - @Test - public void testIsRedirectEnabled() { - assertEquals(true, config.isRedirectEnabled()); - } - -} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java deleted file mode 100644 index 7558aeb..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/context/ViewContextTest.java +++ /dev/null @@ -1,154 +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 br.gov.frameworkdemoiselle.internal.context; -// -//import static junit.framework.Assert.assertEquals; -// -//import java.util.Map; -// -//import javax.enterprise.context.spi.CreationalContext; -//import javax.enterprise.inject.spi.Bean; -// -//import org.easymock.EasyMock; -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.annotation.ViewScoped; -//import br.gov.frameworkdemoiselle.util.Faces; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Faces.class }) -//public class ViewContextTest { -// -// private ViewContext context; -// -// @Before -// public void before() { -// context = new ViewContext(); -// } -// -//// @SuppressWarnings("unchecked") -//// @Test -//// public void testGetViewMapContainsInstance() { -//// String instance = "instance"; -//// -//// Bean bean = PowerMock.createMock(Bean.class); -//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -//// -//// Map map = PowerMock.createMock(Map.class); -//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(true); -//// EasyMock.expect(map.get(EasyMock.anyObject(String.class))).andReturn(instance); -//// -//// PowerMock.mockStatic(Faces.class); -//// EasyMock.expect(Faces.getViewMap()).andReturn(map); -//// -//// PowerMock.replay(Faces.class, bean, map); -//// -//// assertEquals(instance, context.get(bean)); -//// -//// PowerMock.verifyAll(); -//// } -//// -//// @SuppressWarnings("unchecked") -//// @Test -//// public void testGetViewMapDoesNotContainsInstance() { -//// String instance = "instance"; -//// -//// Bean bean = PowerMock.createMock(Bean.class); -//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -//// EasyMock.expect(bean.create(EasyMock.anyObject(CreationalContext.class))).andReturn(instance); -//// -//// Map map = PowerMock.createMock(Map.class); -//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); -//// EasyMock.expect(map.put(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(null); -//// -//// PowerMock.mockStatic(Faces.class); -//// EasyMock.expect(Faces.getViewMap()).andReturn(map); -//// -//// CreationalContext creationalContext = PowerMock.createMock(CreationalContext.class); -//// -//// PowerMock.replay(Faces.class, bean, map, creationalContext); -//// -//// assertEquals(instance, context.get(bean, creationalContext)); -//// -//// PowerMock.verifyAll(); -//// } -//// -//// @SuppressWarnings("unchecked") -//// @Test -//// public void testGetViewMapInstanceNull() { -//// String instance = "instance"; -//// -//// Bean bean = PowerMock.createMock(Bean.class); -//// EasyMock.expect(bean.getName()).andReturn(instance).anyTimes(); -//// -//// Map map = PowerMock.createMock(Map.class); -//// EasyMock.expect(map.containsKey(EasyMock.anyObject(String.class))).andReturn(false); -//// -//// PowerMock.mockStatic(Faces.class); -//// EasyMock.expect(Faces.getViewMap()).andReturn(map); -//// -//// PowerMock.replay(Faces.class, bean, map); -//// -//// assertEquals(null, context.get(bean)); -//// -//// PowerMock.verifyAll(); -//// } -// -// @Test -// public void testScopeClass() { -// assertEquals(ViewScoped.class, context.getScope()); -// } -// -// @Test -// public void testIsActive() { -// assertEquals(true, context.isActive()); -// } -// -// @Test -// public void testSetActive() { -// context.setActive(false); -// assertEquals(false, context.isActive()); -// } -// -//} -// -// diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerFactoryTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerFactoryTest.java deleted file mode 100644 index cc75c93..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerFactoryTest.java +++ /dev/null @@ -1,75 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertEquals; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.ExceptionHandlerFactory; -// -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//@RunWith(PowerMockRunner.class) -//public class ApplicationExceptionHandlerFactoryTest { -// -// @Test -// public void testGetExceptionHandler() { -// -// ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class); -// -// ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class); -// -// ApplicationExceptionHandlerFactory handlerFactory = new ApplicationExceptionHandlerFactory(jsfFactory); -// expect(jsfFactory.getExceptionHandler()).andReturn(jsfExceptionHandler); -// -// replayAll(); -// -// ApplicationExceptionHandler handler = (ApplicationExceptionHandler) handlerFactory.getExceptionHandler(); -// -// assertEquals(handler.getWrapped(), jsfExceptionHandler); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerTest.java deleted file mode 100644 index a959cfe..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ApplicationExceptionHandlerTest.java +++ /dev/null @@ -1,206 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertFalse; -//import static junit.framework.Assert.assertTrue; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.expectLastCall; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.Collection; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.FacesContext; -//import javax.faces.event.ExceptionQueuedEvent; -//import javax.faces.event.ExceptionQueuedEventContext; -//import javax.faces.event.PhaseId; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.exception.ApplicationException; -//import br.gov.frameworkdemoiselle.internal.configuration.ExceptionHandlerConfig; -//import br.gov.frameworkdemoiselle.util.Beans; -//import br.gov.frameworkdemoiselle.util.Faces; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Beans.class, FacesContext.class, Faces.class }) -//public class ApplicationExceptionHandlerTest { -// -// private ApplicationExceptionHandler handler; -// -// private ExceptionQueuedEventContext eventContext; -// -// private ExceptionHandlerConfig config; -// -// private FacesContext facesContext; -// -// private Collection events; -// -// @SuppressWarnings("serial") -// @ApplicationException -// class AnnotatedAppException extends RuntimeException { -// } -// -// @SuppressWarnings("serial") -// class SomeException extends RuntimeException { -// } -// -// @Before -// public void setUp() { -// -// mockStatic(Beans.class); -// mockStatic(FacesContext.class); -// -// events = new ArrayList(); -// ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class); -// handler = new ApplicationExceptionHandler(jsfExceptionHandler); -// eventContext = PowerMock.createMock(ExceptionQueuedEventContext.class); -// ExceptionQueuedEvent event = PowerMock.createMock(ExceptionQueuedEvent.class); -// config = PowerMock.createMock(ExceptionHandlerConfig.class); -// facesContext = PowerMock.createMock(FacesContext.class); -// -// expect(event.getSource()).andReturn(eventContext); -// expect(Beans.getReference(ExceptionHandlerConfig.class)).andReturn(config); -// expect(FacesContext.getCurrentInstance()).andReturn(facesContext).anyTimes(); -// expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2); -// -// events.add(event); -// -// } -// -// @Test -// public void testHandleAnApplicationExceptionNotOnRenderResponse() { -// -// mockStatic(Faces.class); -// -// AnnotatedAppException exception = new AnnotatedAppException(); -// PhaseId phaseId = PowerMock.createMock(PhaseId.class); -// -// expect(eventContext.getException()).andReturn(exception); -// expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// expect(config.isHandleApplicationException()).andReturn(true); -// -// Faces.addMessage(exception); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertTrue(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnApplicationExceptionOnRenderResponse() { -// -// AnnotatedAppException exception = new AnnotatedAppException(); -// // PhaseId phaseId = PhaseId.RENDER_RESPONSE; -// -// expect(eventContext.getException()).andReturn(exception); -// // expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// expect(config.isHandleApplicationException()).andReturn(false); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnyException() { -// -// SomeException exception = new SomeException(); -// // PhaseId phaseId = PowerMock.createMock(PhaseId.class); -// -// expect(eventContext.getException()).andReturn(exception); -// // expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// expect(config.isHandleApplicationException()).andReturn(true); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testDoNotHandleApplicationExceptions() { -// -// AnnotatedAppException exception = new AnnotatedAppException(); -// -// expect(eventContext.getException()).andReturn(exception); -// expect(config.isHandleApplicationException()).andReturn(false); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerFactoryTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerFactoryTest.java deleted file mode 100644 index 2749dea..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerFactoryTest.java +++ /dev/null @@ -1,75 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertEquals; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.ExceptionHandlerFactory; -// -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//@RunWith(PowerMockRunner.class) -//public class AuthenticationExceptionHandlerFactoryTest { -// -// @Test -// public void testGetExceptionHandler() { -// -// ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class); -// -// ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class); -// -// AuthenticationExceptionHandlerFactory handlerFactory = new AuthenticationExceptionHandlerFactory(jsfFactory); -// expect(jsfFactory.getExceptionHandler()).andReturn(jsfExceptionHandler); -// -// replayAll(); -// -// AuthenticationExceptionHandler handler = (AuthenticationExceptionHandler) handlerFactory.getExceptionHandler(); -// -// assertEquals(handler.getWrapped(), jsfExceptionHandler); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerTest.java deleted file mode 100644 index d9c738d..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthenticationExceptionHandlerTest.java +++ /dev/null @@ -1,134 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertFalse; -//import static junit.framework.Assert.assertTrue; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.expectLastCall; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.Collection; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.event.ExceptionQueuedEvent; -//import javax.faces.event.ExceptionQueuedEventContext; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.security.NotLoggedInException; -//import br.gov.frameworkdemoiselle.util.Beans; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Beans.class}) -//public class AuthenticationExceptionHandlerTest { -// -// private AuthenticationExceptionHandler handler; -// -// private ExceptionQueuedEventContext eventContext; -// -// private Collection events; -// -// @Before -// public void setUp() { -// -// mockStatic(Beans.class); -// -// events = new ArrayList(); -// ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class); -// handler = new AuthenticationExceptionHandler(jsfExceptionHandler); -// eventContext = createMock(ExceptionQueuedEventContext.class); -// ExceptionQueuedEvent event = createMock(ExceptionQueuedEvent.class); -// -// expect(event.getSource()).andReturn(eventContext); -// expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2); -// -// events.add(event); -// -// } -// -// @Test -// public void testHandleNotLoggedInException() { -// -// NotLoggedInException exception = new NotLoggedInException(""); -// -// SecurityObserver observer = createMock(SecurityObserver.class); -// expect(Beans.getReference(SecurityObserver.class)).andReturn(observer); -// expect(eventContext.getException()).andReturn(exception); -// -// observer.redirectToLoginPage(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertTrue(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnyException() { -// -// Exception exception = new Exception(); -// -// expect(eventContext.getException()).andReturn(exception); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerFactoryTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerFactoryTest.java deleted file mode 100644 index e1e698a..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerFactoryTest.java +++ /dev/null @@ -1,75 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertEquals; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.ExceptionHandlerFactory; -// -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//@RunWith(PowerMockRunner.class) -//public class AuthorizationExceptionHandlerFactoryTest { -// -// @Test -// public void testGetExceptionHandler() { -// -// ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class); -// -// ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class); -// -// AuthorizationExceptionHandlerFactory handlerFactory = new AuthorizationExceptionHandlerFactory(jsfFactory); -// expect(jsfFactory.getExceptionHandler()).andReturn(jsfExceptionHandler); -// -// replayAll(); -// -// AuthorizationExceptionHandler handler = (AuthorizationExceptionHandler) handlerFactory.getExceptionHandler(); -// -// assertEquals(handler.getWrapped(), jsfExceptionHandler); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerTest.java deleted file mode 100644 index 52d7c66..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/AuthorizationExceptionHandlerTest.java +++ /dev/null @@ -1,171 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertFalse; -//import static junit.framework.Assert.assertTrue; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.expectLastCall; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.Collection; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.FacesContext; -//import javax.faces.event.ExceptionQueuedEvent; -//import javax.faces.event.ExceptionQueuedEventContext; -//import javax.faces.event.PhaseId; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.security.AuthorizationException; -//import br.gov.frameworkdemoiselle.util.Faces; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ FacesContext.class, Faces.class }) -//public class AuthorizationExceptionHandlerTest { -// -// private AuthorizationExceptionHandler handler; -// -// private ExceptionQueuedEventContext eventContext; -// -// private Collection events; -// -// private FacesContext facesContext; -// -// @Before -// public void setUp() { -// -// mockStatic(FacesContext.class); -// -// events = new ArrayList(); -// ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class); -// handler = new AuthorizationExceptionHandler(jsfExceptionHandler); -// eventContext = createMock(ExceptionQueuedEventContext.class); -// ExceptionQueuedEvent event = createMock(ExceptionQueuedEvent.class); -// facesContext = PowerMock.createMock(FacesContext.class); -// -// expect(event.getSource()).andReturn(eventContext); -// events.add(event); -// expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2); -// expect(FacesContext.getCurrentInstance()).andReturn(facesContext).anyTimes(); -// -// -// } -// -// @Test -// public void testHandleAnAuthorizationExceptionNotOnRenderResponse() { -// -// mockStatic(Faces.class); -// -//// ResourceBundle bundle = new ResourceBundle(ResourceBundle.getBundle("demoiselle-core-bundle")); -// -// AuthorizationException exception = new AuthorizationException(""); -// PhaseId phaseId = PowerMock.createMock(PhaseId.class); -// -// expect(eventContext.getException()).andReturn(exception); -// expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// -// Faces.addMessage(exception); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertTrue(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnAuthorizationExceptionOnRenderResponse() { -// -//// ResourceBundle bundle = new ResourceBundle(ResourceBundle.getBundle("demoiselle-core-bundle")); -// -// AuthorizationException exception = new AuthorizationException(""); -// PhaseId phaseId = PhaseId.RENDER_RESPONSE; -// -// expect(eventContext.getException()).andReturn(exception); -// expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnyException() { -// -// Exception exception = new Exception(); -// PhaseId phaseId = PowerMock.createMock(PhaseId.class); -// -// expect(eventContext.getException()).andReturn(exception); -// expect(facesContext.getCurrentPhaseId()).andReturn(phaseId); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/FileRendererImplTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/FileRendererImplTest.java deleted file mode 100644 index b5cea23..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/FileRendererImplTest.java +++ /dev/null @@ -1,328 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import java.io.ByteArrayInputStream; -//import java.io.File; -//import java.io.IOException; -//import java.io.InputStream; -// -//import javax.faces.context.FacesContext; -//import javax.servlet.ServletOutputStream; -//import javax.servlet.http.HttpServletResponse; -// -//import junit.framework.Assert; -// -//import org.easymock.EasyMock; -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -//import org.slf4j.Logger; -// -//import br.gov.frameworkdemoiselle.util.Faces; -//import br.gov.frameworkdemoiselle.util.FileRenderer; -//import br.gov.frameworkdemoiselle.util.FileRenderer.ContentType; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Faces.class }) -//public class FileRendererImplTest { -// -// private Logger logger; -// -// private FileRenderer renderer; -// -// private FacesContext facesContext; -// -// private HttpServletResponse response; -// -// @Before -// public void before() { -// renderer = new FileRendererImpl(); -// -// logger = PowerMock.createMock(Logger.class); -// Whitebox.setInternalState(renderer, "logger", logger); -// -// facesContext = PowerMock.createMock(FacesContext.class); -// Whitebox.setInternalState(renderer, "context", facesContext); -// -// response = PowerMock.createMock(HttpServletResponse.class); -// Whitebox.setInternalState(renderer, "response", response); -// } -// -// @Test -// public void testRenderBytesFail() { -// byte[] bytes = "Test".getBytes(); -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// IOException exception = new IOException(); -// logger.info("Erro na geração do relatório. Incluíndo a exceção de erro em um FacesMessage", exception); -// EasyMock.expectLastCall().anyTimes(); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength(bytes.length); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// try { -// EasyMock.expect(response.getOutputStream()).andThrow(exception); -// } catch (IOException e) { -// Assert.fail(); -// } -// -// PowerMock.mockStatic(Faces.class); -// Faces.addMessage(exception); -// -// PowerMock.replayAll(); -// renderer.render(bytes, ContentType.PDF, fileName); -// PowerMock.verifyAll(); -// } -// -// @Test -// public void testRenderBytesSuccess() throws IOException { -// byte[] bytes = "Test".getBytes(); -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength(bytes.length); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// ServletOutputStream stream = PowerMock.createMock(ServletOutputStream.class); -// stream.write(bytes, 0, bytes.length); -// EasyMock.expectLastCall().times(1); -// -// stream.flush(); -// EasyMock.expectLastCall().times(1); -// -// stream.close(); -// EasyMock.expectLastCall().times(1); -// -// EasyMock.expect(response.getOutputStream()).andReturn(stream).times(3); -// -// PowerMock.replayAll(); -// renderer.render(bytes, ContentType.PDF, fileName); -// PowerMock.verifyAll(); -// } -// -// @Test -// public void testRenderStreamFail() { -// byte[] bytes = "Test".getBytes(); -// InputStream stream = new ByteArrayInputStream(bytes); -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// IOException exception = new IOException(); -// logger.info("Erro na geração do relatório. Incluíndo a exceção de erro em um FacesMessage", exception); -// EasyMock.expectLastCall().anyTimes(); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength(bytes.length); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// try { -// EasyMock.expect(response.getOutputStream()).andThrow(exception); -// } catch (IOException e) { -// Assert.fail(); -// } -// -// PowerMock.mockStatic(Faces.class); -// Faces.addMessage(exception); -// -// PowerMock.replayAll(); -// renderer.render(stream, ContentType.PDF, fileName, false); -// PowerMock.verifyAll(); -// } -// -// @Test -// public void testRenderStreamSuccess() throws IOException { -// byte[] bytes = "Test".getBytes(); -// InputStream inputStream = new ByteArrayInputStream(bytes); -// -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength(bytes.length); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// ServletOutputStream stream = new ServletOutputStream() { -// -// @Override -// public void write(int b) throws IOException { -// Assert.assertTrue(true); -// } -// }; -// -// EasyMock.expect(response.getOutputStream()).andReturn(stream).times(3); -// -// PowerMock.replayAll(); -// renderer.render(inputStream, ContentType.PDF, fileName); -// PowerMock.verifyAll(); -// } -// -// @Test -// public void testRenderFileFail() throws IOException { -// -// File file = new File("fileName"); -// file.createNewFile(); -// -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// IOException exception = new IOException(); -// logger.info("Erro na geração do relatório. Incluíndo a exceção de erro em um FacesMessage", exception); -// EasyMock.expectLastCall().anyTimes(); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength((int) file.length()); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// try { -// EasyMock.expect(response.getOutputStream()).andThrow(exception); -// } catch (IOException e) { -// Assert.fail(); -// } -// -// PowerMock.mockStatic(Faces.class); -// Faces.addMessage(exception); -// -// PowerMock.replayAll(); -// renderer.render(file, ContentType.PDF, fileName); -// PowerMock.verifyAll(); -// -// file.delete(); -// } -// -// @Test -// public void testRenderFileNotFoundException() throws IOException { -// -// File file = new File("fileName"); -// file.createNewFile(); -// -// String fileName = "fileName.pdf"; -// -// logger.debug(EasyMock.anyObject(String.class)); -// EasyMock.expectLastCall().anyTimes(); -// -// IOException exception = new IOException(); -// logger.info("Erro na geração do relatório. Incluíndo a exceção de erro em um FacesMessage", exception); -// EasyMock.expectLastCall().anyTimes(); -// -// response.setContentType(ContentType.PDF.getContentType()); -// EasyMock.expectLastCall().times(1); -// -// response.setContentLength((int) file.length()); -// EasyMock.expectLastCall().times(1); -// -// response.setHeader("Content-Disposition", "filename=\"" + fileName + "\""); -// EasyMock.expectLastCall().times(1); -// -// facesContext.responseComplete(); -// EasyMock.expectLastCall().times(1); -// -// try { -// EasyMock.expect(response.getOutputStream()).andThrow(exception); -// } catch (IOException e) { -// Assert.fail(); -// } -// -// -// -// PowerMock.mockStatic(Faces.class); -// Faces.addMessage(exception); -// -// PowerMock.replayAll(); -// renderer.render(file, ContentType.PDF, fileName); -// PowerMock.verifyAll(); -// -// file.delete(); -// } -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ParameterImplTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ParameterImplTest.java deleted file mode 100644 index 904d32b..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/ParameterImplTest.java +++ /dev/null @@ -1,372 +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 PURPaOSE. 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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static org.easymock.EasyMock.expect; -//import static org.junit.Assert.assertEquals; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.lang.reflect.Member; -//import java.util.HashMap; -//import java.util.Map; -// -//import javax.enterprise.context.RequestScoped; -//import javax.enterprise.context.SessionScoped; -//import javax.enterprise.inject.spi.Annotated; -//import javax.enterprise.inject.spi.InjectionPoint; -//import javax.faces.convert.Converter; -//import javax.servlet.http.HttpServletRequest; -//import javax.servlet.http.HttpSession; -// -//import org.easymock.EasyMock; -//import org.junit.Before; -//import org.junit.Ignore; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -// -//import br.gov.frameworkdemoiselle.annotation.Name; -//import br.gov.frameworkdemoiselle.annotation.ViewScoped; -//import br.gov.frameworkdemoiselle.util.Beans; -//import br.gov.frameworkdemoiselle.util.Faces; -//import br.gov.frameworkdemoiselle.util.Reflections; -// -//@Ignore -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Reflections.class, Faces.class, Beans.class }) -//public class ParameterImplTest { -// -// private ParameterImpl param; -// -// private HttpServletRequest request; -// -// private InjectionPoint ip; -// -// private Converter converter; -// -// private Annotated annotated; -// -// private Name name; -// -// private HttpSession session; -// -// private Member member; -// -// @Before -// public void before() { -// ip = createMock(InjectionPoint.class); -// request = createMock(HttpServletRequest.class); -// session = createMock(HttpSession.class); -// annotated = createMock(Annotated.class); -// name = createMock(Name.class); -// converter = createMock(Converter.class); -// member = createMock(Member.class); -// -// mockStatic(Reflections.class); -// mockStatic(Faces.class); -// } -// -// private void prepareForTestWithKeyFromNameAnnotation() { -// expect(ip.getAnnotated()).andReturn(annotated).anyTimes(); -// expect(ip.getMember()).andReturn(null); -// expect(annotated.isAnnotationPresent(Name.class)).andReturn(true); -// expect(annotated.getAnnotation(Name.class)).andReturn(name); -// expect(name.value()).andReturn("name"); -// expect(Reflections.getGenericTypeArgument(EasyMock.anyObject(Member.class), EasyMock.anyInt())).andReturn( -// Object.class); -// } -// -// @Test -// public void testConstructorCase1() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(true); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("name", param.getKey()); -// assertEquals(Object.class, Whitebox.getInternalState(param, "type")); -// assertEquals(converter, param.getConverter()); -// verifyAll(); -// } -// -// @Test -// public void testConstructorCase2() { -// expect(member.getName()).andReturn("memberName"); -// expect(ip.getAnnotated()).andReturn(annotated).anyTimes(); -// expect(ip.getMember()).andReturn(member).anyTimes(); -// expect(annotated.isAnnotationPresent(Name.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(true); -// expect(Reflections.getGenericTypeArgument(EasyMock.anyObject(Member.class), EasyMock.anyInt())).andReturn( -// Object.class); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("memberName", param.getKey()); -// assertEquals(Object.class, Whitebox.getInternalState(param, "type")); -// assertEquals(converter, param.getConverter()); -// verifyAll(); -// } -// -// @Test -// public void testGetValueWhenSessionScopedAndParameterValueNotNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(Faces.convert("1", converter)).andReturn("return"); -// expect(request.getSession()).andReturn(session).anyTimes(); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn("1"); -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// -// expect(session.getAttribute("name")).andReturn("return"); -// -// session.setAttribute("name", "return"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("return", param.getValue()); -// verifyAll(); -// } -// -// @Test -// public void testGetValueWhenSessionScopedAndParameterValueNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(request.getSession()).andReturn(session).anyTimes(); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn(null); -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(session.getAttribute("name")).andReturn("return"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("return", param.getValue()); -// verifyAll(); -// } -// -// @Test -// public void testGetValueWhenRequestScoped() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn("1"); -// expect(request.getSession()).andReturn(session).anyTimes(); -// expect(Faces.convert("1", converter)).andReturn("return"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("return", param.getValue()); -// verifyAll(); -// } -// -// @Test -// public void testGetValueWhenViewScopedWithParamValueNotNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// Map map = new HashMap(); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(true); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn("1"); -// expect(Faces.getViewMap()).andReturn(map); -// expect(Faces.convert("1", converter)).andReturn("return"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("return", param.getValue()); -// assertEquals("return", map.get("name")); -// verifyAll(); -// } -// -// @Test -// public void testGetValueWhenViewScopedWithParamValueNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// Map map = new HashMap(); -// map.put("name", "ops"); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(true); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn(null); -// expect(Faces.getViewMap()).andReturn(map); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("ops", param.getValue()); -// assertEquals("ops", map.get("name")); -// verifyAll(); -// } -// -// @Test -// public void testGetValueElseWithValueNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// expect(Faces.getConverter(EasyMock.anyObject(Class.class))).andReturn(converter); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn("1"); -// expect(Faces.convert("1", converter)).andReturn("return"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// assertEquals("return", param.getValue()); -// verifyAll(); -// } -// -// @Test -// public void testGetValueElseWithValueNotNull() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(request.getParameter(EasyMock.anyObject(String.class))).andReturn("1"); -// -// replayAll(); -// param = new ParameterImpl(ip); -// Whitebox.setInternalState(param, "value", "myvalue"); -// assertEquals("myvalue", param.getValue()); -// verifyAll(); -// } -// -// @Test -// public void testSetValueIsSessionScoped() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(HttpServletRequest.class)).andReturn(request).anyTimes(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// expect(request.getSession()).andReturn(session); -// -// session.setAttribute("name", 1L); -// -// replayAll(); -// param = new ParameterImpl(ip); -// param.setValue(1L); -// verifyAll(); -// } -// -// @Test -// public void testSetValueIsViewScoped() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// Map map = new HashMap(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(true); -// expect(Faces.getViewMap()).andReturn(map); -// -// replayAll(); -// param = new ParameterImpl(ip); -// param.setValue(1L); -// assertEquals(1L, map.get("name")); -// verifyAll(); -// } -// -// @Test -// public void testSetValueElse() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// -// replayAll(); -// param = new ParameterImpl(ip); -// param.setValue(1L); -// assertEquals(1L, Whitebox.getInternalState(param, "value")); -// verifyAll(); -// } -// -// @Test -// public void testOthers() { -// this.prepareForTestWithKeyFromNameAnnotation(); -// -// expect(annotated.isAnnotationPresent(SessionScoped.class)).andReturn(false); -// expect(annotated.isAnnotationPresent(RequestScoped.class)).andReturn(true); -// expect(annotated.isAnnotationPresent(ViewScoped.class)).andReturn(false); -// -// replayAll(); -// param = new ParameterImpl(ip); -// param.setValue(1L); -// verifyAll(); -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerFactoryTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerFactoryTest.java deleted file mode 100644 index 7bd175d..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerFactoryTest.java +++ /dev/null @@ -1,75 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertEquals; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.context.ExceptionHandlerFactory; -// -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//@RunWith(PowerMockRunner.class) -//public class RedirectExceptionHandlerFactoryTest { -// -// @Test -// public void testGetExceptionHandler() { -// -// ExceptionHandler jsfExceptionHandler = PowerMock.createMock(ExceptionHandler.class); -// -// ExceptionHandlerFactory jsfFactory = PowerMock.createMock(ExceptionHandlerFactory.class); -// -// RedirectExceptionHandlerFactory handlerFactory = new RedirectExceptionHandlerFactory(jsfFactory); -// expect(jsfFactory.getExceptionHandler()).andReturn(jsfExceptionHandler); -// -// replayAll(); -// -// RedirectExceptionHandler handler = (RedirectExceptionHandler) handlerFactory.getExceptionHandler(); -// -// assertEquals(handler.getWrapped(), jsfExceptionHandler); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerTest.java deleted file mode 100644 index 7465c35..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/internal/implementation/RedirectExceptionHandlerTest.java +++ /dev/null @@ -1,127 +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 br.gov.frameworkdemoiselle.internal.implementation; -// -//import static junit.framework.Assert.assertFalse; -//import static junit.framework.Assert.assertTrue; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.expectLastCall; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.Collection; -// -//import javax.faces.context.ExceptionHandler; -//import javax.faces.event.ExceptionQueuedEvent; -//import javax.faces.event.ExceptionQueuedEventContext; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.annotation.Redirect; -// -//@RunWith(PowerMockRunner.class) -//public class RedirectExceptionHandlerTest { -// -// private RedirectExceptionHandler handler; -// -// private ExceptionQueuedEventContext eventContext; -// -// private Collection events; -// -// @SuppressWarnings("serial") -// @Redirect -// class AnnotatedException extends RuntimeException { -// } -// -// @Before -// public void setUp() { -// -// ExceptionHandler jsfExceptionHandler = createMock(ExceptionHandler.class); -// ExceptionQueuedEvent event = createMock(ExceptionQueuedEvent.class); -// eventContext = createMock(ExceptionQueuedEventContext.class); -// handler = new RedirectExceptionHandler(jsfExceptionHandler); -// events = new ArrayList(); -// -// expect(event.getSource()).andReturn(eventContext); -// events.add(event); -// expect(handler.getUnhandledExceptionQueuedEvents()).andReturn(events).times(2); -// -// } -// -// @Test -// public void testHandleAnAnnotatedException() { -// -// AnnotatedException exception = new AnnotatedException(); -// -// expect(eventContext.getException()).andReturn(exception); -// -// replayAll(); -// -// handler.handle(); -// -// assertTrue(events.isEmpty()); -// -// verifyAll(); -// -// } -// -// @Test -// public void testHandleAnyException() { -// -// Exception exception = new Exception(); -// -// expect(eventContext.getException()).andReturn(exception); -// -// handler.getWrapped().handle(); -// expectLastCall(); -// -// replayAll(); -// -// handler.handle(); -// -// assertFalse(events.isEmpty()); -// -// verifyAll(); -// -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBeanTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBeanTest.java deleted file mode 100644 index f8f5c2c..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractEditPageBeanTest.java +++ /dev/null @@ -1,327 +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 br.gov.frameworkdemoiselle.template; -// -//import static org.easymock.EasyMock.expect; -//import static org.junit.Assert.assertEquals; -//import static org.junit.Assert.assertFalse; -//import static org.junit.Assert.assertNull; -//import static org.junit.Assert.assertTrue; -//import static org.powermock.api.easymock.PowerMock.createMock; -//import static org.powermock.api.easymock.PowerMock.mockStatic; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -//import static org.powermock.reflect.Whitebox.setInternalState; -// -//import java.util.Locale; -// -//import javax.faces.component.UIViewRoot; -//import javax.faces.context.FacesContext; -//import javax.faces.convert.Converter; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -// -//import br.gov.frameworkdemoiselle.DemoiselleException; -//import br.gov.frameworkdemoiselle.internal.producer.ResourceBundleProducer; -//import br.gov.frameworkdemoiselle.util.Beans; -//import br.gov.frameworkdemoiselle.util.Faces; -//import br.gov.frameworkdemoiselle.util.Parameter; -//import br.gov.frameworkdemoiselle.util.Reflections; -//import br.gov.frameworkdemoiselle.util.ResourceBundle; -// -//import com.sun.faces.util.Util; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Parameter.class, Beans.class, Reflections.class, Converter.class, FacesContext.class, Util.class, -// Faces.class }) -//public class AbstractEditPageBeanTest { -// -// private AbstractEditPageBean pageBean; -// -// private ResourceBundle bundle; -// -// @Before -// public void before() { -// bundle = new ResourceBundleProducer().create("demoiselle-jsf-bundle", Locale.getDefault()); -// -// pageBean = new AbstractEditPageBean() { -// -// private static final long serialVersionUID = 1L; -// -// @Override -// public String update() { -// return null; -// } -// -// @Override -// public String insert() { -// return null; -// } -// -// @Override -// public String delete() { -// return null; -// } -// -// @Override -// protected void handleLoad() { -// } -// }; -// } -// -// @Test -// public void testClear() { -// Parameter param = PowerMock.createMock(Parameter.class); -// -// assertNull(Whitebox.getInternalState(pageBean, "bean")); -// assertNull(Whitebox.getInternalState(pageBean, "id")); -// -// setInternalState(pageBean, "bean", new Contact()); -// setInternalState(pageBean, "id", param); -// -// pageBean.clear(); -// -// assertNull(Whitebox.getInternalState(pageBean, "bean")); -// assertNull(Whitebox.getInternalState(pageBean, "id")); -// } -// -// @Test -// public void testCreateBean() { -// mockStatic(Beans.class); -// Contact c = new Contact(); -// expect(Beans.getReference(Contact.class)).andReturn(c); -// -// replayAll(); -// assertEquals(c, pageBean.createBean()); -// verifyAll(); -// } -// -// @Test -// public void testGetBean() { -// -// pageBean = new AbstractEditPageBean() { -// -// private static final long serialVersionUID = 1L; -// -// private boolean updateMode = false; -// -// @Override -// public String update() { -// return null; -// } -// -// @Override -// public String insert() { -// return null; -// } -// -// @Override -// public String delete() { -// return null; -// } -// -// @Override -// protected void handleLoad() { -// this.setBean(new Contact(200L)); -// } -// -// public boolean isUpdateMode() { -// return updateMode; -// } -// -// }; -// -// Contact c = new Contact(); -// assertNull(Whitebox.getInternalState(pageBean, "bean")); -// setInternalState(pageBean, "bean", c); -// assertEquals(c, pageBean.getBean()); -// -// mockStatic(Beans.class); -// expect(Beans.getReference(Contact.class)).andReturn(c); -// -// pageBean.clear(); -// -// replayAll(); -// assertEquals(c, pageBean.getBean()); -// verifyAll(); -// -// pageBean.clear(); -// -// setInternalState(pageBean, "updateMode", true); -// assertEquals(Long.valueOf(200), pageBean.getBean().getId()); -// } -// -// @Test -// public void testGetBeanClass() { -// mockStatic(Reflections.class); -// expect(Reflections.getGenericTypeArgument(pageBean.getClass(), 0)).andReturn(Object.class); -// -// assertNull(Whitebox.getInternalState(pageBean, "beanClass")); -// -// replayAll(); -// assertEquals(Object.class, pageBean.getBeanClass()); -// verifyAll(); -// -// setInternalState(pageBean, "beanClass", Contact.class, AbstractEditPageBean.class); -// assertEquals(Contact.class, pageBean.getBeanClass()); -// } -// -// @Test -// public void testGetIdClass() { -// mockStatic(Reflections.class); -// expect(Reflections.getGenericTypeArgument(pageBean.getClass(), 1)).andReturn(Object.class); -// -// assertNull(Whitebox.getInternalState(pageBean, "idClass")); -// -// replayAll(); -// assertEquals(Object.class, pageBean.getIdClass()); -// verifyAll(); -// -// Whitebox.setInternalState(pageBean, "idClass", Long.class, AbstractEditPageBean.class); -// assertEquals(Long.class, pageBean.getIdClass()); -// } -// -// @Test -// @SuppressWarnings("unchecked") -// public void testGetStringId() { -// mockStatic(Util.class); -// -// FacesContext facesContext = createMock(FacesContext.class); -// Parameter parameter = createMock(Parameter.class); -// -// setInternalState(pageBean, "facesContext", facesContext); -// setInternalState(pageBean, "id", parameter); -// setInternalState(pageBean, "idClass", String.class, AbstractEditPageBean.class); -// -// String value = "1"; -// expect(parameter.getValue()).andReturn(value); -// -// replayAll(); -// assertEquals(value, pageBean.getId()); -// verifyAll(); -// } -// -// @Test -// @SuppressWarnings("unchecked") -// public void testGetLongId() { -// mockStatic(Faces.class); -// -// FacesContext facesContext = createMock(FacesContext.class); -// Converter converter = createMock(Converter.class); -// UIViewRoot viewRoot = createMock(UIViewRoot.class); -// Parameter parameter = createMock(Parameter.class); -// -// setInternalState(pageBean, "facesContext", facesContext); -// setInternalState(pageBean, "id", parameter); -// setInternalState(pageBean, "idClass", Long.class, AbstractEditPageBean.class); -// -// String value = "1"; -// -// expect(parameter.getValue()).andReturn(value); -// expect(facesContext.getViewRoot()).andReturn(viewRoot); -// expect(Faces.getConverter(Long.class)).andReturn(converter); -// expect(converter.getAsObject(facesContext, viewRoot, value)).andReturn(Long.valueOf(value)); -// -// replayAll(); -// assertEquals(Long.valueOf(value), pageBean.getId()); -// verifyAll(); -// } -// -// @Test -// public void testGetNotStringIdWithNullConverter() { -// FacesContext facesContext = createMock(FacesContext.class); -// -// setInternalState(pageBean, "facesContext", facesContext); -// setInternalState(pageBean, "idClass", Contact.class, AbstractEditPageBean.class); -// setInternalState(pageBean, "bundle", bundle); -// -// replayAll(); -// try { -// pageBean.getId(); -// } catch (DemoiselleException cause) { -// assertEquals(bundle.getString("id-converter-not-found", Contact.class.getCanonicalName()), -// cause.getMessage()); -// } -// -// verifyAll(); -// } -// -// @SuppressWarnings("serial") -// @Test -// public void testUpdateMode() { -// -// pageBean = new AbstractEditPageBean() { -// -// private Long id = null; -// -// @Override -// public String update() { -// return null; -// } -// -// @Override -// public String insert() { -// return null; -// } -// -// @Override -// public String delete() { -// return null; -// } -// -// @Override -// protected void handleLoad() { -// this.setBean(new Contact(200L)); -// } -// -// public Long getId() { -// return id; -// } -// -// }; -// -// assertFalse(pageBean.isUpdateMode()); -// setInternalState(pageBean, "id", 1L); -// assertTrue(pageBean.isUpdateMode()); -// } -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractListPageBeanTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractListPageBeanTest.java deleted file mode 100644 index eda40e6..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractListPageBeanTest.java +++ /dev/null @@ -1,198 +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 br.gov.frameworkdemoiselle.template; -// -//import static org.easymock.EasyMock.expect; -//import static org.junit.Assert.assertEquals; -//import static org.junit.Assert.assertNull; -//import static org.junit.Assert.assertTrue; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -// -//import javax.faces.model.ListDataModel; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -// -//import br.gov.frameworkdemoiselle.internal.implementation.PaginationImpl; -//import br.gov.frameworkdemoiselle.pagination.Pagination; -//import br.gov.frameworkdemoiselle.pagination.PaginationContext; -//import br.gov.frameworkdemoiselle.util.Reflections; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Reflections.class, PaginationContext.class, Pagination.class }) -//public class AbstractListPageBeanTest { -// -// private MySimplePageBean pageBean; -// -// @Before -// public void before() { -// pageBean = new MySimplePageBean(); -// } -// -// @SuppressWarnings("rawtypes") -// @Test -// public void testClear() { -// assertNull(Whitebox.getInternalState(pageBean, "dataModel")); -// assertNull(Whitebox.getInternalState(pageBean, "resultList")); -// -// Whitebox.setInternalState(pageBean, "resultList", new ArrayList()); -// Whitebox.setInternalState(pageBean, "dataModel", new ListDataModel()); -// -// pageBean.clear(); -// -// assertNull(Whitebox.getInternalState(pageBean, "dataModel")); -// assertNull(Whitebox.getInternalState(pageBean, "resultList")); -// } -// -// @Test -// public void testGetBeanClass() { -// assertNull(Whitebox.getInternalState(pageBean, "beanClass")); -// -// PowerMock.mockStatic(Reflections.class); -// expect(Reflections.getGenericTypeArgument(pageBean.getClass(), 0)).andReturn(Object.class); -// -// PowerMock.replayAll(); -// assertEquals(Object.class, pageBean.getBeanClass()); -// PowerMock.verifyAll(); -// -// Whitebox.setInternalState(pageBean, "beanClass", Contact.class, AbstractListPageBean.class); -// -// assertEquals(Contact.class, pageBean.getBeanClass()); -// } -// -// @Test -// public void testGetDataModel() { -// assertNull(Whitebox.getInternalState(pageBean, "dataModel")); -// assertEquals(ListDataModel.class, pageBean.getDataModel().getClass()); -// -// ListDataModel ldm = new ListDataModel(); -// Whitebox.setInternalState(pageBean, "dataModel", ldm); -// -// assertEquals(ldm, pageBean.getDataModel()); -// } -// -// @Test -// public void testGetResultList() { -// assertNull(Whitebox.getInternalState(pageBean, "resultList")); -// -// List list = pageBean.getResultList(); -// assertTrue(list.size() == 2); -// -// list = new ArrayList(); -// Whitebox.setInternalState(pageBean, "resultList", list); -// assertTrue(list.size() == 0); -// assertEquals(list, pageBean.getResultList()); -// } -// -// @Test -// public void testList() { -// this.testClear(); -// assertEquals(pageBean.getCurrentView(), pageBean.list()); -// } -// -// @Test -// public void testSelection() { -// Map map = new HashMap(); -// map.put(1L, true); -// Whitebox.setInternalState(pageBean, "selection", map); -// assertEquals(map, pageBean.getSelection()); -// assertEquals(true, pageBean.getSelection().get(1L)); -// -// pageBean.setSelection(null); -// assertNull(Whitebox.getInternalState(pageBean, "selection")); -// pageBean.setSelection(map); -// assertEquals(map, pageBean.getSelection()); -// assertEquals(true, pageBean.getSelection().get(1L)); -// } -// -// @Test -// public void testPagination() { -// Pagination pagination = new PaginationImpl(); -// PaginationContext pc = PowerMock.createMock(PaginationContext.class); -// expect(pc.getPagination(Contact.class, true)).andReturn(pagination); -// -// replayAll(); -// Whitebox.setInternalState(pageBean, "paginationContext", pc); -// assertEquals(pageBean.getPagination(), pagination); -// verifyAll(); -// } -// -// @Test -// public void testClearSelection() { -// pageBean.clearSelection(); -// assertEquals(true, pageBean.getSelectedList().isEmpty()); -// } -// -// @Test -// public void testGetSelectedList() { -// Map map = new HashMap(); -// map.put(1L, true); -// map.put(2L, true); -// pageBean.setSelection(map); -// assertEquals(2, pageBean.getSelectedList().size()); -// } -// -//} -// -//@SuppressWarnings("serial") -//class MySimplePageBean extends AbstractListPageBean { -// -// @Override -// protected List handleResultList() { -// List list = new ArrayList(); -// list.add(new Contact()); -// list.add(new Contact()); -// return list; -// } -// -// @Override -// public String getCurrentView() { -// return "currentView"; -// } -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractPageTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractPageTest.java deleted file mode 100644 index 0fb0bdb..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/AbstractPageTest.java +++ /dev/null @@ -1,160 +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 br.gov.frameworkdemoiselle.template; -// -//import static org.easymock.EasyMock.expect; -//import static org.junit.Assert.assertEquals; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import javax.faces.component.UIViewRoot; -//import javax.faces.context.FacesContext; -// -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -//import org.powermock.reflect.Whitebox; -// -//import br.gov.frameworkdemoiselle.annotation.NextView; -//import br.gov.frameworkdemoiselle.annotation.PreviousView; -//import br.gov.frameworkdemoiselle.message.MessageContext; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ MessageContext.class }) -//public class AbstractPageTest { -// -// private AbstractPageBean abstractPage; -// -// private FacesContext facesContext; -// -// private UIViewRoot viewRoot; -// -// @Before -// public void before() { -// facesContext = PowerMock.createMock(FacesContext.class); -// viewRoot = PowerMock.createMock(UIViewRoot.class); -// expect(facesContext.getViewRoot()).andReturn(viewRoot).anyTimes(); -// expect(viewRoot.getViewId()).andReturn("viewId").anyTimes(); -// } -// -// @Test -// public void testGetCurrentView() { -// abstractPage = new MyAbstractPage(); -// Whitebox.setInternalState(abstractPage, "facesContext", facesContext); -// -// replayAll(); -// assertEquals(abstractPage.getCurrentView(), "viewId"); -// verifyAll(); -// } -// -// @Test -// public void testGetNextViewOK() { -// abstractPage = new MyAbstractPage(); -// -// replayAll(); -// assertEquals(abstractPage.getNextView(), "next_view"); -// verifyAll(); -// } -// -// @Test -// public void testGetNextViewWhenNoAnnotation() { -// abstractPage = new MyAbstractPageNoAnnotations(); -// -// replayAll(); -// assertEquals(abstractPage.getNextView(), null); -// verifyAll(); -// } -// -// @Test -// public void testGetNextViewAlreadySet() { -// abstractPage = new MyAbstractPageNoAnnotations(); -// Whitebox.setInternalState(abstractPage, "nextView", "next"); -// -// replayAll(); -// assertEquals(abstractPage.getNextView(), "next"); -// verifyAll(); -// } -// -// @Test -// public void testGetPreviousViewOK() { -// abstractPage = new MyAbstractPage(); -// -// replayAll(); -// assertEquals(abstractPage.getPreviousView(), "prevs"); -// verifyAll(); -// } -// -// @Test -// public void testGetPreviousViewAlreadySet() { -// abstractPage = new MyAbstractPageNoAnnotations(); -// Whitebox.setInternalState(abstractPage, "previousView", "previous"); -// -// replayAll(); -// assertEquals(abstractPage.getPreviousView(), "previous"); -// verifyAll(); -// } -// -// @Test -// public void testGetPreviousViewWhenNoAnnotation() { -// abstractPage = new MyAbstractPageNoAnnotations(); -// -// replayAll(); -// assertEquals(abstractPage.getPreviousView(), null); -// verifyAll(); -// } -// -// @Test -// public void testOtherTests() { -// abstractPage = new MyAbstractPageNoAnnotations(); -// assertEquals(null, abstractPage.getTitle()); -// } -//} -// -//@SuppressWarnings("serial") -//@NextView("next_view") -//@PreviousView("prevs") -//class MyAbstractPage extends AbstractPageBean { -// -//} -// -//@SuppressWarnings("serial") -//class MyAbstractPageNoAnnotations extends AbstractPageBean { -// -//} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/Contact.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/Contact.java deleted file mode 100644 index 9150fa0..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/template/Contact.java +++ /dev/null @@ -1,62 +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 br.gov.frameworkdemoiselle.template; - -import java.io.Serializable; - -public class Contact implements Serializable { - - private static final long serialVersionUID = 1L; - - private Long id; - - public Contact() { - } - - public Contact(Long id) { - this.id = id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getId() { - return id; - } - -} diff --git a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/util/FacesTest.java b/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/util/FacesTest.java deleted file mode 100644 index 830c74d..0000000 --- a/impl/extension/jsf/src/test/java/br/gov/frameworkdemoiselle/util/FacesTest.java +++ /dev/null @@ -1,219 +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 br.gov.frameworkdemoiselle.util; -// -//import static junit.framework.Assert.assertEquals; -//import static org.easymock.EasyMock.expect; -//import static org.powermock.api.easymock.PowerMock.replayAll; -//import static org.powermock.api.easymock.PowerMock.verifyAll; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.List; -//import java.util.Map; -// -//import javax.faces.application.Application; -//import javax.faces.application.FacesMessage; -//import javax.faces.component.UIViewRoot; -//import javax.faces.context.FacesContext; -//import javax.faces.convert.Converter; -// -//import org.easymock.EasyMock; -//import org.junit.Before; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.powermock.api.easymock.PowerMock; -//import org.powermock.core.classloader.annotations.PrepareForTest; -//import org.powermock.modules.junit4.PowerMockRunner; -// -//import br.gov.frameworkdemoiselle.exception.ApplicationException; -//import br.gov.frameworkdemoiselle.message.DefaultMessage; -//import br.gov.frameworkdemoiselle.message.Message; -//import br.gov.frameworkdemoiselle.message.SeverityType; -// -//import com.sun.faces.util.Util; -// -//@RunWith(PowerMockRunner.class) -//@PrepareForTest({ Beans.class, Strings.class, Converter.class, Util.class, ResourceBundle.class }) -//public class FacesTest { -// -// private FacesContext facesContext; -// -// private Faces faces; -// -// @Before -// public void before() { -// faces = new Faces(); -// -// PowerMock.mockStatic(Beans.class); -// facesContext = PowerMock.createMock(FacesContext.class); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testAddMessage() { -// expect(Beans.getReference(ResourceBundle.class)).andReturn(null).anyTimes(); -// expect(Beans.getReference(FacesContext.class)).andReturn(facesContext).anyTimes(); -// -// facesContext.addMessage(EasyMock.anyObject(String.class), EasyMock.anyObject(FacesMessage.class)); -// EasyMock.expectLastCall().times(5); -// -// replayAll(); -// -// DefaultMessage message = new DefaultMessage("text") { -// -// @Override -// public String toString() { -// return "Message"; -// } -// -// }; -// -// List messages = new ArrayList(); -// messages.add(message); -// -// faces.addMessages(null); -// faces.addMessages(messages); -// faces.addMessage(message); -// faces.addMessage("clientId", message); -// faces.addMessage("clientId", new MyException()); -// faces.addMessage(new MyException()); -// verifyAll(); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testParseSeverity() { -// assertEquals(faces.parse(SeverityType.ERROR), FacesMessage.SEVERITY_ERROR); -// assertEquals(faces.parse(SeverityType.FATAL), FacesMessage.SEVERITY_FATAL); -// assertEquals(faces.parse(SeverityType.INFO), FacesMessage.SEVERITY_INFO); -// assertEquals(faces.parse(SeverityType.WARN), FacesMessage.SEVERITY_WARN); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testParseThrowable() { -// FacesMessage facesMessage = faces.parse(new MyException()); -// assertEquals(facesMessage.getSeverity(), FacesMessage.SEVERITY_INFO); -// assertEquals(facesMessage.getSummary(), "MESSAGE"); -// -// facesMessage = faces.parse(new Exception()); -// assertEquals(facesMessage.getSeverity(), FacesMessage.SEVERITY_ERROR); -// assertEquals(facesMessage.getSummary(), "java.lang.Exception"); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testConvertNull() { -// PowerMock.mockStatic(Strings.class); -// -// Converter converter = PowerMock.createMock(Converter.class); -// expect(Strings.isEmpty(EasyMock.anyObject(String.class))).andReturn(true); -// -// replayAll(); -// String object = (String) faces.convert("value", converter); -// assertEquals(null, object); -// verifyAll(); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testConvert() { -// PowerMock.mockStatic(Strings.class); -// -// expect(Beans.getReference(FacesContext.class)).andReturn(facesContext).times(2); -// -// Converter converter = PowerMock.createMock(Converter.class); -// expect(Strings.isEmpty(EasyMock.anyObject(String.class))).andReturn(false).times(2); -// expect( -// converter.getAsObject(EasyMock.anyObject(FacesContext.class), EasyMock.anyObject(UIViewRoot.class), -// EasyMock.anyObject(String.class))).andReturn("THAT"); -// expect(facesContext.getViewRoot()).andReturn(null); -// -// replayAll(); -// String object = (String) faces.convert("value", converter); -// assertEquals("THAT", object); -// -// object = (String) faces.convert("value", null); -// assertEquals("value", object); -// -// verifyAll(); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testGetConverter() { -// Application application = PowerMock.createMock(Application.class); -// Converter converter = PowerMock.createMock(Converter.class); -// PowerMock.mockStatic(Util.class); -// -// expect(Beans.getReference(FacesContext.class)).andReturn(facesContext); -// expect(facesContext.getApplication()).andReturn(application); -// expect(application.createConverter(getClass())).andReturn(converter); -// -// replayAll(); -// assertEquals(converter, faces.getConverter(getClass())); -// verifyAll(); -// } -// -// @SuppressWarnings("static-access") -// @Test -// public void testGetViewMap() { -// UIViewRoot uiViewRoot = PowerMock.createMock(UIViewRoot.class); -// expect(Beans.getReference(FacesContext.class)).andReturn(facesContext); -// expect(facesContext.getViewRoot()).andReturn(uiViewRoot); -// -// Map map = new HashMap(); -// expect(uiViewRoot.getViewMap(true)).andReturn(map); -// -// replayAll(); -// assertEquals(map, faces.getViewMap()); -// verifyAll(); -// } -// -// @SuppressWarnings("serial") -// @ApplicationException(severity = SeverityType.INFO) -// class MyException extends Exception { -// -// @Override -// public String getMessage() { -// return "MESSAGE"; -// } -// -// } -// -//} -- libgit2 0.21.2