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

The following examples show how to use org.apache.flink.util.StringUtils#hexStringToByte() . These examples are extracted from open source projects. 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
@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 Project: Flink-CEPplus   File: JobID.java    License: 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 Project: flink   File: JobID.java    License: 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 Project: flink   File: JobID.java    License: 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 Project: Flink-CEPplus   File: TriggerId.java    License: 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 Project: Flink-CEPplus   File: JobVertexID.java    License: 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 Project: flink   File: TriggerId.java    License: 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 Project: flink   File: JobVertexID.java    License: Apache License 2.0 4 votes vote down vote up
public static JobVertexID fromHexString(String hexString) {
	return new JobVertexID(StringUtils.hexStringToByte(hexString));
}
 
Example 9
@Override
protected IntermediateDataSetID convertFromString(String value) {
	return new IntermediateDataSetID(new AbstractID(StringUtils.hexStringToByte(value)));
}
 
Example 10
Source Project: flink   File: OperatorIDPathParameter.java    License: 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 Project: flink   File: TriggerId.java    License: 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 Project: flink   File: JobVertexID.java    License: Apache License 2.0 4 votes vote down vote up
public static JobVertexID fromHexString(String hexString) {
	return new JobVertexID(StringUtils.hexStringToByte(hexString));
}