예제 #1
0
  @AdviseWith(adviceClasses = {PropsUtilAdvice.class})
  @Test
  public void testClassInitializationOnSPI() throws Exception {
    System.setProperty(PropsKeys.INTRABAND_IMPL, SelectorIntraband.class.getName());
    System.setProperty(PropsKeys.INTRABAND_TIMEOUT_DEFAULT, "10000");
    System.setProperty(PropsKeys.INTRABAND_WELDER_IMPL, SocketWelder.class.getName());

    MPI mpiImpl = _getMPIImpl();

    Assert.assertNotNull(mpiImpl);
    Assert.assertTrue(mpiImpl.isAlive());

    MPI mpi = MPIHelperUtil.getMPI();

    Assert.assertSame(mpi, UnicastRemoteObject.toStub(mpiImpl));
    Assert.assertTrue(mpi.isAlive());

    Intraband intraband = MPIHelperUtil.getIntraband();

    Assert.assertSame(SelectorIntraband.class, intraband.getClass());

    DatagramReceiveHandler[] datagramReceiveHandlers = intraband.getDatagramReceiveHandlers();

    Assert.assertSame(
        BootstrapRPCDatagramReceiveHandler.class,
        datagramReceiveHandlers[SystemDataType.RPC.getValue()].getClass());
  }
예제 #2
0
  @AdviseWith(adviceClasses = {PropsUtilAdvice.class})
  @Test
  public void testClassInitializationOnMPI() throws Exception {
    PropsUtil.setProps(
        (Props)
            ProxyUtil.newProxyInstance(
                MPIHelperUtilTest.class.getClassLoader(),
                new Class<?>[] {Props.class},
                new InvocationHandler() {

                  @Override
                  public Object invoke(Object proxy, Method method, Object[] args) {

                    throw new UnsupportedOperationException();
                  }
                }));

    MPI mpiImpl = _getMPIImpl();

    Assert.assertNotNull(mpiImpl);
    Assert.assertTrue(mpiImpl.isAlive());

    MPI mpi = MPIHelperUtil.getMPI();

    Assert.assertSame(mpi, UnicastRemoteObject.toStub(mpiImpl));
    Assert.assertTrue(mpi.isAlive());

    Intraband intraband = MPIHelperUtil.getIntraband();

    Assert.assertSame(ExecutorIntraband.class, intraband.getClass());

    DatagramReceiveHandler[] datagramReceiveHandlers = intraband.getDatagramReceiveHandlers();

    Assert.assertSame(
        BootstrapRPCDatagramReceiveHandler.class,
        datagramReceiveHandlers[SystemDataType.RPC.getValue()].getClass());
  }