Java Code Examples for org.apache.flink.util.StringUtils#hexStringToByte()

The following examples show how to use org.apache.flink.util.StringUtils#hexStringToByte() . 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: ClusterDataSetListResponseBodyTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testFrom() {
	final Map<IntermediateDataSetID, DataSetMetaInfo> originalDataSets = new HashMap<>();
	originalDataSets.put(new IntermediateDataSetID(), DataSetMetaInfo.withNumRegisteredPartitions(1, 2));
	originalDataSets.put(new IntermediateDataSetID(), DataSetMetaInfo.withNumRegisteredPartitions(2, 2));

	List<ClusterDataSetEntry> convertedDataSets = ClusterDataSetListResponseBody.from(originalDataSets).getDataSets();
	assertThat(convertedDataSets, hasSize(2));
	for (ClusterDataSetEntry convertedDataSet : convertedDataSets) {
		IntermediateDataSetID id = new IntermediateDataSetID(new AbstractID(StringUtils.hexStringToByte(convertedDataSet.getDataSetId())));

		DataSetMetaInfo dataSetMetaInfo = originalDataSets.get(id);

		assertThat(convertedDataSet.isComplete(), is(dataSetMetaInfo.getNumRegisteredPartitions().orElse(0) == dataSetMetaInfo.getNumTotalPartitions()));
	}
}
 
Example 2
Source File: JobID.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a JobID from the given string.
 *
 * @param hexString string representation of a JobID
 * @return Parsed JobID
 * @throws IllegalArgumentException if the JobID could not be parsed from the given string
 */
public static JobID fromHexString(String hexString) {
	try {
		return new JobID(StringUtils.hexStringToByte(hexString));
	} catch (Exception e) {
		throw new IllegalArgumentException("Cannot parse JobID from \"" + hexString + "\". The expected format is " +
			"[0-9a-fA-F]{32}, e.g. fd72014d4c864993a2e5a9287b4a9c5d.", e);
	}
}
 
Example 3
Source File: JobID.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a JobID from the given string.
 *
 * @param hexString string representation of a JobID
 * @return Parsed JobID
 * @throws IllegalArgumentException if the JobID could not be parsed from the given string
 */
public static JobID fromHexString(String hexString) {
	try {
		return new JobID(StringUtils.hexStringToByte(hexString));
	} catch (Exception e) {
		throw new IllegalArgumentException("Cannot parse JobID from \"" + hexString + "\". The expected format is " +
			"[0-9a-fA-F]{32}, e.g. fd72014d4c864993a2e5a9287b4a9c5d.", e);
	}
}
 
Example 4
Source File: JobID.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a JobID from the given string.
 *
 * @param hexString string representation of a JobID
 * @return Parsed JobID
 * @throws IllegalArgumentException if the JobID could not be parsed from the given string
 */
public static JobID fromHexString(String hexString) {
	try {
		return new JobID(StringUtils.hexStringToByte(hexString));
	} catch (Exception e) {
		throw new IllegalArgumentException("Cannot parse JobID from \"" + hexString + "\". The expected format is " +
			"[0-9a-fA-F]{32}, e.g. fd72014d4c864993a2e5a9287b4a9c5d.", e);
	}
}
 
Example 5
Source File: TriggerId.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public static TriggerId fromHexString(String hexString) {
	return new TriggerId(StringUtils.hexStringToByte(hexString));
}
 
Example 6
Source File: JobVertexID.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public static JobVertexID fromHexString(String hexString) {
	return new JobVertexID(StringUtils.hexStringToByte(hexString));
}
 
Example 7
Source File: TriggerId.java    From flink with Apache License 2.0 4 votes vote down vote up
public static TriggerId fromHexString(String hexString) {
	return new TriggerId(StringUtils.hexStringToByte(hexString));
}
 
Example 8
Source File: JobVertexID.java    From flink with Apache License 2.0 4 votes vote down vote up
public static JobVertexID fromHexString(String hexString) {
	return new JobVertexID(StringUtils.hexStringToByte(hexString));
}
 
Example 9
Source File: ClusterDataSetIdPathParameter.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected IntermediateDataSetID convertFromString(String value) {
	return new IntermediateDataSetID(new AbstractID(StringUtils.hexStringToByte(value)));
}
 
Example 10
Source File: OperatorIDPathParameter.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected OperatorID convertFromString(String value) throws ConversionException {
	return new OperatorID(StringUtils.hexStringToByte(value));
}
 
Example 11
Source File: TriggerId.java    From flink with Apache License 2.0 4 votes vote down vote up
public static TriggerId fromHexString(String hexString) {
	return new TriggerId(StringUtils.hexStringToByte(hexString));
}
 
Example 12
Source File: JobVertexID.java    From flink with Apache License 2.0 4 votes vote down vote up
public static JobVertexID fromHexString(String hexString) {
	return new JobVertexID(StringUtils.hexStringToByte(hexString));
}