You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by mw...@apache.org on 2017/02/24 04:50:14 UTC
eagle git commit: [MINOR] fix unit test cases to get rid of creating
file.bin in code [Forced Update!]
Repository: eagle
Updated Branches:
refs/heads/master 98926d520 -> 086d11e1d (forced update)
[MINOR] fix unit test cases to get rid of creating file.bin in code
Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/086d11e1
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/086d11e1
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/086d11e1
Branch: refs/heads/master
Commit: 086d11e1ddc0f00f5209d4b74086dd6a920eaa85
Parents: 5ec75f2
Author: Hao Chen <ha...@apache.org>
Authored: Fri Feb 24 12:33:59 2017 +0800
Committer: anyway1021 <mw...@apache.org>
Committed: Fri Feb 24 12:47:08 2017 +0800
----------------------------------------------------------------------
.../eagle/alert/engine/perf/TestSerDeserPer.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/eagle/blob/086d11e1/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/perf/TestSerDeserPer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/perf/TestSerDeserPer.java b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/perf/TestSerDeserPer.java
index 77ab9c3..82d8c99 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/perf/TestSerDeserPer.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/perf/TestSerDeserPer.java
@@ -19,14 +19,15 @@ package org.apache.eagle.alert.engine.perf;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
-import org.apache.commons.io.FilenameUtils;
import org.apache.eagle.alert.engine.coordinator.StreamPartition;
import org.apache.eagle.alert.engine.coordinator.StreamSortSpec;
import org.apache.eagle.alert.engine.model.PartitionedEvent;
import org.apache.eagle.alert.engine.model.StreamEvent;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -38,6 +39,9 @@ import java.util.List;
* Since 5/13/16.
*/
public class TestSerDeserPer {
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
Object[] data = null;
@Before
@@ -50,14 +54,10 @@ public class TestSerDeserPer {
data = new Object[] {sb.toString()};
}
- private String getTmpPath() {
- return System.getProperty("java.io.tmpdir");
- }
-
@Test
public void testSerDeserPerf() throws Exception {
Kryo kryo = new Kryo();
- String outputPath = FilenameUtils.concat(getTmpPath(), "file.bin");
+ String outputPath = temporaryFolder.newFile().toString();
Output output = new Output(new FileOutputStream(outputPath));
for (int i = 0; i < 1000; i++) {
kryo.writeObject(output, constructPE());
@@ -94,7 +94,7 @@ public class TestSerDeserPer {
@Test
public void testSerDeserPerf2() throws Exception {
Kryo kryo = new Kryo();
- String outputPath = FilenameUtils.concat(getTmpPath(), "file2.bin");
+ String outputPath = temporaryFolder.newFile().toString();
Output output = new Output(new FileOutputStream(outputPath));
for (int i = 0; i < 1000; i++) {
kryo.writeObject(output, constructNewPE());
@@ -126,7 +126,7 @@ public class TestSerDeserPer {
@Test
public void testSerDeserPerf3() throws Exception {
Kryo kryo = new Kryo();
- String outputPath = FilenameUtils.concat(getTmpPath(), "file3.bin");
+ String outputPath = temporaryFolder.newFile().toString();
Output output = new Output(new FileOutputStream(outputPath));
for (int i = 0; i < 1000; i++) {
kryo.writeObject(output, constructNewPE2());