diff --git a/install/jakartaee/other/vehicle.properties b/install/jakartaee/other/vehicle.properties index 9057698209..78e41bcd4a 100644 --- a/install/jakartaee/other/vehicle.properties +++ b/install/jakartaee/other/vehicle.properties @@ -169,6 +169,13 @@ com/sun/ts/tests/ejb30/lite/async/stateless/descriptor/Client.java = ejbliteserv com/sun/ts/tests/ejb30/lite/async/stateless/metadata/JsfClient.java = ejblitejsf com/sun/ts/tests/ejb30/lite/async/stateless/metadata/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp +com/sun/ts/tests/ejb30/lite/enventry/singleton/metadata/JsfClient.java = ejblitejsf +com/sun/ts/tests/ejb30/lite/enventry/singleton/metadata/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp +com/sun/ts/tests/ejb30/lite/enventry/stateful/metadata/JsfClient.java = ejblitejsf +com/sun/ts/tests/ejb30/lite/enventry/stateful/metadata/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp +com/sun/ts/tests/ejb30/lite/enventry/stateless/metadata/JsfClient.java = ejblitejsf +com/sun/ts/tests/ejb30/lite/enventry/stateless/metadata/Client.java = ejbliteservlet ejbliteservlet2 ejblitejsp + com/sun/ts/tests/ejb30/lite/tx/cm/singleton/webrw = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp com/sun/ts/tests/ejb30/lite/tx/cm/stateless/webrw = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp com/sun/ts/tests/ejb30/lite/tx/cm/stateful/webrw = ejbliteservlet ejbliteservlet2 ejblitejsf ejblitejsp diff --git a/src/com/sun/ts/tests/ejb30/lite/enventry/common/JsfClientBase.java b/src/com/sun/ts/tests/ejb30/lite/enventry/common/JsfClientBase.java new file mode 100644 index 0000000000..4764470d42 --- /dev/null +++ b/src/com/sun/ts/tests/ejb30/lite/enventry/common/JsfClientBase.java @@ -0,0 +1,196 @@ +/* + * 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.enventry.common; + +import java.util.concurrent.TimeUnit; + +import com.sun.ts.lib.util.TestUtil; +import com.sun.ts.tests.ejb30.common.helper.Helper; +import com.sun.ts.tests.ejb30.common.lite.EJBLiteJsfClientBase; +import com.sun.ts.tests.ejb30.common.lite.NumberEnum; +import jakarta.annotation.PostConstruct; + +import static com.sun.ts.tests.ejb30.common.helper.ServiceLocator.lookupNoTry; + +abstract public class JsfClientBase extends EJBLiteJsfClientBase { + protected EnvEntryBeanBase envEntryBean; // injected in subclass + + private StringBuilder postConstructRecords = new StringBuilder(); + + private String myString; + + private boolean myBoolean; + + private byte myByte; + + private short myShort; + + private int myInt; + + private long myLong; + + private float myFloat; + + private double myDouble; + + private char myChar; + + private TimeUnit timeUnit; + + private NumberEnum numberEnum; + + private Class helperClass; + + private Class numberEnumClass; + + private Class envEntryBeanBaseClass; + + private Class testUtilClass; + + private String xmlString; + + private boolean xmlBoolean; + + private byte xmlByte; + + private short xmlShort; + + private int xmlInt; + + private long xmlLong; + + private float xmlFloat; + + private double xmlDouble; + + private char xmlChar; + + private NumberEnum xmlNumberEnum; + + private Class xmlHelperClass; + + @SuppressWarnings("unused") + @PostConstruct + private void postConstruct() { + if (getContainer() != null) { + return; + } + myString = (String) lookupNoTry(envEntryBean.getLookupName("myString")); + myBoolean = (Boolean) lookupNoTry(envEntryBean.getLookupName("myBoolean")); + myByte = (Byte) lookupNoTry(envEntryBean.getLookupName("myByte")); + myShort = (Short) lookupNoTry(envEntryBean.getLookupName("myShort")); + myInt = (Integer) lookupNoTry(envEntryBean.getLookupName("myInt")); + myLong = (Long) lookupNoTry(envEntryBean.getLookupName("myLong")); + myFloat = (Float) lookupNoTry(envEntryBean.getLookupName("myFloat")); + myDouble = (Double) lookupNoTry(envEntryBean.getLookupName("myDouble")); + myChar = (Character) lookupNoTry(envEntryBean.getLookupName("myChar")); + timeUnit = (TimeUnit) lookupNoTry(envEntryBean.getLookupName("timeUnit")); + numberEnum = (NumberEnum) lookupNoTry( + envEntryBean.getLookupName("numberEnum")); + helperClass = (Class) lookupNoTry( + envEntryBean.getLookupName("helperClass")); + numberEnumClass = (Class) lookupNoTry( + envEntryBean.getLookupName("numberEnumClass")); + envEntryBeanBaseClass = (Class) lookupNoTry( + envEntryBean.getLookupName("envEntryBeanBaseClass")); + testUtilClass = (Class) lookupNoTry( + envEntryBean.getLookupName("testUtilClass")); + + xmlString = (String) lookupNoTry(envEntryBean.getLookupName("xmlString")); + xmlBoolean = (Boolean) lookupNoTry( + envEntryBean.getLookupName("xmlBoolean")); + xmlByte = (Byte) lookupNoTry(envEntryBean.getLookupName("xmlByte")); + xmlShort = (Short) lookupNoTry(envEntryBean.getLookupName("xmlShort")); + xmlInt = (Integer) lookupNoTry(envEntryBean.getLookupName("xmlInt")); + xmlLong = (Long) lookupNoTry(envEntryBean.getLookupName("xmlLong")); + xmlFloat = (Float) lookupNoTry(envEntryBean.getLookupName("xmlFloat")); + xmlDouble = (Double) lookupNoTry(envEntryBean.getLookupName("xmlDouble")); + xmlChar = (Character) lookupNoTry(envEntryBean.getLookupName("xmlChar")); + xmlNumberEnum = (NumberEnum) lookupNoTry( + envEntryBean.getLookupName("xmlNumberEnum")); + xmlHelperClass = (Class) lookupNoTry( + envEntryBean.getLookupName("xmlHelperClass")); + + verifyAnnotatedInjections(); + verifyDescriptorInjections(); + } + + /* + * testName: ejbPostConstructRecords + * + * @test_Strategy: verify all env-entry are injected properly by the time + * post-construct method is invoked. + */ + public void ejbPostConstructRecords() { + appendReason(envEntryBean.getPostConstructRecords()); + } + + /* + * testName: clientPostConstructRecords + * + * @test_Strategy: verify all env-entry injected into ejb can also be looked + * up from web client. In embeddable usage, this test is noop. + */ + public void clientPostConstructRecords() { + appendReason(postConstructRecords); + } + + // copied as is from EnvEntryBeanBase + private void verifyAnnotatedInjections() { + Helper.assertEquals(null, "myString", myString, postConstructRecords); + Helper.assertEquals(null, true, myBoolean, postConstructRecords); + Helper.assertEquals(null, (byte) 1, myByte, postConstructRecords); + Helper.assertEquals(null, (short) 1, myShort, postConstructRecords); + Helper.assertEquals(null, 1, myInt, postConstructRecords); + Helper.assertEquals(null, (long) 1, myLong, postConstructRecords); + Helper.assertEquals(null, (float) 1, myFloat, postConstructRecords); + Helper.assertEquals(null, (double) 1, myDouble, postConstructRecords); + Helper.assertEquals(null, '1', myChar, postConstructRecords); + + Helper.assertEquals(null, TimeUnit.NANOSECONDS, timeUnit, + postConstructRecords); + Helper.assertEquals(null, NumberEnum.ONE, numberEnum, postConstructRecords); + Helper.assertEquals(null, Helper.class, helperClass, postConstructRecords); + Helper.assertEquals(null, NumberEnum.class, numberEnumClass, + postConstructRecords); + Helper.assertEquals(null, EnvEntryBeanBase.class, envEntryBeanBaseClass, + postConstructRecords); + Helper.assertEquals(null, TestUtil.class, testUtilClass, + postConstructRecords); + } + + // copied as is from EnvEntryBeanBase + private void verifyDescriptorInjections() { + Helper.assertEquals(null, "xmlString", xmlString, postConstructRecords); + Helper.assertEquals(null, true, xmlBoolean, postConstructRecords); + Helper.assertEquals(null, (byte) 1, xmlByte, postConstructRecords); + Helper.assertEquals(null, (short) 1, xmlShort, postConstructRecords); + Helper.assertEquals(null, 1, xmlInt, postConstructRecords); + Helper.assertEquals(null, (long) 1, xmlLong, postConstructRecords); + Helper.assertEquals(null, (float) 1, xmlFloat, postConstructRecords); + Helper.assertEquals(null, (double) 1, xmlDouble, postConstructRecords); + Helper.assertEquals(null, '1', xmlChar, postConstructRecords); + + Helper.assertEquals(null, NumberEnum.ONE, xmlNumberEnum, + postConstructRecords); + Helper.assertEquals(null, Helper.class, xmlHelperClass, + postConstructRecords); + } +} diff --git a/src/com/sun/ts/tests/ejb30/lite/enventry/singleton/JsfClient.java b/src/com/sun/ts/tests/ejb30/lite/enventry/singleton/JsfClient.java new file mode 100644 index 0000000000..ab4819c3de --- /dev/null +++ b/src/com/sun/ts/tests/ejb30/lite/enventry/singleton/JsfClient.java @@ -0,0 +1,51 @@ +/* + * 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.enventry.singleton; + +import java.io.Serializable; + +import jakarta.ejb.EJB; + +@jakarta.inject.Named("client") +@jakarta.enterprise.context.RequestScoped +public class JsfClient + extends com.sun.ts.tests.ejb30.lite.enventry.common.JsfClientBase implements Serializable { + + private static final long serialVersionUID = 1L; + + @EJB(beanName = "EnvEntryBean", beanInterface = EnvEntryBean.class) + protected void setEnvEntryBean(EnvEntryBean b) { + this.envEntryBean = b; + } + + /* + * @testName: ejbPostConstructRecords + * + * @test_Strategy: verify all env-entry are injected properly by the time + * post-construct method is invoked. + */ + + /* + * @testName: clientPostConstructRecords + * + * @test_Strategy: verify all env-entry injected into ejb can also be looked + * up from web client. In embeddable usage, this test is noop. + */ +} diff --git a/src/com/sun/ts/tests/ejb30/lite/enventry/stateful/JsfClient.java b/src/com/sun/ts/tests/ejb30/lite/enventry/stateful/JsfClient.java new file mode 100644 index 0000000000..5cffdfc35a --- /dev/null +++ b/src/com/sun/ts/tests/ejb30/lite/enventry/stateful/JsfClient.java @@ -0,0 +1,51 @@ +/* + * 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.enventry.stateful; + +import java.io.Serializable; + +import jakarta.ejb.EJB; + +@jakarta.inject.Named("client") +@jakarta.enterprise.context.RequestScoped +public class JsfClient + extends com.sun.ts.tests.ejb30.lite.enventry.common.JsfClientBase implements Serializable { + + private static final long serialVersionUID = 1L; + + @EJB(beanName = "EnvEntryBean", beanInterface = EnvEntryBean.class) + protected void setEnvEntryBean(EnvEntryBean b) { + this.envEntryBean = b; + } + + /* + * @testName: ejbPostConstructRecords + * + * @test_Strategy: verify all env-entry are injected properly by the time + * post-construct method is invoked. + */ + + /* + * @testName: clientPostConstructRecords + * + * @test_Strategy: verify all env-entry injected into ejb can also be looked + * up from web client. In embeddable usage, this test is noop. + */ +} diff --git a/src/com/sun/ts/tests/ejb30/lite/enventry/stateless/JsfClient.java b/src/com/sun/ts/tests/ejb30/lite/enventry/stateless/JsfClient.java new file mode 100644 index 0000000000..e6ef3a35fe --- /dev/null +++ b/src/com/sun/ts/tests/ejb30/lite/enventry/stateless/JsfClient.java @@ -0,0 +1,51 @@ +/* + * 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.enventry.stateless; + +import java.io.Serializable; + +import jakarta.ejb.EJB; + +@jakarta.inject.Named("client") +@jakarta.enterprise.context.RequestScoped +public class JsfClient + extends com.sun.ts.tests.ejb30.lite.enventry.common.JsfClientBase implements Serializable { + + private static final long serialVersionUID = 1L; + + @EJB(beanName = "EnvEntryBean", beanInterface = EnvEntryBean.class) + protected void setEnvEntryBean(EnvEntryBean b) { + this.envEntryBean = b; + } + + /* + * @testName: ejbPostConstructRecords + * + * @test_Strategy: verify all env-entry are injected properly by the time + * post-construct method is invoked. + */ + + /* + * @testName: clientPostConstructRecords + * + * @test_Strategy: verify all env-entry injected into ejb can also be looked + * up from web client. In embeddable usage, this test is noop. + */ +}