Skip to content

Commit

Permalink
Move non-tests out of the stormpot test package
Browse files Browse the repository at this point in the history
The `stormpot` test package now only contain tests that rely on implementation details.
  • Loading branch information
chrisvest committed Jul 6, 2024
1 parent 40ec15d commit feb682c
Show file tree
Hide file tree
Showing 31 changed files with 197 additions and 161 deletions.
24 changes: 12 additions & 12 deletions src/test/java/blackbox/AbstractPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import stormpot.Completion;
import stormpot.ExpectedException;
import testkits.ExpectedException;
import stormpot.Expiration;
import stormpot.ManagedPool;
import stormpot.Pool;
Expand Down Expand Up @@ -54,17 +54,17 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static stormpot.UnitKit.$await;
import static stormpot.UnitKit.$catchFrom;
import static stormpot.UnitKit.$claim;
import static stormpot.UnitKit.$claimRelease;
import static stormpot.UnitKit.$interruptUponState;
import static stormpot.UnitKit.capture;
import static stormpot.UnitKit.fork;
import static stormpot.UnitKit.forkFuture;
import static stormpot.UnitKit.join;
import static stormpot.UnitKit.spinwait;
import static stormpot.UnitKit.waitForThreadState;
import static testkits.UnitKit.$await;
import static testkits.UnitKit.$catchFrom;
import static testkits.UnitKit.$claim;
import static testkits.UnitKit.$claimRelease;
import static testkits.UnitKit.$interruptUponState;
import static testkits.UnitKit.capture;
import static testkits.UnitKit.fork;
import static testkits.UnitKit.forkFuture;
import static testkits.UnitKit.join;
import static testkits.UnitKit.spinwait;
import static testkits.UnitKit.waitForThreadState;

@Execution(ExecutionMode.CONCURRENT)
@org.junit.jupiter.api.Timeout(42)
Expand Down
78 changes: 39 additions & 39 deletions src/test/java/blackbox/AllocatorBasedPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import stormpot.AlloKit;
import testkits.AlloKit;
import stormpot.Allocator;
import stormpot.Completion;
import stormpot.Expiration;
import stormpot.FixedMeanMetricsRecorder;
import stormpot.GenericPoolable;
import stormpot.LastSampleMetricsRecorder;
import testkits.FixedMeanMetricsRecorder;
import testkits.GenericPoolable;
import testkits.LastSampleMetricsRecorder;
import stormpot.ManagedPool;
import stormpot.Pool;
import stormpot.PoolBuilder;
Expand All @@ -34,8 +34,8 @@
import stormpot.Poolable;
import stormpot.Reallocator;
import stormpot.Slot;
import stormpot.SomeRandomException;
import stormpot.SomeRandomThrowable;
import testkits.SomeRandomException;
import testkits.SomeRandomThrowable;
import stormpot.Timeout;

import java.lang.ref.WeakReference;
Expand All @@ -60,39 +60,39 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static stormpot.AlloKit.$countDown;
import static stormpot.AlloKit.$incrementAnd;
import static stormpot.AlloKit.$new;
import static stormpot.AlloKit.$null;
import static stormpot.AlloKit.$observeNull;
import static stormpot.AlloKit.$sleep;
import static stormpot.AlloKit.$sync;
import static stormpot.AlloKit.$throw;
import static stormpot.AlloKit.CountingAllocator;
import static stormpot.AlloKit.alloc;
import static stormpot.AlloKit.allocator;
import static stormpot.AlloKit.dealloc;
import static stormpot.AlloKit.realloc;
import static stormpot.AlloKit.reallocator;
import static stormpot.ExpireKit.$age;
import static stormpot.ExpireKit.$capture;
import static stormpot.ExpireKit.$claimCount;
import static stormpot.ExpireKit.$expired;
import static stormpot.ExpireKit.$expiredIf;
import static stormpot.ExpireKit.$explicitExpire;
import static stormpot.ExpireKit.$fresh;
import static stormpot.ExpireKit.$if;
import static stormpot.ExpireKit.$poolable;
import static stormpot.ExpireKit.$throwExpire;
import static stormpot.ExpireKit.CountingExpiration;
import static stormpot.ExpireKit.expire;
import static stormpot.UnitKit.$delayedReleases;
import static stormpot.UnitKit.claimRelease;
import static stormpot.UnitKit.fork;
import static stormpot.UnitKit.forkFuture;
import static stormpot.UnitKit.join;
import static stormpot.UnitKit.spinwait;
import static stormpot.UnitKit.waitForThreadState;
import static testkits.AlloKit.$countDown;
import static testkits.AlloKit.$incrementAnd;
import static testkits.AlloKit.$new;
import static testkits.AlloKit.$null;
import static testkits.AlloKit.$observeNull;
import static testkits.AlloKit.$sleep;
import static testkits.AlloKit.$sync;
import static testkits.AlloKit.$throw;
import static testkits.AlloKit.CountingAllocator;
import static testkits.AlloKit.alloc;
import static testkits.AlloKit.allocator;
import static testkits.AlloKit.dealloc;
import static testkits.AlloKit.realloc;
import static testkits.AlloKit.reallocator;
import static testkits.ExpireKit.$age;
import static testkits.ExpireKit.$capture;
import static testkits.ExpireKit.$claimCount;
import static testkits.ExpireKit.$expired;
import static testkits.ExpireKit.$expiredIf;
import static testkits.ExpireKit.$explicitExpire;
import static testkits.ExpireKit.$fresh;
import static testkits.ExpireKit.$if;
import static testkits.ExpireKit.$poolable;
import static testkits.ExpireKit.$throwExpire;
import static testkits.ExpireKit.CountingExpiration;
import static testkits.ExpireKit.expire;
import static testkits.UnitKit.$delayedReleases;
import static testkits.UnitKit.claimRelease;
import static testkits.UnitKit.fork;
import static testkits.UnitKit.forkFuture;
import static testkits.UnitKit.join;
import static testkits.UnitKit.spinwait;
import static testkits.UnitKit.waitForThreadState;

/**
* This is the generic test for Pool implementations. The test ensures that
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/blackbox/DefaultPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package blackbox;

import stormpot.AlloKit;
import stormpot.GenericPoolable;
import testkits.AlloKit;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/blackbox/ExpirationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

import org.junit.jupiter.api.Test;
import stormpot.Expiration;
import stormpot.GenericPoolable;
import testkits.GenericPoolable;
import stormpot.Poolable;
import stormpot.SlotInfo;
import stormpot.SlotInfoStub;
import testkits.SlotInfoStub;

import java.util.Iterator;
import java.util.LinkedList;
Expand All @@ -36,9 +36,9 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static stormpot.ExpireKit.$expired;
import static stormpot.ExpireKit.$fresh;
import static stormpot.ExpireKit.expire;
import static testkits.ExpireKit.$expired;
import static testkits.ExpireKit.$fresh;
import static testkits.ExpireKit.expire;

class ExpirationTest {
@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/blackbox/InlinePoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
package blackbox;

import org.junit.jupiter.api.Test;
import stormpot.AlloKit.CountingAllocator;
import stormpot.GenericPoolable;
import testkits.AlloKit.CountingAllocator;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;

Expand Down
14 changes: 7 additions & 7 deletions src/test/java/blackbox/PoolBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import stormpot.AlloKit;
import testkits.AlloKit;
import stormpot.Allocator;
import stormpot.Expiration;
import stormpot.ExpireKit;
import stormpot.FixedMeanMetricsRecorder;
import stormpot.GenericPoolable;
import stormpot.LastSampleMetricsRecorder;
import testkits.ExpireKit;
import testkits.FixedMeanMetricsRecorder;
import testkits.GenericPoolable;
import testkits.LastSampleMetricsRecorder;
import stormpot.MetricsRecorder;
import stormpot.Pool;
import stormpot.PoolBuilder;
Expand All @@ -39,8 +39,8 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static stormpot.AlloKit.CountingAllocator;
import static stormpot.AlloKit.allocator;
import static testkits.AlloKit.CountingAllocator;
import static testkits.AlloKit.allocator;

class PoolBuilderTest {
private Allocator<GenericPoolable> allocator;
Expand Down
54 changes: 27 additions & 27 deletions src/test/java/blackbox/ThreadBasedPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
import stormpot.ExpireKit;
import stormpot.GenericPoolable;
import stormpot.LastSampleMetricsRecorder;
import testkits.ExpireKit;
import testkits.GenericPoolable;
import testkits.LastSampleMetricsRecorder;
import stormpot.ManagedPool;
import stormpot.Pool;
import stormpot.PoolBuilder;
Expand All @@ -46,30 +46,30 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import static stormpot.AlloKit.$acquire;
import static stormpot.AlloKit.$countDown;
import static stormpot.AlloKit.$if;
import static stormpot.AlloKit.$new;
import static stormpot.AlloKit.$null;
import static stormpot.AlloKit.$throw;
import static stormpot.AlloKit.Action;
import static stormpot.AlloKit.CountingReallocator;
import static stormpot.AlloKit.alloc;
import static stormpot.AlloKit.allocator;
import static stormpot.AlloKit.realloc;
import static stormpot.AlloKit.reallocator;
import static stormpot.ExpireKit.$countDown;
import static stormpot.ExpireKit.$expired;
import static stormpot.ExpireKit.$expiredIf;
import static stormpot.ExpireKit.$fresh;
import static stormpot.ExpireKit.$throwExpire;
import static stormpot.ExpireKit.CountingExpiration;
import static stormpot.ExpireKit.expire;
import static stormpot.UnitKit.$claim;
import static stormpot.UnitKit.$claimRelease;
import static stormpot.UnitKit.capture;
import static stormpot.UnitKit.forkFuture;
import static stormpot.UnitKit.spinwait;
import static testkits.AlloKit.$acquire;
import static testkits.AlloKit.$countDown;
import static testkits.AlloKit.$if;
import static testkits.AlloKit.$new;
import static testkits.AlloKit.$null;
import static testkits.AlloKit.$throw;
import static testkits.AlloKit.Action;
import static testkits.AlloKit.CountingReallocator;
import static testkits.AlloKit.alloc;
import static testkits.AlloKit.allocator;
import static testkits.AlloKit.realloc;
import static testkits.AlloKit.reallocator;
import static testkits.ExpireKit.$countDown;
import static testkits.ExpireKit.$expired;
import static testkits.ExpireKit.$expiredIf;
import static testkits.ExpireKit.$fresh;
import static testkits.ExpireKit.$throwExpire;
import static testkits.ExpireKit.CountingExpiration;
import static testkits.ExpireKit.expire;
import static testkits.UnitKit.$claim;
import static testkits.UnitKit.$claimRelease;
import static testkits.UnitKit.capture;
import static testkits.UnitKit.forkFuture;
import static testkits.UnitKit.spinwait;

abstract class ThreadBasedPoolTest extends AllocatorBasedPoolTest {

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/blackbox/ThreadedPoolTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package blackbox;

import stormpot.AlloKit;
import stormpot.GenericPoolable;
import testkits.AlloKit;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/blackbox/simulations/Sim.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.HdrHistogram.Histogram;
import stormpot.Expiration;
import stormpot.GenericPoolable;
import testkits.GenericPoolable;
import stormpot.ManagedPool;
import stormpot.MetricsRecorder;
import stormpot.Pool;
Expand All @@ -44,10 +44,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import static stormpot.AlloKit.$new;
import static stormpot.AlloKit.CountingAllocator;
import static stormpot.AlloKit.alloc;
import static stormpot.AlloKit.allocator;
import static testkits.AlloKit.$new;
import static testkits.AlloKit.CountingAllocator;
import static testkits.AlloKit.alloc;
import static testkits.AlloKit.allocator;

public abstract class Sim {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package blackbox.simulations;

import stormpot.Expiration;
import stormpot.GenericPoolable;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.Timeout;

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/blackbox/slow/DefaultPoolIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package blackbox.slow;

import stormpot.AlloKit;
import stormpot.GenericPoolable;
import testkits.AlloKit;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/blackbox/slow/InlinePoolIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package blackbox.slow;

import stormpot.AlloKit;
import stormpot.GenericPoolable;
import testkits.AlloKit;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;

Expand Down
26 changes: 13 additions & 13 deletions src/test/java/blackbox/slow/PoolIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.extension.RegisterExtension;
import stormpot.Completion;
import stormpot.GenericPoolable;
import testkits.GenericPoolable;
import stormpot.Pool;
import stormpot.PoolBuilder;
import stormpot.PoolException;
import stormpot.Slot;
import stormpot.SomeRandomException;
import testkits.SomeRandomException;
import stormpot.Timeout;

import java.util.ArrayList;
Expand All @@ -50,17 +50,17 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static stormpot.AlloKit.$countDown;
import static stormpot.AlloKit.$new;
import static stormpot.AlloKit.$null;
import static stormpot.AlloKit.$release;
import static stormpot.AlloKit.Action;
import static stormpot.AlloKit.CountingAllocator;
import static stormpot.AlloKit.alloc;
import static stormpot.AlloKit.allocator;
import static stormpot.AlloKit.dealloc;
import static stormpot.AlloKit.realloc;
import static stormpot.AlloKit.reallocator;
import static testkits.AlloKit.$countDown;
import static testkits.AlloKit.$new;
import static testkits.AlloKit.$null;
import static testkits.AlloKit.$release;
import static testkits.AlloKit.Action;
import static testkits.AlloKit.CountingAllocator;
import static testkits.AlloKit.alloc;
import static testkits.AlloKit.allocator;
import static testkits.AlloKit.dealloc;
import static testkits.AlloKit.realloc;
import static testkits.AlloKit.reallocator;

@SuppressWarnings("unchecked")
@ExtendWith(FailurePrinterExtension.class)
Expand Down
Loading

0 comments on commit feb682c

Please sign in to comment.