Skip to content

Commit

Permalink
Merge pull request #5423 from eclipse-ee4j/restore_disappeared_test_c…
Browse files Browse the repository at this point in the history
…lasses

restore disappeared test classes
  • Loading branch information
BalusC committed Mar 24, 2024
2 parents 369793c + 01c1fbc commit 0fa3fa4
Show file tree
Hide file tree
Showing 31 changed files with 1,760 additions and 243 deletions.
Expand Up @@ -20,6 +20,12 @@
import java.util.HashMap;
import java.util.Map;

import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.FactoryFinder;
import jakarta.faces.application.ApplicationFactory;
import jakarta.faces.context.FacesContextFactory;
import jakarta.faces.lifecycle.LifecycleFactory;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

Expand All @@ -34,12 +40,6 @@
import com.sun.faces.mock.MockServletConfig;
import com.sun.faces.mock.MockServletContext;

import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.FactoryFinder;
import jakarta.faces.application.ApplicationFactory;
import jakarta.faces.context.FacesContextFactory;
import jakarta.faces.lifecycle.LifecycleFactory;

public class JUnitFacesTestCaseBase {

protected MockApplication application = null;
Expand Down Expand Up @@ -78,6 +78,8 @@ public void setUp() throws Exception {
new MockFacesContext(new MockExternalContext(servletContext, request, response),
new MockLifecycle());

FactoryFinder.setFactory(FactoryFinder.FACES_SERVLET_FACTORY,
"com.sun.faces.mock.MockFacesServletFactory");
FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
"com.sun.faces.mock.MockFacesContextFactory");
FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
Expand Down
17 changes: 10 additions & 7 deletions impl/src/test/java/com/sun/faces/mock/MockBeanManager.java
Expand Up @@ -17,6 +17,14 @@

package com.sun.faces.mock;

import static java.util.Collections.emptySet;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import jakarta.el.ELResolver;
import jakarta.el.ExpressionFactory;
import jakarta.enterprise.context.spi.Context;
Expand All @@ -42,11 +50,6 @@
import jakarta.enterprise.inject.spi.ObserverMethod;
import jakarta.enterprise.inject.spi.ProducerFactory;
import jakarta.enterprise.inject.spi.el.ELAwareBeanManager;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.List;
import java.util.Set;

public class MockBeanManager implements BeanManager, ELAwareBeanManager {

Expand All @@ -73,12 +76,12 @@ public <T> CreationalContext<T> createCreationalContext(Contextual<T> contextual

@Override
public Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers) {
return null;
return emptySet();
}

@Override
public Set<Bean<?>> getBeans(String name) {
return null;
return emptySet();
}

@Override
Expand Down
47 changes: 47 additions & 0 deletions impl/src/test/java/com/sun/faces/mock/MockFacesServletFactory.java
@@ -0,0 +1,47 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package com.sun.faces.mock;

import jakarta.faces.FactoryFinder;
import jakarta.faces.webapp.FacesServletFactory;
import jakarta.servlet.Servlet;
import jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;

import com.sun.faces.webapp.FacesServletImpl;

public class MockFacesServletFactory extends FacesServletFactory {
public MockFacesServletFactory() {
System.setProperty(FactoryFinder.FACES_SERVLET_FACTORY, this.getClass().getName());
}

@Override
public Servlet getFacesServlet(ServletConfig config) {
Servlet facesServlet = new FacesServletImpl();
try {
facesServlet.init(config);
} catch (ServletException e) {
throw new IllegalStateException(e);
}
return facesServlet;
}

@Override
public FacesServletFactory getWrapped() {
return null;
}
}
224 changes: 0 additions & 224 deletions impl/src/test/java/jakarta/faces/FacesWrapperTestCase.java

This file was deleted.

0 comments on commit 0fa3fa4

Please sign in to comment.