Skip to content

Commit

Permalink
[tests] Minor cleanup removing duplicate mock invokables in various t…
Browse files Browse the repository at this point in the history
…ests.
  • Loading branch information
StephanEwen committed Aug 18, 2015
1 parent 8a59f87 commit 8602b7a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Random;

import org.apache.flink.runtime.operators.testutils.DummyInvokable;
import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
Expand All @@ -34,7 +35,6 @@
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable;
import org.apache.flink.runtime.memory.MemoryManagerTest;
import org.apache.flink.runtime.memorymanager.DefaultMemoryManager;

/**
Expand Down Expand Up @@ -82,7 +82,7 @@ public void afterTest() throws Exception {
@SuppressWarnings("unchecked")
public void parallelChannelsTest() throws Exception {
final Random rnd = new Random(SEED);
final AbstractInvokable memOwner = new MemoryManagerTest.DummyInvokable();
final AbstractInvokable memOwner = new DummyInvokable();

FileIOChannel.ID[] ids = new FileIOChannel.ID[NUM_CHANNELS];
BlockChannelWriter<MemorySegment>[] writers = new BlockChannelWriter[NUM_CHANNELS];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,19 @@
import java.nio.channels.FileChannel;
import java.util.List;

import org.apache.flink.runtime.operators.testutils.DummyInvokable;
import org.apache.flink.types.IntValue;
import org.junit.Assert;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.flink.core.memory.InputViewDataInputStreamWrapper;
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.core.memory.OutputViewDataOutputStreamWrapper;
import org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable;
import org.apache.flink.runtime.memory.MemoryManagerTest;
import org.apache.flink.runtime.memorymanager.DefaultMemoryManager;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -62,7 +64,7 @@ public class IOManagerPerformanceBenchmark {
private static final int NUM_INTS_WRITTEN = 100000000;


private static final AbstractInvokable memoryOwner = new MemoryManagerTest.DummyInvokable();
private static final AbstractInvokable memoryOwner = new DummyInvokable();

private DefaultMemoryManager memManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable;
import org.apache.flink.runtime.memorymanager.DefaultMemoryManager;
import org.apache.flink.runtime.memorymanager.MemoryAllocationException;
import org.apache.flink.runtime.operators.testutils.DummyInvokable;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -195,15 +197,4 @@ private boolean allMemorySegmentsFreed(List<MemorySegment> memSegs) {
}
return true;
}

/**
* Utility class to serve as owner for the memory.
*/
public static final class DummyInvokable extends AbstractInvokable {
@Override
public void registerInputOutput() {}

@Override
public void invoke() throws Exception {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.flink.runtime.memorymanager.DefaultMemoryManager;
import org.apache.flink.runtime.memorymanager.MemoryAllocationException;

import org.apache.flink.runtime.operators.testutils.DummyInvokable;
import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -194,15 +195,4 @@ private boolean allMemorySegmentsFreed(List<MemorySegment> memSegs) {
}
return true;
}

/**
* Utility class to serve as owner for the memory.
*/
public static final class DummyInvokable extends AbstractInvokable {
@Override
public void registerInputOutput() {}

@Override
public void invoke() throws Exception {}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.nio.ByteBuffer;
import java.util.Random;

import org.apache.flink.runtime.operators.testutils.DummyInvokable;
import org.junit.Assert;
import org.apache.flink.core.memory.MemorySegment;
import org.apache.flink.runtime.memorymanager.DefaultMemoryManager;
Expand All @@ -52,7 +53,7 @@ public class MemorySegmentTest {
public void setUp() throws Exception{
try {
this.manager = new DefaultMemoryManager(MANAGED_MEMORY_SIZE, 1, PAGE_SIZE, true);
this.segment = manager.allocatePages(new MemoryManagerTest.DummyInvokable(), 1).get(0);
this.segment = manager.allocatePages(new DummyInvokable(), 1).get(0);
this.random = new Random(RANDOM_SEED);
} catch (Exception e) {
e.printStackTrace();
Expand Down

0 comments on commit 8602b7a

Please sign in to comment.