| 1 |
/************************************************************************ |
| 2 |
* Licensed under Public Domain (CC0) * |
| 3 |
* * |
| 4 |
* To the extent possible under law, the person who associated CC0 with * |
| 5 |
* this code has waived all copyright and related or neighboring * |
| 6 |
* rights to this code. * |
| 7 |
* * |
| 8 |
* You should have received a copy of the CC0 legalcode along with this * |
| 9 |
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.* |
| 10 |
************************************************************************/ |
| 11 |
|
| 12 |
package org.reactivestreams.tck.flow; |
| 13 |
|
| 14 |
import org.reactivestreams.FlowAdapters; |
| 15 |
import org.reactivestreams.example.unicast.AsyncIterablePublisher; |
| 16 |
import java.util.concurrent.Flow.Publisher; |
| 17 |
|
| 18 |
import org.reactivestreams.tck.TestEnvironment; |
| 19 |
import org.testng.annotations.AfterClass; |
| 20 |
import org.testng.annotations.BeforeClass; |
| 21 |
import org.testng.annotations.Test; |
| 22 |
|
| 23 |
import java.util.Collections; |
| 24 |
import java.util.concurrent.ExecutorService; |
| 25 |
import java.util.concurrent.Executors; |
| 26 |
|
| 27 |
@Test |
| 28 |
public class EmptyLazyFlowPublisherTest extends FlowPublisherVerification<Integer> { |
| 29 |
|
| 30 |
private ExecutorService ex; |
| 31 |
|
| 32 |
public EmptyLazyFlowPublisherTest() { |
| 33 |
super(new TestEnvironment()); |
| 34 |
} |
| 35 |
|
| 36 |
@BeforeClass |
| 37 |
void before() { ex = Executors.newFixedThreadPool(4); } |
| 38 |
|
| 39 |
@AfterClass |
| 40 |
void after() { if (ex != null) ex.shutdown(); } |
| 41 |
|
| 42 |
@Override |
| 43 |
public Publisher<Integer> createFlowPublisher(long elements) { |
| 44 |
return FlowAdapters.toFlowPublisher( |
| 45 |
new AsyncIterablePublisher<Integer>(Collections.<Integer>emptyList(), ex) |
| 46 |
); |
| 47 |
} |
| 48 |
|
| 49 |
@Override |
| 50 |
public Publisher<Integer> createFailedFlowPublisher() { |
| 51 |
return null; |
| 52 |
} |
| 53 |
|
| 54 |
@Override |
| 55 |
public long maxElementsFromPublisher() { |
| 56 |
return 0; |
| 57 |
} |
| 58 |
} |