org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShort Java Examples

The following examples show how to use org.apache.flink.graph.drivers.transform.GraphKeyTypeTransform.LongValueToUnsignedShort. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphKeyTypeTransformTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testToShort() throws Exception {
	TranslateFunction<LongValue, Short> translator = new LongValueToUnsignedShort();

	Assert.assertEquals(Short.valueOf((short) 0),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Short.valueOf(Short.MIN_VALUE),
		translator.translate(new LongValue((long) Short.MAX_VALUE + 1), null));

	Assert.assertEquals(Short.valueOf((short) -1),
		translator.translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1), null));
}
 
Example #2
Source File: GraphKeyTypeTransformTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromShort() throws Exception {
	TranslateFunction<Short, LongValueWithProperHashCode> translator = new UnsignedShortToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate((short) 0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Short.MAX_VALUE + 1),
		translator.translate(Short.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1),
		translator.translate((short) -1, longValueWithProperHashCode));
}
 
Example #3
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testToShort() throws Exception {
	TranslateFunction<LongValue, Short> translator = new LongValueToUnsignedShort();

	Assert.assertEquals(Short.valueOf((short) 0),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Short.valueOf(Short.MIN_VALUE),
		translator.translate(new LongValue((long) Short.MAX_VALUE + 1), null));

	Assert.assertEquals(Short.valueOf((short) -1),
		translator.translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1), null));
}
 
Example #4
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromShort() throws Exception {
	TranslateFunction<Short, LongValueWithProperHashCode> translator = new UnsignedShortToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate((short) 0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Short.MAX_VALUE + 1),
		translator.translate(Short.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1),
		translator.translate((short) -1, longValueWithProperHashCode));
}
 
Example #5
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testToShort() throws Exception {
	TranslateFunction<LongValue, Short> translator = new LongValueToUnsignedShort();

	Assert.assertEquals(Short.valueOf((short) 0),
		translator.translate(new LongValue(0L), null));

	Assert.assertEquals(Short.valueOf(Short.MIN_VALUE),
		translator.translate(new LongValue((long) Short.MAX_VALUE + 1), null));

	Assert.assertEquals(Short.valueOf((short) -1),
		translator.translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1), null));
}
 
Example #6
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testFromShort() throws Exception {
	TranslateFunction<Short, LongValueWithProperHashCode> translator = new UnsignedShortToLongValueWithProperHashCode();

	Assert.assertEquals(new LongValueWithProperHashCode(0L),
		translator.translate((short) 0, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(Short.MAX_VALUE + 1),
		translator.translate(Short.MIN_VALUE, longValueWithProperHashCode));

	Assert.assertEquals(new LongValueWithProperHashCode(LongValueToUnsignedShort.MAX_VERTEX_COUNT - 1),
		translator.translate((short) -1, longValueWithProperHashCode));
}
 
Example #7
Source File: GraphKeyTypeTransformTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortUpperOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT), null);
}
 
Example #8
Source File: GraphKeyTypeTransformTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortLowerOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(-1), null);
}
 
Example #9
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortUpperOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT), null);
}
 
Example #10
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortLowerOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(-1), null);
}
 
Example #11
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortUpperOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(LongValueToUnsignedShort.MAX_VERTEX_COUNT), null);
}
 
Example #12
Source File: GraphKeyTypeTransformTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testToShortLowerOutOfRange() throws Exception {
	new LongValueToUnsignedShort().translate(new LongValue(-1), null);
}