Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dependency): upgrade pf4j to 3.10.0 #5621

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ dependencies {
compileOnly group: 'javax.portlet', name: 'portlet-api', version: '3.0.1'

compile "io.vavr:vavr:0.9.2"
compile group: 'org.pf4j', name: 'pf4j', version: '2.5.0'
compile group: 'org.pf4j', name: 'pf4j', version: '3.10.0',{
exclude group: 'org.slf4j'
}

testImplementation group: 'org.springframework', name: 'spring-test', version: '5.2.0.RELEASE'
testImplementation group: 'org.springframework', name: 'spring-web', version: '5.2.0.RELEASE'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package org.tron.common.logsfilter;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.tron.common.logsfilter.trigger.BlockLogTrigger;
import org.tron.common.logsfilter.trigger.TransactionLogTrigger;

public class EventLoaderTest {

@ClassRule
public static final TemporaryFolder temporaryFolder = new TemporaryFolder();

@Test
public void launchNativeQueue() {
EventPluginConfig config = new EventPluginConfig();
Expand All @@ -31,6 +42,29 @@ public void launchNativeQueue() {
EventPluginLoader.getInstance().stopPlugin();
}

@Test
public void testPluginManager() throws IOException {
EventPluginConfig config = new EventPluginConfig();
config.setUseNativeQueue(false);
config.setPluginPath(temporaryFolder.newFolder() + "/testPlugin.zip");
createPluginInPath(config.getPluginPath());
Assert.assertThrows(Exception.class, () -> EventPluginLoader.getInstance().start(config));
}

private void createPluginInPath(String pluginPath) {
String fileName = "../testPlugin.zip";
try (ZipOutputStream zipOutputStream = new ZipOutputStream(
Files.newOutputStream(Paths.get(pluginPath)))) {
ZipEntry zipEntry = new ZipEntry(fileName);
zipOutputStream.putNextEntry(zipEntry);
zipOutputStream.write("".getBytes());
zipOutputStream.closeEntry();
} catch (IOException e) {
throw new RuntimeException(e);
}
}


@Test
public void testBlockLogTrigger() {
BlockLogTrigger blt = new BlockLogTrigger();
Expand Down