Search in sources :

Example 1 with CORBAConnection

use of org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection in project eclipselink by eclipse-ee4j.

the class CORBAConnectionExceptionsTest method setup.

@Override
public void setup() throws Exception {
    Session session = new DatabaseSessionImpl();
    session.setProperty("TransporterGenerator", generator);
    CORBAServerManagerController.start(session, getNameToBind(), "org.eclipse.persistence.testing.tests.remote.suncorba.CORBARemoteSessionControllerDispatcherForTestingExceptions", false);
    // Initialize the ORB.
    ORB orb = ORB.init(new String[0], new Properties());
    org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
    NamingContext ncRef = NamingContextHelper.narrow(objRef);
    NameComponent nc = new NameComponent(getNameToBind(), "");
    NameComponent[] path = { nc };
    CORBAServerManager manager = CORBAServerManagerHelper.narrow(ncRef.resolve(path));
    CORBAConnection corbaConnection = new CORBAConnection(manager.createRemoteSessionController());
    setRemoteConnection(corbaConnection);
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) DatabaseSessionImpl(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl) CORBAConnection(org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection) Properties(java.util.Properties) NamingContext(org.omg.CosNaming.NamingContext) ORB(org.omg.CORBA.ORB) Session(org.eclipse.persistence.sessions.Session)

Example 2 with CORBAConnection

use of org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection in project eclipselink by eclipse-ee4j.

the class SunCORBARemoteModel method createConnection.

public CORBAConnection createConnection() {
    System.out.println("The following environment properties must be set to run this test.");
    System.out.println("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://localhost:900");
    System.out.println("The follwing corba naming server must also be started on the computer.");
    System.out.println("<java_home>/bin/tnameserv.exe");
    CORBAServerManager manager = null;
    try {
        // Initialize the ORB.
        ORB orb = ORB.init(new String[0], new Properties());
        org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
        NamingContext ncRef = NamingContextHelper.narrow(objRef);
        NameComponent nc = new NameComponent("CORBAServer", "");
        NameComponent[] path = { nc };
        manager = CORBAServerManagerHelper.narrow(ncRef.resolve(path));
    } catch (Exception exception) {
        throw new TestErrorException("Corba not configured correctly, see system.out.", exception);
    }
    return new CORBAConnection(manager.createRemoteSessionController());
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException) CORBAConnection(org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection) Properties(java.util.Properties) NamingContext(org.omg.CosNaming.NamingContext) ORB(org.omg.CORBA.ORB) TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException)

Example 3 with CORBAConnection

use of org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection in project eclipselink by eclipse-ee4j.

the class SunCORBARemoteModel method setup.

@Override
public void setup() {
    RemoteModel.originalSession = getSession();
    new CORBAServerRunner(buildServerSession()).start();
    // Must delay to let the stupid server start
    try {
        Thread.sleep(10000);
    } catch (Exception e) {
        System.out.println(e.toString());
    }
    CORBAConnection connection = createConnection();
    Session remoteSession = connection.createRemoteSession();
    remoteSession.setLog(RemoteModel.originalSession.getLog());
    remoteSession.setLogLevel(RemoteModel.originalSession.getLogLevel());
    getExecutor().setSession(remoteSession);
}
Also used : CORBAConnection(org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection) TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException) Session(org.eclipse.persistence.sessions.Session)

Example 4 with CORBAConnection

use of org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection in project eclipselink by eclipse-ee4j.

the class SecurityWhileConvertingToMethodTest method test.

@Override
public void test() {
    boolean orig = TestSecurityManager.TRIGGER_EX;
    TestSecurityManager.TRIGGER_EX = false;
    try {
        // need to use the remote Initialization as the normal one would product TL-084 before check this test
        CORBARemoteSessionControllerDispatcher dispatcher = new CORBARemoteSessionControllerDispatcher(getSession());
        CORBAConnection connection = new CORBAConnection(dispatcher);
        DistributedSession ds = (DistributedSession) (connection).createRemoteSession();
        TestSecurityManager.TRIGGER_EX = true;
        mapping.remoteInitialization(ds);
    } catch (EclipseLinkException exception) {
        caughtException = exception;
    } finally {
        TestSecurityManager.TRIGGER_EX = orig;
    }
}
Also used : CORBARemoteSessionControllerDispatcher(org.eclipse.persistence.sessions.remote.corba.sun.CORBARemoteSessionControllerDispatcher) EclipseLinkException(org.eclipse.persistence.exceptions.EclipseLinkException) CORBAConnection(org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection) DistributedSession(org.eclipse.persistence.sessions.remote.DistributedSession)

Aggregations

CORBAConnection (org.eclipse.persistence.sessions.remote.corba.sun.CORBAConnection)4 Properties (java.util.Properties)2 Session (org.eclipse.persistence.sessions.Session)2 TestErrorException (org.eclipse.persistence.testing.framework.TestErrorException)2 ORB (org.omg.CORBA.ORB)2 NameComponent (org.omg.CosNaming.NameComponent)2 NamingContext (org.omg.CosNaming.NamingContext)2 EclipseLinkException (org.eclipse.persistence.exceptions.EclipseLinkException)1 DatabaseSessionImpl (org.eclipse.persistence.internal.sessions.DatabaseSessionImpl)1 DistributedSession (org.eclipse.persistence.sessions.remote.DistributedSession)1 CORBARemoteSessionControllerDispatcher (org.eclipse.persistence.sessions.remote.corba.sun.CORBARemoteSessionControllerDispatcher)1