Search in sources :

Example 1 with PluginSuggester

use of org.jmeterplugins.repository.plugins.PluginSuggester 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()));
}
Also used : PluginManager(org.jmeterplugins.repository.PluginManager) MessageFormatMessage(org.apache.logging.log4j.message.MessageFormatMessage) PluginSuggester(org.jmeterplugins.repository.plugins.PluginSuggester) Log4jLogEvent(org.apache.logging.log4j.core.impl.Log4jLogEvent) PluginManagerTest(org.jmeterplugins.repository.PluginManagerTest) Test(org.junit.Test)

Example 2 with PluginSuggester

use of org.jmeterplugins.repository.plugins.PluginSuggester in project jmeter-plugins-manager by undera.

the class PluginManagerCMD method installPluginsForJmx.

protected void installPluginsForJmx(ListIterator jmxFilesIterator) throws Throwable {
    if (!jmxFilesIterator.hasNext()) {
        throw new IllegalArgumentException("No jmx files specified");
    }
    String files = jmxFilesIterator.next().toString();
    PluginManager mgr = getPluginsManager();
    PluginSuggester suggester = new PluginSuggester(mgr);
    final Set<Plugin> pluginsToInstall = new HashSet<>();
    Set<String> jmxFiles = parseParams(files).keySet();
    for (String jmxPath : jmxFiles) {
        pluginsToInstall.addAll(suggester.analyzeTestPlan(jmxPath));
    }
    mgr.togglePlugins(pluginsToInstall, true);
    mgr.applyChanges(this, false, null);
}
Also used : PluginSuggester(org.jmeterplugins.repository.plugins.PluginSuggester)

Example 3 with PluginSuggester

use of org.jmeterplugins.repository.plugins.PluginSuggester in project jmeter-plugins-manager by undera.

the class LoggerPanelWrappingTest method testFlow.

@Test
public void testFlow() throws Exception {
    if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
        PluginManager pmgr = new PluginManager();
        LoggerPanelWrapping wrapping = new LoggerPanelWrapping(pmgr);
        PluginSuggester suggester = new PluginSuggester(pmgr);
        wrapping.setSuggester(suggester);
        assertEquals(suggester, wrapping.getSuggester());
        LogEvent event = new LogEvent();
        event.setCategory("SaveService");
        event.setMessage("Save File");
        wrapping.processEvent(event);
    }
}
Also used : PluginManager(org.jmeterplugins.repository.PluginManager) PluginSuggester(org.jmeterplugins.repository.plugins.PluginSuggester) LogEvent(org.apache.log.LogEvent) PluginManagerTest(org.jmeterplugins.repository.PluginManagerTest) Test(org.junit.Test)

Aggregations

PluginSuggester (org.jmeterplugins.repository.plugins.PluginSuggester)3 PluginManager (org.jmeterplugins.repository.PluginManager)2 PluginManagerTest (org.jmeterplugins.repository.PluginManagerTest)2 Test (org.junit.Test)2 LogEvent (org.apache.log.LogEvent)1 Log4jLogEvent (org.apache.logging.log4j.core.impl.Log4jLogEvent)1 MessageFormatMessage (org.apache.logging.log4j.message.MessageFormatMessage)1