Skip to content

Commit

Permalink
Update EJB Vehicles to EJB 3.x
Browse files Browse the repository at this point in the history
Updates all affected tests

Note: Some tests will need additional updates to be fully compatible
with EJB 3.x. This only takes care of the EJBVehicle itself.
  • Loading branch information
brideck committed Mar 26, 2024
1 parent 6dccf77 commit 005ee51
Show file tree
Hide file tree
Showing 232 changed files with 466 additions and 823 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 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 @@ -27,19 +27,14 @@
import com.sun.ts.lib.harness.RemoteStatus;
import com.sun.ts.lib.util.TestUtil;

import jakarta.ejb.CreateException;
import jakarta.ejb.EJBException;
import jakarta.ejb.SessionBean;
import jakarta.ejb.SessionContext;

public class EJBVehicle implements SessionBean {
public class EJBVehicle {
private EETest testObj;

private Properties properties;

private String[] arguments;

public void ejbCreate(String[] args, Properties p) throws CreateException {
public void initialize(String[] args, Properties p) {
// Initialize TestUtil Reporting
try {
TestUtil.init(p);
Expand All @@ -59,7 +54,7 @@ public void ejbCreate(String[] args, Properties p) throws CreateException {
TestUtil.logErr("Failed to create the EETest instance in the vehicle", e);
throw new EJBException();
}
TestUtil.logTrace("ejbcreate");
TestUtil.logTrace("initialize");
}

// the run method that we call here will either throw
Expand All @@ -85,16 +80,4 @@ public RemoteStatus runTest() {
}
return sTestStatus;
}

public void setSessionContext(SessionContext sc) {
}

public void ejbRemove() {
}

public void ejbActivate() {
}

public void ejbPassivate() {
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 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 @@ -20,12 +20,12 @@

package com.sun.ts.tests.common.vehicle.ejb;

import java.rmi.RemoteException;
import java.util.Properties;

import com.sun.ts.lib.harness.RemoteStatus;

import jakarta.ejb.EJBObject;
public interface EJBVehicleRemote {
public RemoteStatus runTest();

public interface EJBVehicleRemote extends EJBObject {
public RemoteStatus runTest() throws RemoteException;
public void initialize(String[] args, Properties p);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 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 @@ -55,29 +55,19 @@ public Status run(String[] argv, Properties p) {

String sVehicle = p.getProperty("vehicle");

EJBVehicleHome home = null;
String sEJBVehicleJndiName = "";
EJBVehicleRemote ref = null;
try {
TSNamingContext jc = new TSNamingContext();
sEJBVehicleJndiName = "java:comp/env/ejb/EJBVehicle";
home = (EJBVehicleHome) jc.lookup(sEJBVehicleJndiName,
EJBVehicleHome.class);
ref = (EJBVehicleRemote) home.create(argv, p);
TestUtil.logTrace("in ejbvehicle: home.create() ok; call runTest()");
ref = (EJBVehicleRemote) jc.lookup(sEJBVehicleJndiName,
EJBVehicleRemote.class);
ref.initialize(argv, p);
TestUtil.logTrace("in ejbvehicle: initialize ok; call runTest()");
sTestStatus = (ref.runTest()).toStatus();
} catch (Exception e) {
TestUtil.logErr("Test failed", e);
sTestStatus = Status.failed("Test run in ejb vehicle failed");
} finally {
if (ref != null) {
try {
ref.remove();
} catch (Exception e2) {
TestUtil.logHarnessDebug(
"Exception while trying to remove the EJB Vehicle bean.");
}
}
}
return sTestStatus;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2024 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 @@ -23,7 +23,6 @@
<ejb-ref>
<ejb-ref-name>ejb/EJBVehicle</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleHome</home>
<remote>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote</remote>
</ejb-ref>
</application-client>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2024 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 @@ -22,8 +22,7 @@
<enterprise-beans>
<session>
<ejb-name>com_sun_ts_tests_common_vehicle_ejb_EJBVehicle</ejb-name>
<home>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleHome</home>
<remote>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote</remote>
<business-remote>com.sun.ts.tests.common.vehicle.ejb.EJBVehicleRemote</business-remote>
<ejb-class>com.sun.ts.tests.common.vehicle.ejb.EJBVehicle</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 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 @@ -22,7 +22,6 @@ package com.sun.ts.tests.common.vehicle.wsejb;

import java.io.*;
import java.net.*;
import java.rmi.Remote;
import jakarta.ejb.*;
import java.util.*;
import jakarta.xml.ws.WebServiceRef;
Expand All @@ -34,8 +33,7 @@ import com.sun.javatest.Status;

@WSREFSEJBCLIENT@

public class WSEJBVehicle implements SessionBean
{
public class WSEJBVehicle {
private EETest testObj;
private Properties properties;
private String[] arguments;
Expand All @@ -44,81 +42,54 @@ public class WSEJBVehicle implements SessionBean
@WSRAnn@
@SERVICE@ service = null;

public void ejbCreate(String[] args, Properties p) throws CreateException
{
//Initialize TestUtil Reporting
System.out.println("WSDEBUG: in WSEJBVehicle.ejbCreate(): service="+service);
try
{
public void initialize(String[] args, Properties p) {
// Initialize TestUtil Reporting
System.out.println("WSDEBUG: in WSEJBVehicle.initialize(): service="+service);
try {
TestUtil.init(p);
}
catch (Exception e)
{
} catch (Exception e) {
TestUtil.logErr("initLogging failed in wsejb vehicle.", e);
throw new EJBException();
}

try
{
arguments = args;
properties = p;
arguments = args;
properties = p;

//create an instance of the test client and run here
Class c = Class.forName(p.getProperty("test_classname"));
testObj = (EETest) c.newInstance();
}
catch(Exception e)
{
TestUtil.logErr("Failed to create the EETest instance in the wsejb vehicle", e);
throw new EJBException();
}
// create an instance of the test client and run here
try {
Class c = Class.forName(p.getProperty("test_classname"));
testObj = (EETest) c.newInstance();
} catch (Exception e) {
TestUtil.logErr("Failed to create the EETest instance in the wsejb vehicle", e);
throw new EJBException();
}

TestUtil.logTrace( "ejbcreate");
TestUtil.logTrace("initialize");
}

//the run method that we call here will either throw
//an exception (failed), or return void (pass)
public RemoteStatus runTest()
{
// the run method that we call here will either throw
// an exception (failed), or return void (pass)
public RemoteStatus runTest() {
RemoteStatus sTestStatus = new RemoteStatus(Status.passed(""));

TestUtil.logTrace("in runTest()" );

try
{
//call EETest impl's run method
try {
//call EETest impl's run method

((ServiceEETest)(testObj)).setSharedObject(service);
((ServiceEETest)(testObj)).setSharedObject(service);

sTestStatus = new RemoteStatus(testObj.run(arguments, properties));
sTestStatus = new RemoteStatus(testObj.run(arguments, properties));

if(sTestStatus.getType() == Status.PASSED)
TestUtil.logMsg("Test running in wsejb vehicle passed");
else
TestUtil.logMsg("Test running in wsejb vehicle failed");
}
catch(Throwable e)
{
if (sTestStatus.getType() == Status.PASSED)
TestUtil.logMsg("Test running in wsejb vehicle passed");
else
TestUtil.logMsg("Test running in wsejb vehicle failed");
} catch (Throwable e) {
e.printStackTrace();
TestUtil.logErr("Test running in wsejb vehicle failed", e);
sTestStatus = new RemoteStatus(Status.failed("Test running in wsejb vehicle failed"));
sTestStatus = new RemoteStatus(Status.failed("Test running in wsejb vehicle failed"));
}
return sTestStatus;
}

public void setSessionContext(SessionContext sc)
{
}

public void ejbRemove()
{
}

public void ejbActivate()
{
}

public void ejbPassivate()
{
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024 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 @@ -20,12 +20,12 @@

package com.sun.ts.tests.common.vehicle.wsejb;

import java.rmi.RemoteException;
import java.util.Properties;

import com.sun.ts.lib.harness.RemoteStatus;

import jakarta.ejb.EJBObject;
public interface WSEJBVehicleRemote {
public RemoteStatus runTest();

public interface WSEJBVehicleRemote extends EJBObject {
public RemoteStatus runTest() throws RemoteException;
public void initialize(String[] args, Properties p);
}
Loading

0 comments on commit 005ee51

Please sign in to comment.