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:43:22 UTC
eagle git commit: [minnor] fix unit test cases to get rid of creating
file.bin in code
Repository: eagle
Updated Branches:
refs/heads/master 5ec75f2ab -> 98926d520
[minnor] 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/98926d52
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/98926d52
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/98926d52
Branch: refs/heads/master
Commit: 98926d520e1f568778403b1a5c1c2b47c89b6f6c
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:42:53 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/98926d52/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());