@RunWith(Theories.class) public class BufferExpansionTest { @DataPoint public static final MutableDirectBuffer EXPANDABLE_ARRAY_BUFFER = new ExpandableArrayBuffer(); @DataPoint public static final MutableDirectBuffer EXPANDABLE_DIRECT_BYTE_BUFFER = new ExpandableDirectByteBuffer(); @Theory public void shouldExpand(final MutableDirectBuffer buffer) { final int capacity = buffer.capacity(); final int index = capacity + 50; final int value = 777; buffer.putInt(index, value); assertThat(buffer.capacity(), greaterThan(capacity)); assertThat(buffer.getInt(index), is(value)); } }
@Override public Object getValue() throws CouldNotGenerateValueException { try { return method.invokeExplosively(null); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (Throwable throwable) { DataPoint annotation = method.getAnnotation(DataPoint.class); Assume.assumeTrue(annotation == null || !isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)); throw new CouldNotGenerateValueException(throwable); } }
@Override protected Collection<Field> getSingleDataPointFields(ParameterSignature sig) { Collection<Field> fields = super.getSingleDataPointFields(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<Field> fieldsWithMatchingNames = new ArrayList<Field>(); for (Field field : fields) { String[] fieldNames = field.getAnnotation(DataPoint.class).value(); if (Arrays.asList(fieldNames).contains(requestedName)) { fieldsWithMatchingNames.add(field); } } return fieldsWithMatchingNames; }
@Override protected Collection<FrameworkMethod> getSingleDataPointMethods(ParameterSignature sig) { Collection<FrameworkMethod> methods = super.getSingleDataPointMethods(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>(); for (FrameworkMethod method : methods) { String[] methodNames = method.getAnnotation(DataPoint.class).value(); if (Arrays.asList(methodNames).contains(requestedName)) { methodsWithMatchingNames.add(method); } } return methodsWithMatchingNames; }
@Override public Object getValue() throws CouldNotGenerateValueException { try { return method.invokeExplosively(null); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (Throwable throwable) { DataPoint annotation = method.getAnnotation(DataPoint.class); Assume.assumeTrue(annotation == null || !isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)); throw new CouldNotGenerateValueException(throwable); } }
private MaterialConfigConverter materialConfigConverter = new MaterialConfigConverter(); @DataPoint public static MaterialConfig gitMaterialConfig = new GitMaterialConfig(url("git-url"), "branch", "submodule", true, filterFor("*.doc"), false, "folder", cis("gitMaterial"), false); @DataPoint public static MaterialConfig hgMaterialConfig = new HgMaterialConfig(new HgUrlArgument("hg-url"), true, filterFor("*.png"), false, "folder", cis("hgMaterial")); @DataPoint public static MaterialConfig svnMaterialConfig = new SvnMaterialConfig(url("svn-url"), "user", "pass", true, new GoCipher(), true, filterFor("*.txt"), false, "folder", cis("name1")); @DataPoint public static MaterialConfig p4MaterialConfig = new P4MaterialConfig("localhost:9090", "user", "pass", true, "view", new GoCipher(), cis("p4Material"), true, filterFor("*.jpg"), false, "folder"); @DataPoint public static MaterialConfig tfsMaterialConfig = new TfsMaterialConfig(url("tfs-url"), "user", "domain", "pass", "prj-path", new GoCipher(), true, filterFor("*.txt"), false, "folder", cis("tfsMaterial")); @DataPoint public static MaterialConfig pkgMaterialConfig = new PackageMaterialConfig(cis("name"), "pkg-id", packageDefinition); @DataPoint public static MaterialConfig pluggableSCMMaterialConfig = new PluggableSCMMaterialConfig(cis("name"), scmConfig, "folder", filterFor("*.txt")); @DataPoint public static MaterialConfig dependencyMaterialConfig = new DependencyMaterialConfig(cis("name1"), cis("pipeline1"), cis("stage1"));
@Override protected Collection<Field> getSingleDataPointFields(ParameterSignature sig) { Collection<Field> fields = super.getSingleDataPointFields(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<Field> fieldsWithMatchingNames = new ArrayList<Field>(); for (Field field : fields) { String[] fieldNames = field.getAnnotation(DataPoint.class).value(); if (Arrays.asList(fieldNames).contains(requestedName)) { fieldsWithMatchingNames.add(field); } } return fieldsWithMatchingNames; }
@Override public Object getValue() throws CouldNotGenerateValueException { try { return method.invokeExplosively(null); } catch (IllegalArgumentException e) { throw new RuntimeException( "unexpected: argument length is checked"); } catch (IllegalAccessException e) { throw new RuntimeException( "unexpected: getMethods returned an inaccessible method"); } catch (Throwable throwable) { DataPoint annotation = method.getAnnotation(DataPoint.class); Assume.assumeTrue(annotation == null || !isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)); throw new CouldNotGenerateValueException(throwable); } }
@RunWith(Theories.class) public class ExclusivePublicationTest @DataPoint public static final String MULTICAST_CHANNEL = "aeron:udp?endpoint=224.20.30.39:54326|interface=localhost"; @DataPoint public static final String UNICAST_CHANNEL = "aeron:udp?endpoint=localhost:54325"; @DataPoint public static final String IPC_CHANNEL = CommonContext.IPC_CHANNEL;
@Override protected Collection<Field> getSingleDataPointFields(ParameterSignature sig) { Collection<Field> fields = super.getSingleDataPointFields(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<Field> fieldsWithMatchingNames = new ArrayList<Field>(); for (Field field : fields) { String[] fieldNames = field.getAnnotation(DataPoint.class).value(); if (Arrays.asList(fieldNames).contains(requestedName)) { fieldsWithMatchingNames.add(field); } } return fieldsWithMatchingNames; }
@RunWith(Theories.class) public class FragmentedMessageTest @DataPoint public static final String IPC_CHANNEL = CommonContext.IPC_CHANNEL; @DataPoint public static final String UNICAST_CHANNEL = "aeron:udp?endpoint=localhost:54325"; @DataPoint public static final String MULTICAST_CHANNEL = "aeron:udp?endpoint=224.20.30.39:54326|interface=localhost";
@Override protected Collection<FrameworkMethod> getSingleDataPointMethods(ParameterSignature sig) { Collection<FrameworkMethod> methods = super.getSingleDataPointMethods(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>(); for (FrameworkMethod method : methods) { String[] methodNames = method.getAnnotation(DataPoint.class).value(); if (Arrays.asList(methodNames).contains(requestedName)) { methodsWithMatchingNames.add(method); } } return methodsWithMatchingNames; }
@DataPoint public static ValueProducer<PrimitiveIntSet> intV = new ValueProducer<PrimitiveIntSet>( PrimitiveIntSet.class ) @DataPoint public static ValueProducer<PrimitiveLongSet> longV = new ValueProducer<PrimitiveLongSet>( PrimitiveLongSet.class ) @DataPoint public static ValueProducer<PrimitiveIntLongMap> intLongV = new ValueProducer<PrimitiveIntLongMap>( PrimitiveIntLongMap.class ) @DataPoint public static ValueProducer<PrimitiveLongIntMap> longIntV = new ValueProducer<PrimitiveLongIntMap>( PrimitiveLongIntMap.class ) @DataPoint public static ValueProducer<PrimitiveLongLongMap> longLongV = new ValueProducer<PrimitiveLongLongMap>( PrimitiveLongLongMap.class ) @DataPoint public static ValueProducer<PrimitiveIntObjectMap> intObjV = new ValueProducer<PrimitiveIntObjectMap>( PrimitiveIntObjectMap.class ) @DataPoint public static ValueProducer<PrimitiveLongObjectMap> longObjV = new ValueProducer<PrimitiveLongObjectMap>( PrimitiveLongObjectMap.class ) @DataPoint public static Factory<PrimitiveIntSet> intSet = Primitive::intSet;
@Override protected Collection<FrameworkMethod> getSingleDataPointMethods(ParameterSignature sig) { Collection<FrameworkMethod> methods = super.getSingleDataPointMethods(sig); String requestedName = sig.getAnnotation(FromDataPoints.class).value(); List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>(); for (FrameworkMethod method : methods) { String[] methodNames = method.getAnnotation(DataPoint.class).value(); if (Arrays.asList(methodNames).contains(requestedName)) { methodsWithMatchingNames.add(method); } } return methodsWithMatchingNames; }
private static final int INDEX = 8; @DataPoint public static final MutableDirectBuffer ARRAY_BUFFER = new UnsafeBuffer( new byte[BUFFER_CAPACITY], 0, BUFFER_CAPACITY); @DataPoint public static final MutableDirectBuffer DIRECT_BYTE_BUFFER = new UnsafeBuffer( ByteBuffer.allocateDirect(BUFFER_CAPACITY), 0, BUFFER_CAPACITY); @DataPoint public static final MutableDirectBuffer EXPANDABLE_ARRAY_BUFFER = new ExpandableArrayBuffer(BUFFER_CAPACITY); @DataPoint public static final MutableDirectBuffer EXPANDABLE_DIRECT_BYTE_BUFFER = new ExpandableDirectByteBuffer(BUFFER_CAPACITY);