Skip to content

Commit

Permalink
Merge pull request #1007 from scottmarlow/jsffix_branch_may13
Browse files Browse the repository at this point in the history
update for 988, add JSF changes for src/com/sun/ts/tests/ejb30/lite/packaging
  • Loading branch information
scottmarlow committed May 18, 2022
2 parents b1bbd0e + 8f992b1 commit 381d65d
Show file tree
Hide file tree
Showing 29 changed files with 1,424 additions and 15 deletions.
26 changes: 24 additions & 2 deletions install/jakartaee/other/vehicle.properties
Expand Up @@ -274,14 +274,36 @@ com/sun/ts/tests/ejb30/lite/xmloverride/ejbref/JsfClient.java = ejblitejsf
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/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/packaging/war/datasource/singleton/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/singleton/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/stateful/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/stateful/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/enventry/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/enventry/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/business/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/business/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/invocationcontext/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/invocationcontext/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecycle/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecycle/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecyclecdi/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecyclecdi/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecycleejbcdi/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/mbean/interceptor/lifecycleejbcdi/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/servletcontextlistener/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/servletcontextlistener/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/webinflib/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/webinflib/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/webinflibonly/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/webinflibonly/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/packaging/war/xmloverride/ejbref/JsfClient.java = ejblitejsf
com/sun/ts/tests/ejb30/lite/packaging/war/xmloverride/ejbref/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp
com/sun/ts/tests/ejb30/lite/naming/context/Client.java#lookup = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp
com/sun/ts/tests/ejb30/timer = ejbliteservlet

Expand Down
Expand Up @@ -164,6 +164,9 @@ public void setReason(String reason) {
}

public String getModuleName() {
if (moduleName.startsWith("/")) {
return moduleName.substring(1);
}
return moduleName;
}

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand All @@ -18,6 +18,7 @@ package com.sun.ts.tests.ejb30.lite.packaging.war.datasource.global;

import static com.sun.ts.tests.ejb30.lite.packaging.war.datasource.common.DataSourceTest.verifyDataSource;

import java.io.Serializable;
import java.sql.Connection;

import jakarta.annotation.PostConstruct;
Expand All @@ -28,11 +29,15 @@ import jakarta.ejb.EJB;
import javax.sql.DataSource;

import com.sun.ts.tests.ejb30.common.helper.Helper;
import com.sun.ts.tests.ejb30.common.lite.EJBLiteClientBase;
import com.sun.ts.tests.ejb30.common.lite.EJBLiteJsfClientBase;
import com.sun.ts.tests.ejb30.lite.packaging.war.datasource.common.DataSourceIF;

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

private static final long serialVersionUID = 1L;

public class Client extends EJBLiteClientBase {
@EJB
private DataSourceIF dataSourceBean;

Expand Down
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 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
Expand Down Expand Up @@ -38,6 +38,7 @@
<ts.vehicles name="${app.name}" buildleveloverride="2"
classes="
com/sun/ts/tests/ejb30/common/helper/ServiceLocator.class,
com/sun/ts/tests/ejb30/common/lite/EJBLiteJsfClientBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceIF.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/ComponentBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceTest.class,
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 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
Expand Down
@@ -0,0 +1,161 @@
/*
* 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: Client.java 58883 2009-07-30 03:09:37Z cf126330 $
*/
package com.sun.ts.tests.ejb30.lite.packaging.war.datasource.singleton;

import static com.sun.ts.tests.ejb30.lite.packaging.war.datasource.common.DataSourceTest.verifyDataSource;

import java.io.Serializable;
import java.sql.Connection;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import jakarta.annotation.sql.DataSourceDefinition;
import jakarta.annotation.sql.DataSourceDefinitions;
import jakarta.ejb.EJB;
import javax.sql.DataSource;

import com.sun.ts.tests.ejb30.common.helper.Helper;
import com.sun.ts.tests.ejb30.common.lite.EJBLiteJsfClientBase;
import com.sun.ts.tests.ejb30.lite.packaging.war.datasource.common.DataSourceIF;


// url is to be ignored
@DataSourceDefinitions({
@DataSourceDefinition(name="java:comp/env/compds",
className="@className@",
portNumber=@portNumber@,
serverName="@serverName@",
databaseName="@databaseName@",
user="@user@",
password="@password@",

description="ds1",
initialPoolSize=1,
isolationLevel=Connection.TRANSACTION_READ_COMMITTED,
loginTimeout=300,
maxIdleTime=1000,
maxPoolSize=2,
minPoolSize=1,
transactional=false,
properties={@jdbc.datasource.props@},
url="jdbc:derby://${derby.server}:${derby.port}/${derby.dbName};create=true"
),
@DataSourceDefinition(name="java:comp/env/compds2",
className="@className@",
portNumber=@portNumber@,
serverName="@serverName@",
databaseName="@databaseName@",
user="@user@",
properties={@jdbc.datasource.props@},
password="@password@")
})

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

private static final long serialVersionUID = 1L;

@EJB
private DataSourceIF dataSourceBean;

@Resource
private DataSourceMBean dataSourceMBean;

@Resource
private DataSourceRepeatableBean dataSourceRBean;

@Resource(lookup="java:comp/env/compds")
private DataSource compds;

@Resource(lookup="java:comp/env/compds2")
private DataSource compds2;

@Resource(lookup="java:comp/env/defaultds")
private DataSource defaultds;

@Resource(lookup="java:comp/env/defaultds2")
private DataSource defaultds2;

@Resource(lookup="java:module/env/moduleds")
private DataSource moduleds;

@Resource(lookup="java:module/env/moduleds2")
private DataSource moduleds2;

@SuppressWarnings("unused")
@PostConstruct
private void postConstruct() {
boolean c = true;
Helper.getLogger().info("In postConstruct of " + this);

verifyDataSource(getReasonBuffer(), c, "java:comp/env/defaultds", "java:comp/env/defaultds2",
"java:comp/env/compds", "java:comp/env/compds2",
"java:module/env/moduleds", "java:module/env/moduleds2");
verifyDataSource(getReasonBuffer(), c, defaultds, defaultds2, compds, compds2, moduleds, moduleds2);

verifyDataSource(getReasonBuffer(), c, compds, compds2);
}

/*
* @testName: postConstructRecords
* @test_Strategy: look up the data sources declared with annotation in this class,
* and verify the injected datasource inside PostConstruct method.
*/
public void postConstructRecords() {
appendReason("Test result verified inside postConstruct method.");
}

/*
* @testName: postConstructRecordsEJB
* @test_Strategy: look up the data sources declared with annotation in EJB,
* and verify the injected datasource inside its PostConstruct method.
*/
public void postConstructRecordsEJB() {
appendReason(dataSourceBean.getPostConstructRecords());
}

/*
* @testName: postConstructRecordsMBean
* @test_Strategy: look up the data sources declared with annotation in managed bean,
* and verify the injected datasource inside its PostConstruct method.
*/
public void postConstructRecordsMBean() {
appendReason(dataSourceMBean.getPostConstructRecords());
}

/*
* @testName: postConstructRecordsMBeanRepeatable
* @test_Strategy: look up the data sources declared with repeatable annotation in managed bean,
* and verify the injected datasource inside its PostConstruct method.
*/
public void postConstructRecordsMBeanRepeatable() {
appendReason(dataSourceRBean.getPostConstructRecords());
}

/*
* @testName: getConnectionEJB
* @test_Strategy: call getConnection() on the datasource
*/
public void getConnectionEJB() {
appendReason(dataSourceBean.getConnection());
}
}

@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 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
Expand Down Expand Up @@ -38,6 +38,7 @@
<ts.vehicles name="${app.name}" buildleveloverride="2"
classes="
com/sun/ts/tests/ejb30/common/helper/ServiceLocator.class,
com/sun/ts/tests/ejb30/common/lite/EJBLiteJsfClientBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceIF.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/ComponentBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceTest.class,
Expand Down
@@ -0,0 +1,59 @@
/*
* 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.packaging.war.datasource.stateful;

import java.io.Serializable;

import com.sun.ts.tests.ejb30.common.lite.EJBLiteJsfClientBase;
import com.sun.ts.tests.ejb30.lite.packaging.war.datasource.common.DataSourceIF;

import jakarta.ejb.EJB;

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

private static final long serialVersionUID = 1L;

@EJB
private DataSourceIF dataSourceBean;

/*
* @testName: postConstructRecordsEJB
*
* @test_Strategy: look up the data sources declared with annotation in EJB,
* and verify the injected datasource inside its PostConstruct method.
*/
public void postConstructRecordsEJB() {
appendReason(dataSourceBean.getPostConstructRecords());
}

/*
* @testName: postConstructRecordsInterceptor
*
* @test_Strategy: look up the data sources declared with annotation in
* Interceptor1, and verify the injected datasource inside its PostConstruct
* method.
*/
public void postConstructRecordsInterceptor() {
appendReason(dataSourceBean.getPostConstructRecords());
}

}
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 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
Expand Down Expand Up @@ -38,6 +38,7 @@
<ts.vehicles name="${app.name}" buildleveloverride="2"
classes="
com/sun/ts/tests/ejb30/common/helper/ServiceLocator.class,
com/sun/ts/tests/ejb30/common/lite/EJBLiteJsfClientBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceIF.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/ComponentBase.class,
com/sun/ts/tests/ejb30/lite/packaging/war/datasource/common/DataSourceTest.class,
Expand Down

0 comments on commit 381d65d

Please sign in to comment.