use of org.jmeterplugins.repository.PluginManager in project jmeter-plugins-manager by undera.
the class LoggerAppenderTest method testFlow.
@Test
public void testFlow() throws Exception {
PluginManager pmgr = new PluginManager();
LoggerAppender appender = new LoggerAppender("test-appender", pmgr);
PluginSuggester suggester = new PluginSuggester(pmgr);
appender.setSuggester(suggester);
assertEquals(suggester, appender.getSuggester());
Log4jLogEvent.Builder builder = Log4jLogEvent.newBuilder();
builder.setMessage(new MessageFormatMessage("Save file"));
builder.setLoggerName("SaveService");
appender.append(builder.build());
LoggerAppender.SaveServiceFilter filter = new LoggerAppender.SaveServiceFilter(Filter.Result.ACCEPT, Filter.Result.DENY);
assertEquals(Filter.Result.ACCEPT, filter.filter(builder.build()));
builder.setLoggerName("SomeLogger");
assertEquals(Filter.Result.DENY, filter.filter(builder.build()));
}
use of org.jmeterplugins.repository.PluginManager in project jmeter-plugins-manager by undera.
the class PluginSuggesterTest method testSuggest.
@Test
public void testSuggest() throws Throwable {
URL repo = PluginManagerTest.class.getResource("/suggest.json");
JMeterUtils.setProperty("jpgc.repo.address", repo.getPath());
PluginManager pmgr = new PluginManager();
pmgr.load();
PluginSuggester suggester = new PluginSuggester(pmgr);
TestPlanAnalyzer analyzer = new TestPlanAnalyzer();
suggester.setAnalyzer(analyzer);
assertEquals(analyzer, suggester.getAnalyzer());
URL testPlan = PluginManagerTest.class.getResource("/testplan.xml");
Set<Plugin> plugins = suggester.findPluginsToInstall("Loading file : " + testPlan.getPath());
assertEquals(1, plugins.size());
assertEquals("jpgc-plugin2", plugins.toArray(new Plugin[1])[0].getID());
Set<String> classes = new HashSet<>();
classes.add("kg.apc.jmeter.samplers.DummySamplerGui");
plugins = suggester.findPluginsFromClasses(classes);
assertEquals(1, plugins.size());
assertEquals("jpgc-plugin2", plugins.toArray(new Plugin[1])[0].getID());
pmgr.togglePlugins(pmgr.getAvailablePlugins(), true);
String msg = pmgr.getChangesAsText();
assertTrue(msg.contains("jpgc-plugin1"));
assertTrue(msg.contains("jpgc-plugin2"));
}
use of org.jmeterplugins.repository.PluginManager in project jmeter-plugins-manager by undera.
the class LoggingHookerTest method testFlowOld.
/**
* For logging in JMeter 2.13-3.1
*/
@Test
public void testFlowOld() throws Exception {
LoggingHooker hooker = new LoggingHooker(new PluginManager());
hooker.hook();
assertFalse(hooker.isJMeter32orLater());
}
use of org.jmeterplugins.repository.PluginManager in project jmeter-plugins-manager by undera.
the class PluginSuggesterTest method testFlow.
@Test
public void testFlow() throws Throwable {
if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
URL repo = PluginManagerTest.class.getResource("/suggest.json");
URL testPlan = PluginManagerTest.class.getResource("/testplan.xml");
JMeterUtils.setProperty("jpgc.repo.address", repo.getPath());
PluginManager pmgr = new PluginManager();
pmgr.load();
PluginSuggester suggester = new PluginSuggester(pmgr);
suggester.checkAndSuggest("Loading file : " + testPlan.getPath());
}
}
use of org.jmeterplugins.repository.PluginManager in project jmeter-plugins-manager by undera.
the class SuggestDialogTest method testComponent.
@Test
public void testComponent() throws Exception {
if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
PluginManager pmgr = new PluginManager();
SuggestDialog suggestDialog = new SuggestDialog(null, pmgr, pmgr.getAvailablePlugins(), "path");
suggestDialog.setVisible(true);
}
}
Aggregations