Example #1
0
 /**
  * Helper method that can be used to dynamically figure out enumeration type of given {@link
  * EnumSet}, without having access to its declaration. Code is needed to work around design flaw
  * in JDK.
  *
  * @since 1.5
  */
 public static Class<? extends Enum<?>> findEnumType(EnumMap<?, ?> m) {
   if (!m.isEmpty()) {
     return findEnumType(m.keySet().iterator().next());
   }
   // Otherwise need to locate using an internal field
   return EnumTypeLocator.instance.enumTypeFor(m);
 }
 @Test
 public void testExamineStorageSubSystemCommandFullCloneFlagForVmwareNull() {
   when(destDataStoreTO.isFullCloneFlag()).thenReturn(null);
   _resource.examineStorageSubSystemCommandFullCloneFlagForVmware(storageCmd, params);
   verify(destDataTO).getDataStore();
   verify(destDataStoreTO).isFullCloneFlag();
   assertTrue(params.isEmpty());
 }
  public static void init() {
    if (!channels.isEmpty()) // avoid duplicate inits..
    return;

    Codec codec = new Codec();

    codec.addDiscriminator(0, PacketMachine.class);
    codec.addDiscriminator(1, PacketEntity.class);
    codec.addDiscriminator(2, PacketDimInfo.class);
    codec.addDiscriminator(3, PacketSatellite.class);
    codec.addDiscriminator(4, PacketStellarInfo.class);
    codec.addDiscriminator(5, PacketItemModifcation.class);

    channels.putAll(
        NetworkRegistry.INSTANCE.newChannel(AdvancedRocketry.modId, codec, new HandlerServer()));

    // add handlers
    if (FMLCommonHandler.instance().getSide().isClient()) {
      // for the client
      FMLEmbeddedChannel channel = channels.get(Side.CLIENT);
      String codecName = channel.findChannelHandlerNameForType(Codec.class);
      channel.pipeline().addAfter(codecName, "ClientHandler", new HandlerClient());
    }
  }
 @Test
 public void testExamineStorageSubSystemCommandNfsVersionNotPresent() {
   when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
   _resource.examineStorageSubSystemCommandNfsVersion(storageCmd, params);
   assertTrue(params.isEmpty());
 }