예제 #1
0
 /**
  * Verifies the equality of the two objects. Performs special handling of certain types.
  *
  * @param inExpected expected object.
  * @param inActual actual object.
  * @throws IOException if there were errors.
  */
 private static void verifyEquals(Object inExpected, Object inActual) throws IOException {
   if (inExpected == null) {
     assertNull(inActual);
   } else {
     assertNotNull("Expected:" + inExpected, inActual);
     // special handling for certain types
     if (inExpected instanceof ModuleInfo) {
       ModuleInfo e = (ModuleInfo) inExpected;
       ModuleInfo a = (ModuleInfo) inActual;
       ModuleTestBase.assertModuleInfo(
           a,
           e.getURN(),
           e.getState(),
           e.getInitiatedDataFlows(),
           e.getParticipatingDataFlows(),
           e.isAutocreated(),
           e.isAutostart(),
           e.isReceiver(),
           e.isEmitter(),
           e.isFlowRequester());
       assertEquals(e.getLastStartFailure(), a.getLastStartFailure());
       assertEquals(e.getLastStopFailure(), a.getLastStopFailure());
       assertEquals(e.getLockQueueLength(), a.getLockQueueLength());
       assertEquals(e.getReadLockCount(), a.getReadLockCount());
       assertEquals(e.isWriteLocked(), a.isWriteLocked());
     } else if (inExpected instanceof Map) {
       // Convert both maps to the same type
       Map e = new HashMap<Object, Object>((Map<?, ?>) inExpected);
       Map a = new HashMap<Object, Object>((Map<?, ?>) inActual);
       assertEquals(e, a);
     } else if (inExpected instanceof CreateStrategyParameters) {
       CreateStrategyParameters e = (CreateStrategyParameters) inExpected;
       CreateStrategyParameters a = (CreateStrategyParameters) inActual;
       assertEquals(e.getInstanceName(), a.getInstanceName());
       assertEquals(e.getStrategyName(), a.getStrategyName());
       assertEquals(e.getLanguage(), a.getLanguage());
       InputStream ein = e.getStrategySource();
       InputStream ain = a.getStrategySource();
       assertArrayEquals(IOUtils.toByteArray(ein), IOUtils.toByteArray(ain));
       ein.close();
       ain.close();
     } else {
       assertEquals(inExpected, inActual);
     }
   }
 }
 /**
  * Returns an <code>MXBean</code> Proxy for the market data module being tested.
  *
  * @return an <code>AbstractMarketDataModuleMXBean</code> value
  * @throws Exception if an error occurs
  */
 protected final AbstractMarketDataModuleMXBean getMXBeanProxy() throws Exception {
   ObjectName objectName = getInstanceURN().toObjectName();
   MBeanServerConnection mMBeanServer = ModuleTestBase.getMBeanServer();
   return JMX.newMXBeanProxy(mMBeanServer, objectName, AbstractMarketDataModuleMXBean.class, true);
 }