Skip to content

Commit

Permalink
Update ejblitejsf vehicle, #970
Browse files Browse the repository at this point in the history
Signed-off-by: Scott M Stark <starksm64@gmail.com>
  • Loading branch information
starksm64 committed May 13, 2022
1 parent aac9114 commit 5cf339c
Show file tree
Hide file tree
Showing 5 changed files with 398 additions and 1 deletion.
9 changes: 8 additions & 1 deletion install/jakartaee/other/vehicle.properties
Expand Up @@ -175,7 +175,14 @@ com/sun/ts/tests/ejb30/lite/tx/cm/stateful/webrw = ejbliteservlet ejbliteservlet
com/sun/ts/tests/ejb30/lite/packaging/embed = ejbembed
com/sun/ts/tests/ejb30/lite/packaging/war = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/global = ejblitejsf
com/sun/ts/tests/ejb30/lite/basic/mock = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp

com/sun/ts/tests/ejb30/lite/basic/singleton/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/basic/singleton/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/basic/stateful/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/basic/stateful/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/basic/stateless/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/basic/stateless/JsfClient.java = ejblitejsf

com/sun/ts/tests/ejb30/lite/naming/context/Client.java#lookup = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp
com/sun/ts/tests/ejb30/timer = ejbliteservlet

Expand Down
123 changes: 123 additions & 0 deletions src/com/sun/ts/tests/ejb30/lite/basic/common/JsfClientBase.java
@@ -0,0 +1,123 @@
/*
* Copyright (c) 2008, 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
*/

/*
* $Id$
*/
package com.sun.ts.tests.ejb30.lite.basic.common;

import com.sun.ts.tests.ejb30.common.helper.Helper;
import com.sun.ts.tests.ejb30.common.lite.EJBLiteJsfClientBase;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import jakarta.ejb.EJB;

abstract public class JsfClientBase extends EJBLiteJsfClientBase {
protected static final String appName = null;

protected BasicBeanBase basicBean;

// beanName is needed since both OneInterfaceBasicBean and
// TwoInterfacesBasicBean
// implements Basic1IF
@EJB(beanName = "OneInterfaceBasicBean", name = "oneInterfaceBasicBeanBoth")
private Basic1IF oneInterfaceBasicBean;

@EJB(beanName = "OneInterfaceBasicBean", name = "oneInterfaceBasicBeanBoth")
private Basic1IF oneInterfaceBasicBeanAgain;

@EJB(beanName = "TwoInterfacesBasicBean")
private Basic1IF twoInterfacesBasicBean1;

@EJB(name = "twoInterfacesBasicBean2Both", beanName = "TwoInterfacesBasicBean")
private Basic2IF twoInterfacesBasicBean2;

@EJB(name = "twoInterfacesBasicBean2Both", beanName = "TwoInterfacesBasicBean")
private Basic2IF twoInterfacesBasicBean2Again;

public void add() {
int a = -2, b = -3;
int expected = a + b;
assertEquals("Verify BasicBean.add ", expected, basicBean.add(a, b));
assertEquals("Verify OneInterfaceBasicBean.add ", expected,
oneInterfaceBasicBean.add(a, b));
assertEquals("Verify oneInterfaceBasicBeanAgain.add ", expected,
oneInterfaceBasicBeanAgain.add(a, b));
assertEquals("Verify TwoInterfaceBasicBean(1).add ", expected,
twoInterfacesBasicBean1.add(a, b));
assertEquals("Verify TwoInterfaceBasicBean(2).add ", expected,
twoInterfacesBasicBean2.add(a, b));
assertEquals("Verify twoInterfacesBasicBean2Again(2).add ", expected,
twoInterfacesBasicBean2Again.add(a, b));
}

public void globalJNDI() {
BasicBeanHelper.globalJNDI(appName, getModuleName(),
basicBean.getBusinessInterface(), getReasonBuffer(),
(jakarta.ejb.EJBContext) null, getContext());
}

public void globalJNDI2() {
appendReason(basicBean.globalJNDI(appName, getModuleName()));
}

public void appJNDI() {
if (getContainer() != null) {
return;
}
BasicBeanHelper.appJNDI(getModuleName(), basicBean.getBusinessInterface(),
getReasonBuffer());
}

public void appJNDI2() {
appendReason(basicBean.appJNDI(getModuleName()));
}

public void moduleJNDI() {
if (getContainer() != null) {
return;
}
BasicBeanHelper.moduleJNDI(basicBean.getBusinessInterface(),
getReasonBuffer());
}

public void moduleJNDI2() {
appendReason(basicBean.moduleJNDI());
}

@SuppressWarnings("unused")
@PostConstruct
private void postConstruct() {
Helper.getLogger().info("In postConstruct of " + this);
assertNotEquals("check oneInterfaceBasicBean not null", null,
oneInterfaceBasicBean);
assertNotEquals("check oneInterfaceBasicBeanAgain not null", null,
oneInterfaceBasicBeanAgain);
assertNotEquals("check twoInterfacesBasicBean1 not null", null,
twoInterfacesBasicBean1);
assertNotEquals("check twoInterfacesBasicBean2 not null", null,
twoInterfacesBasicBean2);
assertNotEquals("check twoInterfacesBasicBean2Again not null", null,
twoInterfacesBasicBean2Again);
}

@SuppressWarnings("unused")
@PreDestroy
private void preDestroy() {
Helper.getLogger().info("In preDestroy of " + this);
}
}
89 changes: 89 additions & 0 deletions src/com/sun/ts/tests/ejb30/lite/basic/singleton/JsfClient.java
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2022 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
*/

/*
* $Id$
*/
package com.sun.ts.tests.ejb30.lite.basic.singleton;

import java.io.Serializable;

import com.sun.ts.tests.ejb30.lite.basic.common.JsfClientBase;

import jakarta.ejb.EJB;

@jakarta.inject.Named("client")
@jakarta.enterprise.context.RequestScoped
public class JsfClient extends JsfClientBase implements Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("unused")
@EJB(beanInterface = BasicBean.class, beanName = "BasicBean")
private void setBasicBean(BasicBean b) {
basicBean = b;
}

/*
* @testName: add
*
* @test_Strategy: a simple no-interface local singleton bean. The bean field
* (basicBean, of type BasicBeanBase) is declared in superclass (ClientBase),
* and the setter injection is in subclass (Client). Besides, one-interface
* local singleton bean, accessed with Basic1IF; two-interface local singleton
* bean, accessed with Basic1IF; two-interface local singleton bean, accessed
* with Basic2IF.
*/
/*
* @testName: globalJNDI
*
* @test_Strategy: lookup portable global jndi names of various beans from web
* components or standalone client.
*/
/*
* @testName: globalJNDI2
*
* @test_Strategy: lookup portable global jndi names of various beans from ejb
* bean class
*/
/*
* @testName: appJNDI
*
* @test_Strategy: lookup portable app jndi names of various beans from web
* component client (not standalone client).
*/

/*
* @testName: appJNDI2
*
* @test_Strategy: lookup portable app jndi names of various beans from ejb
* bean class
*/

/*
* @testName: moduleJNDI
*
* @test_Strategy: lookup portable module jndi names of various beans from web
* component client (not standalone client).
*/

/*
* @testName: moduleJNDI2
*
* @test_Strategy: lookup portable module jndi names of various beans from ejb
* bean class
*/
}
88 changes: 88 additions & 0 deletions src/com/sun/ts/tests/ejb30/lite/basic/stateful/JsfClient.java
@@ -0,0 +1,88 @@
/*
* Copyright (c) 2008, 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
*/

/*
* $Id$
*/
package com.sun.ts.tests.ejb30.lite.basic.stateful;

import java.io.Serializable;

import com.sun.ts.tests.ejb30.lite.basic.common.JsfClientBase;
import jakarta.ejb.EJB;

@jakarta.inject.Named("client")
@jakarta.enterprise.context.RequestScoped
public class JsfClient extends JsfClientBase implements Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("unused")
@EJB(beanInterface = BasicBean.class, beanName = "BasicBean")
private void setBasicBean(BasicBean b) {
basicBean = b;
}

/*
* @testName: add
*
* @test_Strategy: a simple no-interface local singleton bean. The bean field
* (basicBean, of type BasicBeanBase) is declared in superclass (ClientBase),
* and the setter injection is in subclass (Client). Besides, one-interface
* local singleton bean, accessed with Basic1IF; two-interface local singleton
* bean, accessed with Basic1IF; two-interface local singleton bean, accessed
* with Basic2IF.
*/
/*
* @testName: globalJNDI
*
* @test_Strategy: lookup portable global jndi names of various beans from web
* components or standalone client.
*/
/*
* @testName: globalJNDI2
*
* @test_Strategy: lookup portable global jndi names of various beans from ejb
* bean class
*/
/*
* @testName: appJNDI
*
* @test_Strategy: lookup portable app jndi names of various beans from web
* component client (not standalone client).
*/

/*
* @testName: appJNDI2
*
* @test_Strategy: lookup portable app jndi names of various beans from ejb
* bean class
*/

/*
* @testName: moduleJNDI
*
* @test_Strategy: lookup portable module jndi names of various beans from web
* component client (not standalone client).
*/

/*
* @testName: moduleJNDI2
*
* @test_Strategy: lookup portable module jndi names of various beans from ejb
* bean class
*/
}

0 comments on commit 5cf339c

Please sign in to comment.