Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1007 from scottmarlow/jsffix_branch_may13
update for 988, add JSF changes for src/com/sun/ts/tests/ejb30/lite/packaging
- Loading branch information
Showing
29 changed files
with
1,424 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/com/sun/ts/tests/ejb30/lite/packaging/war/datasource/singleton/Client.java.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 161 additions & 0 deletions
161
src/com/sun/ts/tests/ejb30/lite/packaging/war/datasource/singleton/JsfClient.java.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/com/sun/ts/tests/ejb30/lite/packaging/war/datasource/stateful/JsfClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.