public static int getIdForValueMeta(String valueMetaName) {
   for (PluginInterface plugin : pluginRegistry.getPlugins(ValueMetaPluginType.class)) {
     if (valueMetaName != null && valueMetaName.equalsIgnoreCase(plugin.getName())) {
       return Integer.valueOf(plugin.getIds()[0]);
     }
   }
   return ValueMetaInterface.TYPE_NONE;
 }
 public static String getValueMetaName(int type) {
   for (PluginInterface plugin : pluginRegistry.getPlugins(ValueMetaPluginType.class)) {
     if (Integer.toString(type).equals(plugin.getIds()[0])) {
       return plugin.getName();
     }
   }
   return "-";
 }
 public static String[] getValueMetaNames() {
   List<String> strings = new ArrayList<String>();
   List<PluginInterface> plugins = pluginRegistry.getPlugins(ValueMetaPluginType.class);
   for (PluginInterface plugin : plugins) {
     int id = Integer.valueOf(plugin.getIds()[0]);
     if (id > 0 && id != ValueMetaInterface.TYPE_SERIALIZABLE) {
       strings.add(plugin.getName());
     }
   }
   return strings.toArray(new String[strings.size()]);
 }
 public static String[] getAllValueMetaNames() {
   List<String> strings = new ArrayList<String>();
   List<PluginInterface> plugins = pluginRegistry.getPlugins(ValueMetaPluginType.class);
   for (PluginInterface plugin : plugins) {
     String id = plugin.getIds()[0];
     if (!("0".equals(id))) {
       strings.add(plugin.getName());
     }
   }
   return strings.toArray(new String[strings.size()]);
 }
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    KettleClientEnvironment.init();
    dbMap.put(DatabaseInterface.class, DBMockIface.class.getName());
    dbMap.put(InfobrightDatabaseMeta.class, InfobrightDatabaseMeta.class.getName());

    PluginRegistry preg = PluginRegistry.getInstance();

    PluginInterface mockDbPlugin = mock(PluginInterface.class);
    when(mockDbPlugin.matches(anyString())).thenReturn(true);
    when(mockDbPlugin.isNativePlugin()).thenReturn(true);
    when(mockDbPlugin.getMainType())
        .thenAnswer(
            new Answer<Class<?>>() {
              @Override
              public Class<?> answer(InvocationOnMock invocation) throws Throwable {
                return DatabaseInterface.class;
              }
            });

    when(mockDbPlugin.getPluginType())
        .thenAnswer(
            new Answer<Class<? extends PluginTypeInterface>>() {
              @Override
              public Class<? extends PluginTypeInterface> answer(InvocationOnMock invocation)
                  throws Throwable {
                return DatabasePluginType.class;
              }
            });

    when(mockDbPlugin.getIds()).thenReturn(new String[] {"Oracle", "mock-db-id"});
    when(mockDbPlugin.getName()).thenReturn("mock-db-name");
    when(mockDbPlugin.getClassMap()).thenReturn(dbMap);

    preg.registerPlugin(DatabasePluginType.class, mockDbPlugin);
  }