blob: fcbdfb699d15a98f6954e7ca39dea6b23e749d69 [file] [log] [blame]
/*
* Copyright (c) 1998, 2021 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,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.testing.tests.isolatedsession;
import org.eclipse.persistence.testing.framework.*;
import org.eclipse.persistence.sessions.*;
public class VerifyExclusiveConnectionTest extends ClientServerTest {
public boolean isPostEventFired = false;
public boolean isPreEventFired = false;
public VerifyExclusiveConnectionTest() {
super(true);
setDescription("This test verifies that an exclusive connection is created for the client. and the appropriate events are thrown.");
}
public VerifyExclusiveConnectionTest(String exclusiveConnectionMode, boolean isIsolated) {
super(exclusiveConnectionMode, isIsolated);
String str = exclusiveConnectionMode;
if(isIsolated) {
str += "_Isolated";
}
setDescription("This test verifies that an exclusive connection is created for the client and the appropriate events are thrown. " + str);
setName(getName() + " " + str);
}
@Override
public void test() {
this.server.getEventManager().addListener(new IsolatedSessionEventAdaptor(this));
((Session)this.clients.get(0)).readObject(IsolatedEmployee.class);
((Session)this.clients.get(0)).release();
this.clients.remove(0);
}
@Override
public void verify() {
if (!this.isPostEventFired) {
throw new TestErrorException("The post acquire Exclusive Connection event was not fired");
}
if (!this.isPreEventFired) {
throw new TestErrorException("The pre release Exclusive Connection event was not fired");
}
}
@Override
public void setup() {
super.setup();
this.isPostEventFired = false;
this.isPreEventFired = false;
}
}