Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCET.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCET.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCET.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCET.java Sun Oct 26 13:17:28 2014 @@ -1,160 +1,161 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.sun.jini.test.spec.eventmailbox; - -import java.util.logging.Level; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.ServerException; -import java.util.Date; - -import com.sun.jini.qa.harness.TestException; -import com.sun.jini.qa.harness.QAConfig; - -import net.jini.event.EventMailbox; -import net.jini.event.MailboxRegistration; -import net.jini.core.lease.Lease; -import net.jini.core.lease.UnknownLeaseException; -import net.jini.core.event.EventRegistration; -import net.jini.core.event.RemoteEvent; -import net.jini.core.event.RemoteEventListener; - -import com.sun.jini.constants.TimeConstants; -import com.sun.jini.qa.harness.Test; - -import com.sun.jini.test.impl.mercury.EMSTestBase; -import com.sun.jini.test.impl.mercury.TestUtils; -import com.sun.jini.test.impl.mercury.TestListener; -import com.sun.jini.test.impl.mercury.TestGenerator; - -/** - * EventMailboxServiceConcurrencyExceptionTest - * Creates an event listener that (concurrently) calls disableDelivery - * in its notify() method. Test verifies that only the first event - * gets delivered and that the concurrent disable call doesn't - * deadlock the mailbox service. The listener's notify() also - * throws an exception after calling disable. - */ -public class EMSCET extends EMSTestBase implements TimeConstants { - - // - // This should be long enough to sensibly run the test. - // If the service doesn't grant long enough leases, then - // we might have to resort to using something like the - // LeaseRenewalManager to keep our leases current. - // - private final long DURATION1 = 3*MINUTES; - - private final int NUM_EVENTS = 2; - - private final long EVENT_ID = 1234; - - private final long MAX_WAIT = 60 * 1000; - - public void run() throws Exception { - EventMailbox mb = getConfiguredMailbox(); - int i = 0; - - // Register and check lease - MailboxRegistration mr = getRegistration(mb, DURATION1); - logger.log(Level.INFO, "Got registration ref {0}", mr); - Lease mrl = getMailboxLease(mr); - logger.log(Level.INFO, "Got lease ref {0}", mrl); - checkLease(mrl, DURATION1); - logger.log(Level.INFO, "Mailbox lease good until " - + new Date(mrl.getExpiration())); - - // Get the mailbox service provided listener - RemoteEventListener mbRel = getMailboxListener(mr); - logger.log(Level.INFO, "Got RemoteEventListener ref {0}", mbRel); - - // Create an event generator and pass it the - // mailbox's remote event listener. - TestGenerator myGen = TestUtils.createGenerator(getManager()); - logger.log(Level.INFO, "Got TestGenerator ref {0}", myGen); - EventRegistration evtReg = - myGen.register(EVENT_ID, // Event ID to use - null, // handback - mbRel, // Notification target - DURATION1); // Lease duration - logger.log(Level.INFO, "Got EventRegistration ref {0}", evtReg); - Lease tgl = evtReg.getLease(); - checkLease(tgl, DURATION1); - logger.log(Level.INFO, "EventRegistration lease good until " - + new Date(tgl.getExpiration())); - - // Create two listener objects - TestListener myListener = - TestUtils.createDisableNSOListener(getManager(), mr); - logger.log(Level.INFO, "Got TestListener ref {0}", myListener); - int eventCount = 0; - - // Generate some events - logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); - RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; - for (i = 0; i < NUM_EVENTS; i++) { - events[i] = myGen.generateEvent(evtReg.getID(), 3); - } - - RemoteEvent[] bogus = { - new RemoteEvent(myGen, 9999, 9999, null), - new RemoteEvent(myGen, 5678, 1234, null), - }; - - // Enable the first of our listener objects - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); - mr.enableDelivery(myListener); - - // Add an extra delay here since we'll only block - // on the receipt of one event, but we really want - // to see if a second event is sent as well. - logger.log(Level.INFO, "sleeping for 5 sec"); - try { - Thread.sleep(5000); - } catch (InterruptedException ie) { - logger.log(Level.INFO, "waking up early - interrupted"); - } - logger.log(Level.INFO, "awoken"); - - logger.log(Level.INFO, "Wating for event delivery"); - eventCount = 1; - waitForEvents(myListener, eventCount, MAX_WAIT); - logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Verifying events "); - assertEvent(myListener, events[0]); - if(myListener.verifyEvents(bogus)) { - throw new TestException("Successfully verified bogus events"); - } - - mrl.cancel(); - } - - /** - * Invoke parent's construct and parser - * @exception TestException will usually indicate an "unresolved" - * condition because at this point the test has not yet begun. - */ - public Test construct(QAConfig config) throws Exception { - super.construct(config); - parse(); - return this; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sun.jini.test.spec.eventmailbox; + +import java.util.logging.Level; + +import java.rmi.RemoteException; +import java.rmi.NoSuchObjectException; +import java.rmi.ServerException; +import java.util.Date; + +import com.sun.jini.qa.harness.TestException; +import com.sun.jini.qa.harness.QAConfig; + +import net.jini.event.EventMailbox; +import net.jini.event.MailboxRegistration; +import net.jini.core.lease.Lease; +import net.jini.core.lease.UnknownLeaseException; +import net.jini.core.event.EventRegistration; +import net.jini.core.event.RemoteEvent; +import net.jini.core.event.RemoteEventListener; + +import com.sun.jini.constants.TimeConstants; +import com.sun.jini.qa.harness.Test; + +import com.sun.jini.test.impl.mercury.EMSTestBase; +import com.sun.jini.test.impl.mercury.TestUtils; +import com.sun.jini.test.impl.mercury.TestListener; +import com.sun.jini.test.impl.mercury.TestGenerator; + +/** + * EventMailboxServiceConcurrencyExceptionTest + * Creates an event listener that (concurrently) calls disableDelivery + * in its notify() method. Test verifies that only the first event + * gets delivered and that the concurrent disable call doesn't + * deadlock the mailbox service. The listener's notify() also + * throws an exception after calling disable. + */ +public class EMSCET extends EMSTestBase implements TimeConstants { + + // + // This should be long enough to sensibly run the test. + // If the service doesn't grant long enough leases, then + // we might have to resort to using something like the + // LeaseRenewalManager to keep our leases current. + // + private final long DURATION1 = 3*MINUTES; + + private final int NUM_EVENTS = 2; + + private final long EVENT_ID = 1234; + + private final long MAX_WAIT = 60 * 1000; + + public void run() throws Exception { + EventMailbox mb = getConfiguredMailbox(); + int i = 0; + + // Register and check lease + MailboxRegistration mr = getRegistration(mb, DURATION1); + logger.log(Level.INFO, "Got registration ref {0}", mr); + Lease mrl = getMailboxLease(mr); + logger.log(Level.INFO, "Got lease ref {0}", mrl); + checkLease(mrl, DURATION1); + logger.log(Level.INFO, "Mailbox lease good until " + + new Date(mrl.getExpiration())); + + // Get the mailbox service provided listener + RemoteEventListener mbRel = getMailboxListener(mr); + logger.log(Level.INFO, "Got RemoteEventListener ref {0}", mbRel); + + // Create an event generator and pass it the + // mailbox's remote event listener. + TestGenerator myGen = TestUtils.createGenerator(getManager()); + logger.log(Level.INFO, "Got TestGenerator ref {0}", myGen); + EventRegistration evtReg = + myGen.register(EVENT_ID, // Event ID to use + null, // handback + mbRel, // Notification target + DURATION1); // Lease duration + logger.log(Level.INFO, "Got EventRegistration ref {0}", evtReg); + Lease tgl = evtReg.getLease(); + checkLease(tgl, DURATION1); + logger.log(Level.INFO, "EventRegistration lease good until " + + new Date(tgl.getExpiration())); + + // Create two listener objects + TestListener myListener = + TestUtils.createDisableNSOListener(getManager(), mr); + logger.log(Level.INFO, "Got TestListener ref {0}", myListener); + int eventCount = 0; + + // Generate some events + logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); + RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; + for (i = 0; i < NUM_EVENTS; i++) { + events[i] = myGen.generateEvent(evtReg.getID(), 3); + } + + RemoteEvent[] bogus = { + new RemoteEvent(myGen, 9999, 9999, null), + new RemoteEvent(myGen, 5678, 1234, null), + }; + + // Enable the first of our listener objects + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); + mr.enableDelivery(myListener); + + // Add an extra delay here since we'll only block + // on the receipt of one event, but we really want + // to see if a second event is sent as well. + logger.log(Level.INFO, "sleeping for 5 sec"); + try { + Thread.sleep(5000); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + logger.log(Level.INFO, "waking up early - interrupted"); + } + logger.log(Level.INFO, "awoken"); + + logger.log(Level.INFO, "Wating for event delivery"); + eventCount = 1; + waitForEvents(myListener, eventCount, MAX_WAIT); + logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Verifying events "); + assertEvent(myListener, events[0]); + if(myListener.verifyEvents(bogus)) { + throw new TestException("Successfully verified bogus events"); + } + + mrl.cancel(); + } + + /** + * Invoke parent's construct and parser + * @exception TestException will usually indicate an "unresolved" + * condition because at this point the test has not yet begun. + */ + public Test construct(QAConfig config) throws Exception { + super.construct(config); + parse(); + return this; + } +}
Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCT.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCT.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCT.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSCT.java Sun Oct 26 13:17:28 2014 @@ -1,158 +1,159 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.sun.jini.test.spec.eventmailbox; - -import java.util.logging.Level; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.ServerException; -import java.util.Date; - -import com.sun.jini.qa.harness.TestException; -import com.sun.jini.qa.harness.QAConfig; - -import net.jini.event.EventMailbox; -import net.jini.event.MailboxRegistration; -import net.jini.core.lease.Lease; -import net.jini.core.lease.UnknownLeaseException; -import net.jini.core.event.EventRegistration; -import net.jini.core.event.RemoteEvent; -import net.jini.core.event.RemoteEventListener; - -import com.sun.jini.constants.TimeConstants; -import com.sun.jini.qa.harness.Test; - -import com.sun.jini.test.impl.mercury.EMSTestBase; -import com.sun.jini.test.impl.mercury.TestUtils; -import com.sun.jini.test.impl.mercury.TestListener; -import com.sun.jini.test.impl.mercury.TestGenerator; - -/** - * EventMailboxServiceConcurrencyTest - * Creates an event listener that (concurrently) calls disableDelivery - * in its notify() method. Test verifies that only the first event - * gets delivered and that the concurrent disable call doesn't - * deadlock the mailbox service. - */ -public class EMSCT extends EMSTestBase implements TimeConstants { - - // - // This should be long enough to sensibly run the test. - // If the service doesn't grant long enough leases, then - // we might have to resort to using something like the - // LeaseRenewalManager to keep our leases current. - // - private final long DURATION1 = 3*MINUTES; - - private final int NUM_EVENTS = 2; - - private final long EVENT_ID = 1234; - - private final long MAX_WAIT = 60 * 1000; - - public void run() throws Exception { - EventMailbox mb = getConfiguredMailbox(); - int i = 0; - - // Register and check lease - MailboxRegistration mr = getRegistration(mb, DURATION1); - logger.log(Level.INFO, "Got registration ref {0}", mr); - Lease mrl = getMailboxLease(mr); - logger.log(Level.INFO, "Got lease ref {0}", mrl); - checkLease(mrl, DURATION1); - logger.log(Level.INFO, "Mailbox lease good until " - + new Date(mrl.getExpiration())); - - // Get the mailbox service provided listener - RemoteEventListener mbRel = getMailboxListener(mr); - logger.log(Level.INFO, "Got RemoteEventListener ref {0}", mbRel); - - // Create an event generator and pass it the - // mailbox's remote event listener. - TestGenerator myGen = TestUtils.createGenerator(getManager()); - logger.log(Level.INFO, "Got TestGenerator ref {0}", myGen); - EventRegistration evtReg = - myGen.register(EVENT_ID, // Event ID to use - null, // handback - mbRel, // Notification target - DURATION1); // Lease duration - logger.log(Level.INFO, "Got EventRegistration ref {0}", evtReg); - Lease tgl = evtReg.getLease(); - checkLease(tgl, DURATION1); - logger.log(Level.INFO, "EventRegistration lease good until " - + new Date(tgl.getExpiration())); - - // Create two listener objects - TestListener myListener = TestUtils.createDisableListener(getManager(), mr); - logger.log(Level.INFO, "Got TestListener ref {0}", myListener); - int eventCount = 0; - - // Generate some events - logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); - RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; - for (i = 0; i < NUM_EVENTS; i++) { - events[i] = myGen.generateEvent(evtReg.getID(), 3); - } - - RemoteEvent[] bogus = { - new RemoteEvent(myGen, 9999, 9999, null), - new RemoteEvent(myGen, 5678, 1234, null), - }; - - // Enable the first of our listener objects - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); - mr.enableDelivery(myListener); - - // Add an extra delay here since we'll only block - // on the receipt of one event, but we really want - // to see if a second event is sent as well. - logger.log(Level.INFO, "sleeping for 5 sec"); - try { - Thread.sleep(5000); - } catch (InterruptedException ie) { - logger.log(Level.INFO, "waking up early - interrupted"); - } - logger.log(Level.INFO, "awoken"); - - logger.log(Level.INFO, "Wating for event delivery"); - eventCount = 1; - waitForEvents(myListener, eventCount, MAX_WAIT); - logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Verifying events "); - assertEvent(myListener, events[0]); - if(myListener.verifyEvents(bogus)) { - throw new TestException("Successfully verified bogus events"); - } - - mrl.cancel(); - } - - /** - * Invoke parent's construct and parser - * @exception TestException will usually indicate an "unresolved" - * condition because at this point the test has not yet begun. - */ - public Test construct(QAConfig config) throws Exception { - super.construct(config); - parse(); - return this; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sun.jini.test.spec.eventmailbox; + +import java.util.logging.Level; + +import java.rmi.RemoteException; +import java.rmi.NoSuchObjectException; +import java.rmi.ServerException; +import java.util.Date; + +import com.sun.jini.qa.harness.TestException; +import com.sun.jini.qa.harness.QAConfig; + +import net.jini.event.EventMailbox; +import net.jini.event.MailboxRegistration; +import net.jini.core.lease.Lease; +import net.jini.core.lease.UnknownLeaseException; +import net.jini.core.event.EventRegistration; +import net.jini.core.event.RemoteEvent; +import net.jini.core.event.RemoteEventListener; + +import com.sun.jini.constants.TimeConstants; +import com.sun.jini.qa.harness.Test; + +import com.sun.jini.test.impl.mercury.EMSTestBase; +import com.sun.jini.test.impl.mercury.TestUtils; +import com.sun.jini.test.impl.mercury.TestListener; +import com.sun.jini.test.impl.mercury.TestGenerator; + +/** + * EventMailboxServiceConcurrencyTest + * Creates an event listener that (concurrently) calls disableDelivery + * in its notify() method. Test verifies that only the first event + * gets delivered and that the concurrent disable call doesn't + * deadlock the mailbox service. + */ +public class EMSCT extends EMSTestBase implements TimeConstants { + + // + // This should be long enough to sensibly run the test. + // If the service doesn't grant long enough leases, then + // we might have to resort to using something like the + // LeaseRenewalManager to keep our leases current. + // + private final long DURATION1 = 3*MINUTES; + + private final int NUM_EVENTS = 2; + + private final long EVENT_ID = 1234; + + private final long MAX_WAIT = 60 * 1000; + + public void run() throws Exception { + EventMailbox mb = getConfiguredMailbox(); + int i = 0; + + // Register and check lease + MailboxRegistration mr = getRegistration(mb, DURATION1); + logger.log(Level.INFO, "Got registration ref {0}", mr); + Lease mrl = getMailboxLease(mr); + logger.log(Level.INFO, "Got lease ref {0}", mrl); + checkLease(mrl, DURATION1); + logger.log(Level.INFO, "Mailbox lease good until " + + new Date(mrl.getExpiration())); + + // Get the mailbox service provided listener + RemoteEventListener mbRel = getMailboxListener(mr); + logger.log(Level.INFO, "Got RemoteEventListener ref {0}", mbRel); + + // Create an event generator and pass it the + // mailbox's remote event listener. + TestGenerator myGen = TestUtils.createGenerator(getManager()); + logger.log(Level.INFO, "Got TestGenerator ref {0}", myGen); + EventRegistration evtReg = + myGen.register(EVENT_ID, // Event ID to use + null, // handback + mbRel, // Notification target + DURATION1); // Lease duration + logger.log(Level.INFO, "Got EventRegistration ref {0}", evtReg); + Lease tgl = evtReg.getLease(); + checkLease(tgl, DURATION1); + logger.log(Level.INFO, "EventRegistration lease good until " + + new Date(tgl.getExpiration())); + + // Create two listener objects + TestListener myListener = TestUtils.createDisableListener(getManager(), mr); + logger.log(Level.INFO, "Got TestListener ref {0}", myListener); + int eventCount = 0; + + // Generate some events + logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); + RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; + for (i = 0; i < NUM_EVENTS; i++) { + events[i] = myGen.generateEvent(evtReg.getID(), 3); + } + + RemoteEvent[] bogus = { + new RemoteEvent(myGen, 9999, 9999, null), + new RemoteEvent(myGen, 5678, 1234, null), + }; + + // Enable the first of our listener objects + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); + mr.enableDelivery(myListener); + + // Add an extra delay here since we'll only block + // on the receipt of one event, but we really want + // to see if a second event is sent as well. + logger.log(Level.INFO, "sleeping for 5 sec"); + try { + Thread.sleep(5000); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + logger.log(Level.INFO, "waking up early - interrupted"); + } + logger.log(Level.INFO, "awoken"); + + logger.log(Level.INFO, "Wating for event delivery"); + eventCount = 1; + waitForEvents(myListener, eventCount, MAX_WAIT); + logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Verifying events "); + assertEvent(myListener, events[0]); + if(myListener.verifyEvents(bogus)) { + throw new TestException("Successfully verified bogus events"); + } + + mrl.cancel(); + } + + /** + * Invoke parent's construct and parser + * @exception TestException will usually indicate an "unresolved" + * condition because at this point the test has not yet begun. + */ + public Test construct(QAConfig config) throws Exception { + super.construct(config); + parse(); + return this; + } +} Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSLET.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSLET.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSLET.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSLET.java Sun Oct 26 13:17:28 2014 @@ -1,178 +1,179 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.sun.jini.test.spec.eventmailbox; - -import java.util.logging.Level; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.ServerException; -import java.util.Date; - -import com.sun.jini.qa.harness.TestException; -import com.sun.jini.qa.harness.QAConfig; - -import net.jini.event.EventMailbox; -import net.jini.event.MailboxRegistration; -import net.jini.core.lease.Lease; -import net.jini.core.lease.UnknownLeaseException; -import net.jini.core.event.EventRegistration; -import net.jini.core.event.RemoteEvent; -import net.jini.core.event.RemoteEventListener; - -import com.sun.jini.constants.TimeConstants; -import com.sun.jini.qa.harness.Test; - -import com.sun.jini.test.impl.mercury.EMSTestBase; -import com.sun.jini.test.impl.mercury.TestUtils; -import com.sun.jini.test.impl.mercury.TestListener; -import com.sun.jini.test.impl.mercury.TestGenerator; - - -public class EMSLET extends EMSTestBase implements TimeConstants { - - // - // This should be long enough to sensibly run the test. - // If the service doesn't grant long enough leases, then - // we might have to resort to using something like the - // LeaseRenewalManager to keep our leases current. - // - private final long DURATION1 = 3*MINUTES; - - private final int NUM_EVENTS = 5; - - private final long EVENT_ID = 1234; - - private final long MAX_WAIT = 60 * 1000; - - public void run() throws Exception { - EventMailbox mb = getConfiguredMailbox(); - int i = 0; - - // Register and check lease - MailboxRegistration mr = getRegistration(mb, DURATION1); - Lease mrl = getMailboxLease(mr); - checkLease(mrl, DURATION1); - logger.log(Level.INFO, "Mailbox lease good until" - + new Date(mrl.getExpiration())); - - // Get the mailbox service provided listener - RemoteEventListener mbRel = getMailboxListener(mr); - - // Create an event generator and pass it the - // mailbox's remote event listener. - TestGenerator myGen = TestUtils.createGenerator(getManager()); - EventRegistration evtReg = - myGen.register(EVENT_ID, // Event ID to use - null, // handback - mbRel, // Notification target - DURATION1); // Lease duration - Lease tgl = evtReg.getLease(); - checkLease(tgl, DURATION1); - - // Create two listener objects - TestListener myListener = TestUtils.createListener(getManager()); - int eventCount = 0; - - // Generate some events - logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); - RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; - for (i = 0; i < NUM_EVENTS; i++) { - events[i] = myGen.generateEvent(evtReg.getID(), 3); - } - - RemoteEvent[] bogus = { - new RemoteEvent(myGen, 9999, 9999, null), - new RemoteEvent(myGen, 5678, 1234, null), - }; - - // Enable the first of our listener objects - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); - mr.enableDelivery(myListener); - - logger.log(Level.INFO, "Wating for event delivery"); - eventCount = NUM_EVENTS; - waitForEvents(myListener, eventCount, MAX_WAIT); - logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); - assertCount(myListener, eventCount); - logger.log(Level.INFO, "Verifying events "); - assertEvents(myListener, events); - if(myListener.verifyEvents(bogus)) { - throw new TestException("Successfully verified bogus events"); - } - - // Delay to ensure that we sleep past the - // lease expiration. - logger.log(Level.INFO, "Sleeping for " + DURATION1); - try { - Thread.sleep(DURATION1); - } catch (InterruptedException ie) { - logger.log(Level.INFO, "Sleep interrupted"); - } - - - logger.log(Level.INFO, "Waking up at " + new Date(getTime())); - - logger.log(Level.INFO, "Generating " + NUM_EVENTS + " more events"); - try { - for (i = 0; i < NUM_EVENTS; i++) { - events[i] = myGen.generateEvent(evtReg.getID(), 3); - } - } catch (ServerException se) { - if (se.detail != null && - se.detail instanceof NoSuchObjectException) { - // can safely ignore this since we expect - // that the registration has expired. - logger.log(Level.INFO, "Caught NoSuchObjectException - expected"); - } else { throw se; } - } - - logger.log(Level.INFO, "Asserting that the event count hasn't changed"); - assertCount(myListener, eventCount); - try { - logger.log(Level.INFO, "Re-enabling delivery to our REL" + myListener); - mr.enableDelivery(myListener); - throw new TestException("Successfully re-enabled an expired registration"); - } catch (NoSuchObjectException nsoe) { - logger.log(Level.INFO, "Caught NoSuchObjectException - expected"); - } - - logger.log(Level.INFO, "Asserting that the event count hasn't changed"); - assertCount(myListener, eventCount); - - try { - logger.log(Level.INFO, "Re-cancelling registration lease"); - mrl.cancel(); - throw new TestException("Successfully cancelled an expired registration"); - } catch (UnknownLeaseException ule) { - logger.log(Level.INFO, "Caught UnknownLeaseException - expected"); - } - } - - /** - * Invoke parent's construct and parser - * @exception TestException will usually indicate an "unresolved" - * condition because at this point the test has not yet begun. - */ - public Test construct(QAConfig config) throws Exception { - super.construct(config); - parse(); - return this; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sun.jini.test.spec.eventmailbox; + +import java.util.logging.Level; + +import java.rmi.RemoteException; +import java.rmi.NoSuchObjectException; +import java.rmi.ServerException; +import java.util.Date; + +import com.sun.jini.qa.harness.TestException; +import com.sun.jini.qa.harness.QAConfig; + +import net.jini.event.EventMailbox; +import net.jini.event.MailboxRegistration; +import net.jini.core.lease.Lease; +import net.jini.core.lease.UnknownLeaseException; +import net.jini.core.event.EventRegistration; +import net.jini.core.event.RemoteEvent; +import net.jini.core.event.RemoteEventListener; + +import com.sun.jini.constants.TimeConstants; +import com.sun.jini.qa.harness.Test; + +import com.sun.jini.test.impl.mercury.EMSTestBase; +import com.sun.jini.test.impl.mercury.TestUtils; +import com.sun.jini.test.impl.mercury.TestListener; +import com.sun.jini.test.impl.mercury.TestGenerator; + + +public class EMSLET extends EMSTestBase implements TimeConstants { + + // + // This should be long enough to sensibly run the test. + // If the service doesn't grant long enough leases, then + // we might have to resort to using something like the + // LeaseRenewalManager to keep our leases current. + // + private final long DURATION1 = 3*MINUTES; + + private final int NUM_EVENTS = 5; + + private final long EVENT_ID = 1234; + + private final long MAX_WAIT = 60 * 1000; + + public void run() throws Exception { + EventMailbox mb = getConfiguredMailbox(); + int i = 0; + + // Register and check lease + MailboxRegistration mr = getRegistration(mb, DURATION1); + Lease mrl = getMailboxLease(mr); + checkLease(mrl, DURATION1); + logger.log(Level.INFO, "Mailbox lease good until" + + new Date(mrl.getExpiration())); + + // Get the mailbox service provided listener + RemoteEventListener mbRel = getMailboxListener(mr); + + // Create an event generator and pass it the + // mailbox's remote event listener. + TestGenerator myGen = TestUtils.createGenerator(getManager()); + EventRegistration evtReg = + myGen.register(EVENT_ID, // Event ID to use + null, // handback + mbRel, // Notification target + DURATION1); // Lease duration + Lease tgl = evtReg.getLease(); + checkLease(tgl, DURATION1); + + // Create two listener objects + TestListener myListener = TestUtils.createListener(getManager()); + int eventCount = 0; + + // Generate some events + logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); + RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; + for (i = 0; i < NUM_EVENTS; i++) { + events[i] = myGen.generateEvent(evtReg.getID(), 3); + } + + RemoteEvent[] bogus = { + new RemoteEvent(myGen, 9999, 9999, null), + new RemoteEvent(myGen, 5678, 1234, null), + }; + + // Enable the first of our listener objects + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Enabling delivery to our REL" + myListener); + mr.enableDelivery(myListener); + + logger.log(Level.INFO, "Wating for event delivery"); + eventCount = NUM_EVENTS; + waitForEvents(myListener, eventCount, MAX_WAIT); + logger.log(Level.INFO, "Verifying event delivery count of " + eventCount); + assertCount(myListener, eventCount); + logger.log(Level.INFO, "Verifying events "); + assertEvents(myListener, events); + if(myListener.verifyEvents(bogus)) { + throw new TestException("Successfully verified bogus events"); + } + + // Delay to ensure that we sleep past the + // lease expiration. + logger.log(Level.INFO, "Sleeping for " + DURATION1); + try { + Thread.sleep(DURATION1); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + logger.log(Level.INFO, "Sleep interrupted"); + } + + + logger.log(Level.INFO, "Waking up at " + new Date(getTime())); + + logger.log(Level.INFO, "Generating " + NUM_EVENTS + " more events"); + try { + for (i = 0; i < NUM_EVENTS; i++) { + events[i] = myGen.generateEvent(evtReg.getID(), 3); + } + } catch (ServerException se) { + if (se.detail != null && + se.detail instanceof NoSuchObjectException) { + // can safely ignore this since we expect + // that the registration has expired. + logger.log(Level.INFO, "Caught NoSuchObjectException - expected"); + } else { throw se; } + } + + logger.log(Level.INFO, "Asserting that the event count hasn't changed"); + assertCount(myListener, eventCount); + try { + logger.log(Level.INFO, "Re-enabling delivery to our REL" + myListener); + mr.enableDelivery(myListener); + throw new TestException("Successfully re-enabled an expired registration"); + } catch (NoSuchObjectException nsoe) { + logger.log(Level.INFO, "Caught NoSuchObjectException - expected"); + } + + logger.log(Level.INFO, "Asserting that the event count hasn't changed"); + assertCount(myListener, eventCount); + + try { + logger.log(Level.INFO, "Re-cancelling registration lease"); + mrl.cancel(); + throw new TestException("Successfully cancelled an expired registration"); + } catch (UnknownLeaseException ule) { + logger.log(Level.INFO, "Caught UnknownLeaseException - expected"); + } + } + + /** + * Invoke parent's construct and parser + * @exception TestException will usually indicate an "unresolved" + * condition because at this point the test has not yet begun. + */ + public Test construct(QAConfig config) throws Exception { + super.construct(config); + parse(); + return this; + } +} Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSRET.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSRET.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSRET.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/eventmailbox/EMSRET.java Sun Oct 26 13:17:28 2014 @@ -1,192 +1,193 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.sun.jini.test.spec.eventmailbox; - -import java.util.logging.Level; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.ServerException; - -import com.sun.jini.qa.harness.TestException; -import com.sun.jini.qa.harness.QAConfig; - -import net.jini.event.EventMailbox; -import net.jini.event.MailboxRegistration; -import net.jini.core.lease.Lease; -import net.jini.core.event.EventRegistration; -import net.jini.core.event.RemoteEvent; -import net.jini.core.event.RemoteEventListener; - -import com.sun.jini.constants.TimeConstants; -import com.sun.jini.qa.harness.Test; - -import com.sun.jini.test.impl.mercury.EMSTestBase; -import com.sun.jini.test.impl.mercury.TestUtils; -import com.sun.jini.test.impl.mercury.TestListener; -import com.sun.jini.test.impl.mercury.TestGenerator; - - -public class EMSRET extends EMSTestBase implements TimeConstants { - - // - // This should be long enough to sensibly run the test. - // If the service doesn't grant long enough leases, then - // we might have to resort to using something like the - // LeaseRenewalManager to keep our leases current. - // - private final long DURATION1 = 3*HOURS; - - private final int NUM_EVENTS = 5; - - private final long EVENT_ID = 1234; - - // This number seems high, but the retry algorithm backs off - // rather quickly (5s, 10s, 1min, ...). Need this delay - // in order to successfully retrieve events after the mailbox - // has backed off. - private final long MAX_WAIT = 3 * MINUTES; - - public void run() throws Exception { - EventMailbox mb = getConfiguredMailbox(); - int i = 0; - - // Register and check lease - MailboxRegistration mr = getRegistration(mb, DURATION1); - Lease mrl = getMailboxLease(mr); - checkLease(mrl, DURATION1); - - // Get the mailbox service provided listener - RemoteEventListener mbRel = getMailboxListener(mr); - - // Create an event generator and pass it the - // mailbox's remote event listener. - TestGenerator myGen = TestUtils.createGenerator(getManager()); - EventRegistration evtReg = - myGen.register(EVENT_ID, // Event ID to use - null, // handback - mbRel, // Notification target - DURATION1); // Lease duration - Lease tgl = evtReg.getLease(); - checkLease(tgl, DURATION1); - - // Create two listener objects - TestListener badListener = TestUtils.createREListener(getManager()); - TestListener goodListener = TestUtils.createListener(getManager()); - int badCount = 0; - int goodCount = 0; - - // Generate some events - logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); - RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; - for (i = 0; i < NUM_EVENTS; i++) { - events[i] = myGen.generateEvent(evtReg.getID(), 3); - } - - RemoteEvent[] bogus = { - new RemoteEvent(myGen, 9999, 9999, null), - new RemoteEvent(myGen, 5678, 1234, null), - }; - - // Enable the first of our listener objects - assertCount(badListener, badCount); - logger.log(Level.INFO, "Enabling delivery to our bad REL" + badListener); - mr.enableDelivery(badListener); - - // Wait for events to arrive and verify. - // Note that the listener object throws a - // RemoteException and can receive multiple - // events (duplicate) events from redelivery - // attempts. - logger.log(Level.INFO, "Wating for event delivery"); - badCount = 1; - waitForEvents(badListener, badCount, MAX_WAIT); - logger.log(Level.INFO, "Verifying event delivery count of " - + badCount); - assertCount(badListener, badCount); - logger.log(Level.INFO, "Verifying events "); - assertEvent(badListener, events[0]); - if (badListener.verifyEvents(events) || - badListener.verifyEvents(bogus) ) - { - throw new TestException("Successfully verified bogus events"); - } - - // Delay to (hopefully) ensure that - // some retries are attempted. This test - // is timing dependent since after MAX_RETRIES - // the mailbox will discard the - // remote event and move onto the next one, if any. - // If this delay is long enough to exceed the - // MAX_RETRIES then the count will get bumped and - // the test will fail. - long delay = 7000; - logger.log(Level.INFO, "Sleeping for " + delay); - try { - Thread.sleep(delay); - } catch (InterruptedException ie) { - logger.log(Level.INFO, "Sleep interrupted"); - } - - // Note that the count should still be 1 since - // retries will try to deliver the same event. - // Listener counts distinct events. See note above. - logger.log(Level.INFO, "Verifying event delivery count of " - + badCount); - assertCount(badListener, badCount); - // No need to assertEvents since it be the same one - // as before. - - // Enable good listener - assertCount(goodListener, goodCount); - logger.log(Level.INFO, "Enabling good listener"); - mr.enableDelivery(goodListener); - - goodCount = 5; - logger.log(Level.INFO, "Wating for event delivery of " + goodCount); - waitForEvents(goodListener, goodCount, MAX_WAIT); - logger.log(Level.INFO, "Asserting event count"); - assertCount(goodListener, goodCount); - logger.log(Level.INFO, "Verifying events"); - assertEvents(goodListener, events); - - logger.log(Level.INFO, "Generating another event"); - RemoteEvent re = myGen.generateEvent(evtReg.getID(), 3); - goodCount++; - logger.log(Level.INFO, "Wating for event delivery" + goodCount); - waitForEvents(goodListener, goodCount, MAX_WAIT); - logger.log(Level.INFO, "Asserting event count"); - assertCount(goodListener, goodCount); - logger.log(Level.INFO, "Verifying events"); - assertEvent(goodListener, re); - - logger.log(Level.INFO, "Cancelling registration"); - mrl.cancel(); - } - - /** - * Invoke parent's construct and parser - * @exception TestException will usually indicate an "unresolved" - * condition because at this point the test has not yet begun. - */ - public Test construct(QAConfig config) throws Exception { - super.construct(config); - parse(); - return this; - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sun.jini.test.spec.eventmailbox; + +import java.util.logging.Level; + +import java.rmi.RemoteException; +import java.rmi.NoSuchObjectException; +import java.rmi.ServerException; + +import com.sun.jini.qa.harness.TestException; +import com.sun.jini.qa.harness.QAConfig; + +import net.jini.event.EventMailbox; +import net.jini.event.MailboxRegistration; +import net.jini.core.lease.Lease; +import net.jini.core.event.EventRegistration; +import net.jini.core.event.RemoteEvent; +import net.jini.core.event.RemoteEventListener; + +import com.sun.jini.constants.TimeConstants; +import com.sun.jini.qa.harness.Test; + +import com.sun.jini.test.impl.mercury.EMSTestBase; +import com.sun.jini.test.impl.mercury.TestUtils; +import com.sun.jini.test.impl.mercury.TestListener; +import com.sun.jini.test.impl.mercury.TestGenerator; + + +public class EMSRET extends EMSTestBase implements TimeConstants { + + // + // This should be long enough to sensibly run the test. + // If the service doesn't grant long enough leases, then + // we might have to resort to using something like the + // LeaseRenewalManager to keep our leases current. + // + private final long DURATION1 = 3*HOURS; + + private final int NUM_EVENTS = 5; + + private final long EVENT_ID = 1234; + + // This number seems high, but the retry algorithm backs off + // rather quickly (5s, 10s, 1min, ...). Need this delay + // in order to successfully retrieve events after the mailbox + // has backed off. + private final long MAX_WAIT = 3 * MINUTES; + + public void run() throws Exception { + EventMailbox mb = getConfiguredMailbox(); + int i = 0; + + // Register and check lease + MailboxRegistration mr = getRegistration(mb, DURATION1); + Lease mrl = getMailboxLease(mr); + checkLease(mrl, DURATION1); + + // Get the mailbox service provided listener + RemoteEventListener mbRel = getMailboxListener(mr); + + // Create an event generator and pass it the + // mailbox's remote event listener. + TestGenerator myGen = TestUtils.createGenerator(getManager()); + EventRegistration evtReg = + myGen.register(EVENT_ID, // Event ID to use + null, // handback + mbRel, // Notification target + DURATION1); // Lease duration + Lease tgl = evtReg.getLease(); + checkLease(tgl, DURATION1); + + // Create two listener objects + TestListener badListener = TestUtils.createREListener(getManager()); + TestListener goodListener = TestUtils.createListener(getManager()); + int badCount = 0; + int goodCount = 0; + + // Generate some events + logger.log(Level.INFO, "Generating " + NUM_EVENTS + " events"); + RemoteEvent[] events = new RemoteEvent[NUM_EVENTS]; + for (i = 0; i < NUM_EVENTS; i++) { + events[i] = myGen.generateEvent(evtReg.getID(), 3); + } + + RemoteEvent[] bogus = { + new RemoteEvent(myGen, 9999, 9999, null), + new RemoteEvent(myGen, 5678, 1234, null), + }; + + // Enable the first of our listener objects + assertCount(badListener, badCount); + logger.log(Level.INFO, "Enabling delivery to our bad REL" + badListener); + mr.enableDelivery(badListener); + + // Wait for events to arrive and verify. + // Note that the listener object throws a + // RemoteException and can receive multiple + // events (duplicate) events from redelivery + // attempts. + logger.log(Level.INFO, "Wating for event delivery"); + badCount = 1; + waitForEvents(badListener, badCount, MAX_WAIT); + logger.log(Level.INFO, "Verifying event delivery count of " + + badCount); + assertCount(badListener, badCount); + logger.log(Level.INFO, "Verifying events "); + assertEvent(badListener, events[0]); + if (badListener.verifyEvents(events) || + badListener.verifyEvents(bogus) ) + { + throw new TestException("Successfully verified bogus events"); + } + + // Delay to (hopefully) ensure that + // some retries are attempted. This test + // is timing dependent since after MAX_RETRIES + // the mailbox will discard the + // remote event and move onto the next one, if any. + // If this delay is long enough to exceed the + // MAX_RETRIES then the count will get bumped and + // the test will fail. + long delay = 7000; + logger.log(Level.INFO, "Sleeping for " + delay); + try { + Thread.sleep(delay); + } catch (InterruptedException ie) { + Thread.currentThread().interrupt(); + logger.log(Level.INFO, "Sleep interrupted"); + } + + // Note that the count should still be 1 since + // retries will try to deliver the same event. + // Listener counts distinct events. See note above. + logger.log(Level.INFO, "Verifying event delivery count of " + + badCount); + assertCount(badListener, badCount); + // No need to assertEvents since it be the same one + // as before. + + // Enable good listener + assertCount(goodListener, goodCount); + logger.log(Level.INFO, "Enabling good listener"); + mr.enableDelivery(goodListener); + + goodCount = 5; + logger.log(Level.INFO, "Wating for event delivery of " + goodCount); + waitForEvents(goodListener, goodCount, MAX_WAIT); + logger.log(Level.INFO, "Asserting event count"); + assertCount(goodListener, goodCount); + logger.log(Level.INFO, "Verifying events"); + assertEvents(goodListener, events); + + logger.log(Level.INFO, "Generating another event"); + RemoteEvent re = myGen.generateEvent(evtReg.getID(), 3); + goodCount++; + logger.log(Level.INFO, "Wating for event delivery" + goodCount); + waitForEvents(goodListener, goodCount, MAX_WAIT); + logger.log(Level.INFO, "Asserting event count"); + assertCount(goodListener, goodCount); + logger.log(Level.INFO, "Verifying events"); + assertEvent(goodListener, re); + + logger.log(Level.INFO, "Cancelling registration"); + mrl.cancel(); + } + + /** + * Invoke parent's construct and parser + * @exception TestException will usually indicate an "unresolved" + * condition because at this point the test has not yet begun. + */ + public Test construct(QAConfig config) throws Exception { + super.construct(config); + parse(); + return this; + } +} Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/JavaSpaceTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/JavaSpaceTest.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/JavaSpaceTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/JavaSpaceTest.java Sun Oct 26 13:17:28 2014 @@ -22,7 +22,6 @@ import com.sun.jini.qa.harness.QAConfigu import com.sun.jini.qa.harness.QATestEnvironment; import com.sun.jini.qa.harness.Test; import com.sun.jini.qa.harness.TestException; -import java.rmi.RMISecurityManager; import java.rmi.RemoteException; import java.util.LinkedList; import java.util.logging.Level; @@ -36,6 +35,7 @@ import net.jini.core.transaction.Transac import net.jini.core.transaction.server.TransactionManager; import net.jini.security.ProxyPreparer; import net.jini.space.JavaSpace; +import org.apache.river.api.security.CombinerSecurityManager; /** * @@ -156,7 +156,7 @@ public abstract class JavaSpaceTest exte JavaSpace js = null; try { if (System.getSecurityManager() == null) { - System.setSecurityManager(new RMISecurityManager()); + System.setSecurityManager(new CombinerSecurityManager()); } printSpaceInfo(); js = (JavaSpace) getManager().startService(spaceName); // prepared Modified: river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionTest.java URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionTest.java?rev=1634322&r1=1634321&r2=1634322&view=diff ============================================================================== --- river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionTest.java (original) +++ river/jtsk/skunk/qa_refactor/trunk/qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionTest.java Sun Oct 26 13:17:28 2014 @@ -1,69 +1,44 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.sun.jini.test.spec.javaspace.conformance; - -import java.util.logging.Level; - -// java.util -import java.util.ArrayList; - -// java.rmi -import java.rmi.RemoteException; -import java.rmi.RMISecurityManager; - -// net.jini -import net.jini.core.lease.Lease; -import net.jini.core.entry.Entry; -import net.jini.core.event.EventRegistration; -import net.jini.core.transaction.Transaction; -import net.jini.core.transaction.TransactionFactory; -import net.jini.core.transaction.server.TransactionManager; -import net.jini.space.JavaSpace; - -// com.sun.jini -import com.sun.jini.qa.harness.QATestEnvironment; -import com.sun.jini.qa.harness.QAConfig; -import com.sun.jini.qa.harness.Test; -import com.sun.jini.qa.harness.TestException; - -import net.jini.security.ProxyPreparer; -import net.jini.config.Configuration; -import net.jini.config.ConfigurationException; - -/** - * Abstract Test base for all javaspace conformance tests. - * - * @author Mikhail A. Markov - */ -public abstract class TransactionTest extends JavaSpaceTest { - - /** - * Sets up the testing environment. - * - * @param config QAConfig from the runner for construct. - */ - public Test construct(QAConfig config) throws Exception { - // mandatory call to parent - super.construct(config); - // get an instance of Transaction Manager - mgr = getTxnManager(); - return this; - } - - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.sun.jini.test.spec.javaspace.conformance; + +import com.sun.jini.qa.harness.QAConfig; +import com.sun.jini.qa.harness.Test; + +/** + * Abstract Test base for all javaspace conformance tests. + * + * @author Mikhail A. Markov + */ +public abstract class TransactionTest extends JavaSpaceTest { + + /** + * Sets up the testing environment. + * + * @param config QAConfig from the runner for construct. + */ + public Test construct(QAConfig config) throws Exception { + // mandatory call to parent + super.construct(config); + // get an instance of Transaction Manager + mgr = getTxnManager(); + return this; + } + + +}
