< prev index next >

test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6245733
  27  * @summary synopsis: rmid's registry's list operation doesn't include
  28  * activation system
  29  * @author Ann Wollrath
  30  *
  31  * @library ../../../testlibrary
  32  * @modules java.rmi/sun.rmi.registry
  33  *          java.rmi/sun.rmi.server
  34  *          java.rmi/sun.rmi.transport
  35  *          java.rmi/sun.rmi.transport.tcp
  36  * @build TestLibrary RMID ActivationLibrary
  37  * @run main/othervm/timeout=240 LookupActivationSystem
  38  */
  39 
  40 import java.rmi.*;
  41 import java.rmi.activation.*;
  42 import java.rmi.registry.*;
  43 import java.rmi.server.*;
  44 import java.io.Serializable;
  45 
  46 public class LookupActivationSystem implements Remote, Serializable {
  47 
  48     private static final String NAME = ActivationSystem.class.getName();
  49 
  50     public static void main(String[] args) throws Exception {
  51 
  52         System.out.println("\nRegression test for bug 6245733\n");
  53 
  54         RMID rmid = null;
  55 
  56         try {
  57             RMID.removeLog();
  58             rmid = RMID.createRMID();
  59             rmid.start();
  60 
  61             System.err.println("look up activation system");
  62             Registry rmidRegistry =
  63                 LocateRegistry.getRegistry(rmid.getPort());
  64             ActivationSystem system = (ActivationSystem)
  65                 rmidRegistry.lookup(NAME);
  66 
  67             if (system instanceof ActivationSystem) {
  68                 System.err.println("test1 passed: lookup succeeded");
  69             }
  70 
  71             System.err.println("get list of rmid internal registry");
  72             String[] list = rmidRegistry.list();
  73             if (list.length == 1 && list[0].equals(NAME)) {
  74                 System.err.println(
  75                     "test2 passed: activation system found in list");
  76             } else {
  77                 throw new RuntimeException("test2 FAILED");
  78             }
  79 




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6245733 8085192
  27  * @summary synopsis: rmid's registry's list operation doesn't include
  28  * activation system
  29  * @author Ann Wollrath
  30  *
  31  * @library ../../../testlibrary
  32  * @modules java.rmi/sun.rmi.registry
  33  *          java.rmi/sun.rmi.server
  34  *          java.rmi/sun.rmi.transport
  35  *          java.rmi/sun.rmi.transport.tcp
  36  * @build TestLibrary RMID ActivationLibrary
  37  * @run main/othervm/timeout=240 LookupActivationSystem
  38  */
  39 
  40 import java.rmi.*;
  41 import java.rmi.activation.*;
  42 import java.rmi.registry.*;
  43 import java.rmi.server.*;
  44 import java.io.Serializable;
  45 
  46 public class LookupActivationSystem implements Remote, Serializable {
  47 
  48     private static final String NAME = ActivationSystem.class.getName();
  49 
  50     public static void main(String[] args) throws Exception {
  51 
  52         System.out.println("\nRegression test for bug 6245733\n");
  53 
  54         RMID rmid = null;
  55 
  56         try {
  57             rmid = RMID.launch();


  58 
  59             System.err.println("look up activation system");
  60             Registry rmidRegistry =
  61                 LocateRegistry.getRegistry(rmid.getPort());
  62             ActivationSystem system = (ActivationSystem)
  63                 rmidRegistry.lookup(NAME);
  64 
  65             if (system instanceof ActivationSystem) {
  66                 System.err.println("test1 passed: lookup succeeded");
  67             }
  68 
  69             System.err.println("get list of rmid internal registry");
  70             String[] list = rmidRegistry.list();
  71             if (list.length == 1 && list[0].equals(NAME)) {
  72                 System.err.println(
  73                     "test2 passed: activation system found in list");
  74             } else {
  75                 throw new RuntimeException("test2 FAILED");
  76             }
  77 


< prev index next >