use of org.pentaho.di.core.plugins.PluginTypeInterface in project pentaho-kettle by pentaho.
the class JobEntryEvalTableContentTest method setUpBeforeClass.
// private static DBMockIface dbi = DBMockIface();
@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();
mockDbPlugin = mock(PluginInterface.class);
when(mockDbPlugin.matches(anyString())).thenReturn(true);
when(mockDbPlugin.isNativePlugin()).thenReturn(true);
when(mockDbPlugin.getMainType()).thenAnswer((Answer<Class<?>>) invocation -> DatabaseInterface.class);
when(mockDbPlugin.getPluginType()).thenAnswer((Answer<Class<? extends PluginTypeInterface>>) invocation -> 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);
}
use of org.pentaho.di.core.plugins.PluginTypeInterface in project pentaho-kettle by pentaho.
the class KettleMissingPluginsException method getPluginsMessage.
public String getPluginsMessage() {
StringBuilder message = new StringBuilder();
for (PluginDetails details : missingPluginDetailsList) {
message.append(Const.CR);
try {
PluginTypeInterface pluginType = PluginRegistry.getInstance().getPluginType(details.pluginTypeClass);
message.append(pluginType.getName());
} catch (Exception e) {
message.append("UnknownPluginType-").append(details.pluginTypeClass.getName());
}
message.append(" : ").append(details.pluginId);
}
return message.toString();
}
use of org.pentaho.di.core.plugins.PluginTypeInterface in project pentaho-kettle by pentaho.
the class Spoon method showPluginInfo.
/**
* Show a plugin browser
*/
public void showPluginInfo() {
try {
// First we collect information concerning all the plugin types...
//
Map<String, RowMetaInterface> metaMap = new HashMap<>();
Map<String, List<Object[]>> dataMap = new HashMap<>();
PluginRegistry registry = PluginRegistry.getInstance();
List<Class<? extends PluginTypeInterface>> pluginTypeClasses = registry.getPluginTypes();
for (Class<? extends PluginTypeInterface> pluginTypeClass : pluginTypeClasses) {
PluginTypeInterface pluginTypeInterface = registry.getPluginType(pluginTypeClass);
if (pluginTypeInterface.isFragment()) {
continue;
}
String subject = pluginTypeInterface.getName();
RowBuffer pluginInformation = registry.getPluginInformation(pluginTypeClass);
metaMap.put(subject, pluginInformation.getRowMeta());
dataMap.put(subject, pluginInformation.getBuffer());
}
// Now push it all to a subject data browser...
//
SubjectDataBrowserDialog dialog = new SubjectDataBrowserDialog(shell, metaMap, dataMap, "Plugin browser", "Plugin type");
dialog.open();
} catch (Exception e) {
new ErrorDialog(shell, "Error", "Error listing plugins", e);
}
}
use of org.pentaho.di.core.plugins.PluginTypeInterface in project pentaho-kettle by pentaho.
the class PluginRegistryConcurrencyTest method getPlugins_WhenRegisteringPluginTypes.
@Test
public void getPlugins_WhenRegisteringPluginTypes() throws Exception {
final int gettersAmount = 30;
AtomicBoolean condition = new AtomicBoolean(true);
List<Getter> getters = new ArrayList<Getter>(gettersAmount);
for (int i = 0; i < gettersAmount; i++) {
Class<? extends PluginTypeInterface> type = (i % 2 == 0) ? type1 : type2;
getters.add(new Getter(condition, type));
}
PluginTypeInterface type = mock(PluginTypeInterface.class);
ConcurrencyTestRunner.runAndCheckNoExceptionRaised(Collections.singletonList(new Registrar(condition, type.getClass(), 1, "")), getters, condition);
}
use of org.pentaho.di.core.plugins.PluginTypeInterface in project pentaho-kettle by pentaho.
the class StringEvaluatorIT method loadValueMetaPlugins.
private void loadValueMetaPlugins() {
// Need to load the ValueMeta plugins
PluginRegistry registry = PluginRegistry.getInstance();
assertNotNull("Registry singleton was not found!", registry);
// Register a new plugin type...
//
PluginRegistry.addPluginType(ValueMetaPluginType.getInstance());
// Plugin Registry should initialize without exception
Exception initException = null;
try {
PluginRegistry.init();
} catch (Exception e) {
initException = e;
}
assertNull(initException);
// There will always be a PluginRegistryPluginType, so see if we enough plugin types here.
//
List<Class<? extends PluginTypeInterface>> pluginTypes = registry.getPluginTypes();
assertTrue("At least two plugin types expected in the registry", pluginTypes.size() > 1);
// ... and have at least 1 ValueMetaPlugin
List<PluginInterface> valueMetaPlugins = registry.getPlugins(ValueMetaPluginType.class);
assertTrue("Size of plugins list expected to be >1", valueMetaPlugins.size() > 1);
}
Aggregations