Skip to content

Commit

Permalink
feat(dependency): upgrade pf4j to 3.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
morgan.peng committed Dec 15, 2023
1 parent 5815337 commit 3c23401
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
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

0 comments on commit 3c23401

Please sign in to comment.