Java Code Examples for org.apache.flink.core.testutils.CommonTestUtils

The following examples show how to use org.apache.flink.core.testutils.CommonTestUtils. 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
Source Project: flink   Source File: PythonEnvUtilsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSetPythonExecutable() throws IOException {
	Configuration config = new Configuration();

	PythonEnvUtils.PythonEnvironment env = preparePythonEnvironment(config, null, tmpDirPath);
	if (OperatingSystem.isWindows()) {
		Assert.assertEquals("python.exe", env.pythonExec);
	} else {
		Assert.assertEquals("python", env.pythonExec);
	}

	Map<String, String> systemEnv = new HashMap<>(System.getenv());
	systemEnv.put(PYFLINK_CLIENT_EXECUTABLE, "python3");
	CommonTestUtils.setEnv(systemEnv);
	try {
		env = preparePythonEnvironment(config, null, tmpDirPath);
		Assert.assertEquals("python3", env.pythonExec);
	} finally {
		systemEnv.remove(PYFLINK_CLIENT_EXECUTABLE);
		CommonTestUtils.setEnv(systemEnv);
	}

	config.set(PYTHON_CLIENT_EXECUTABLE, "/usr/bin/python");
	env = preparePythonEnvironment(config, null, tmpDirPath);
	Assert.assertEquals("/usr/bin/python", env.pythonExec);
}
 
Example 2
Source Project: flink   Source File: StringifiedAccumulatorResultTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSerialization() throws IOException {
	final String name = "a";
	final String type = "b";
	final String value = "c";
	final StringifiedAccumulatorResult original = new StringifiedAccumulatorResult(name, type, value);

	// Confirm no funny business in the constructor to getter pathway
	assertEquals(name, original.getName());
	assertEquals(type, original.getType());
	assertEquals(value, original.getValue());

	final StringifiedAccumulatorResult copy = CommonTestUtils.createCopySerializable(original);

	// Copy should have equivalent core fields
	assertEquals(name, copy.getName());
	assertEquals(type, copy.getType());
	assertEquals(value, copy.getValue());
}
 
Example 3
Source Project: Flink-CEPplus   Source File: ListStateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testListStateDescriptor() throws Exception {

	TypeSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());

	ListStateDescriptor<String> descr =
			new ListStateDescriptor<>("testName", serializer);

	assertEquals("testName", descr.getName());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof ListSerializer);
	assertNotNull(descr.getElementSerializer());
	assertEquals(serializer, descr.getElementSerializer());

	ListStateDescriptor<String> copy = CommonTestUtils.createCopySerializable(descr);

	assertEquals("testName", copy.getName());
	assertNotNull(copy.getSerializer());
	assertTrue(copy.getSerializer() instanceof ListSerializer);

	assertNotNull(copy.getElementSerializer());
	assertEquals(serializer, copy.getElementSerializer());
}
 
Example 4
Source Project: flink   Source File: StringifiedAccumulatorResultTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSerialization() throws IOException {
	final String name = "a";
	final String type = "b";
	final String value = "c";
	final StringifiedAccumulatorResult original = new StringifiedAccumulatorResult(name, type, value);

	// Confirm no funny business in the constructor to getter pathway
	assertEquals(name, original.getName());
	assertEquals(type, original.getType());
	assertEquals(value, original.getValue());

	final StringifiedAccumulatorResult copy = CommonTestUtils.createCopySerializable(original);

	// Copy should have equivalent core fields
	assertEquals(name, copy.getName());
	assertEquals(type, copy.getType());
	assertEquals(value, copy.getValue());
}
 
Example 5
Source Project: flink   Source File: ListStateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testListStateDescriptor() throws Exception {

	TypeSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());

	ListStateDescriptor<String> descr =
			new ListStateDescriptor<>("testName", serializer);

	assertEquals("testName", descr.getName());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof ListSerializer);
	assertNotNull(descr.getElementSerializer());
	assertEquals(serializer, descr.getElementSerializer());

	ListStateDescriptor<String> copy = CommonTestUtils.createCopySerializable(descr);

	assertEquals("testName", copy.getName());
	assertNotNull(copy.getSerializer());
	assertTrue(copy.getSerializer() instanceof ListSerializer);

	assertNotNull(copy.getElementSerializer());
	assertEquals(serializer, copy.getElementSerializer());
}
 
Example 6
Source Project: flink   Source File: StateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInitializeWithSerializer() throws Exception {
	final TypeSerializer<String> serializer = StringSerializer.INSTANCE;
	final TestStateDescriptor<String> descr = new TestStateDescriptor<>("test", serializer);

	assertTrue(descr.isSerializerInitialized());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof StringSerializer);

	// this should not have any effect
	descr.initializeSerializerUnlessSet(new ExecutionConfig());
	assertTrue(descr.isSerializerInitialized());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof StringSerializer);

	TestStateDescriptor<String> clone = CommonTestUtils.createCopySerializable(descr);
	assertTrue(clone.isSerializerInitialized());
	assertNotNull(clone.getSerializer());
	assertTrue(clone.getSerializer() instanceof StringSerializer);
}
 
Example 7
Source Project: flink   Source File: FlinkDistributionOverlayTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testBuilderFromEnvironment() throws Exception {
	Configuration conf = new Configuration();

	File binFolder = tempFolder.newFolder("bin");
	File libFolder = tempFolder.newFolder("lib");
	File pluginsFolder = tempFolder.newFolder("plugins");
	File confFolder = tempFolder.newFolder("conf");

	// adjust the test environment for the purposes of this test
	Map<String, String> map = new HashMap<String, String>(System.getenv());
	map.put(ENV_FLINK_BIN_DIR, binFolder.getAbsolutePath());
	map.put(ENV_FLINK_LIB_DIR, libFolder.getAbsolutePath());
	map.put(ENV_FLINK_PLUGINS_DIR, pluginsFolder.getAbsolutePath());
	map.put(ENV_FLINK_CONF_DIR, confFolder.getAbsolutePath());
	CommonTestUtils.setEnv(map);

	FlinkDistributionOverlay.Builder builder = FlinkDistributionOverlay.newBuilder().fromEnvironment(conf);

	assertEquals(binFolder.getAbsolutePath(), builder.flinkBinPath.getAbsolutePath());
	assertEquals(libFolder.getAbsolutePath(), builder.flinkLibPath.getAbsolutePath());
	final File flinkPluginsPath = builder.flinkPluginsPath;
	assertNotNull(flinkPluginsPath);
	assertEquals(pluginsFolder.getAbsolutePath(), flinkPluginsPath.getAbsolutePath());
	assertEquals(confFolder.getAbsolutePath(), builder.flinkConfPath.getAbsolutePath());
}
 
Example 8
Source Project: flink   Source File: SerializedValueTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testNullValue() {
	try {
		SerializedValue<Object> v = new SerializedValue<>(null);
		SerializedValue<Object> copy = CommonTestUtils.createCopySerializable(v);

		assertNull(copy.deserializeValue(getClass().getClassLoader()));

		assertEquals(v, copy);
		assertEquals(v.hashCode(), copy.hashCode());
		assertEquals(v.toString(), copy.toString());
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example 9
Source Project: flink   Source File: ReducingStateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testReducingStateDescriptor() throws Exception {

	ReduceFunction<String> reducer = (a, b) -> a;

	TypeSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());

	ReducingStateDescriptor<String> descr =
			new ReducingStateDescriptor<>("testName", reducer, serializer);

	assertEquals("testName", descr.getName());
	assertNotNull(descr.getSerializer());
	assertEquals(serializer, descr.getSerializer());
	assertEquals(reducer, descr.getReduceFunction());

	ReducingStateDescriptor<String> copy = CommonTestUtils.createCopySerializable(descr);

	assertEquals("testName", copy.getName());
	assertNotNull(copy.getSerializer());
	assertEquals(serializer, copy.getSerializer());
}
 
Example 10
Source Project: flink   Source File: StateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInitializeWithSerializer() throws Exception {
	final TypeSerializer<String> serializer = StringSerializer.INSTANCE;
	final TestStateDescriptor<String> descr = new TestStateDescriptor<>("test", serializer);

	assertTrue(descr.isSerializerInitialized());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof StringSerializer);

	// this should not have any effect
	descr.initializeSerializerUnlessSet(new ExecutionConfig());
	assertTrue(descr.isSerializerInitialized());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof StringSerializer);

	TestStateDescriptor<String> clone = CommonTestUtils.createCopySerializable(descr);
	assertTrue(clone.isSerializerInitialized());
	assertNotNull(clone.getSerializer());
	assertTrue(clone.getSerializer() instanceof StringSerializer);
}
 
Example 11
Source Project: flink   Source File: StateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInitializeSerializerBeforeSerialization() throws Exception {
	final TestStateDescriptor<String> descr = new TestStateDescriptor<>("test", String.class);

	assertFalse(descr.isSerializerInitialized());
	try {
		descr.getSerializer();
		fail("should fail with an exception");
	} catch (IllegalStateException ignored) {}

	descr.initializeSerializerUnlessSet(new ExecutionConfig());

	assertTrue(descr.isSerializerInitialized());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof StringSerializer);

	TestStateDescriptor<String> clone = CommonTestUtils.createCopySerializable(descr);

	assertTrue(clone.isSerializerInitialized());
	assertNotNull(clone.getSerializer());
	assertTrue(clone.getSerializer() instanceof StringSerializer);
}
 
Example 12
Source Project: flink   Source File: StateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testInitializeSerializerAfterSerializationWithCustomConfig() throws Exception {
	// guard our test assumptions.
	assertEquals("broken test assumption", -1,
			new KryoSerializer<>(String.class, new ExecutionConfig()).getKryo()
					.getRegistration(File.class).getId());

	final ExecutionConfig config = new ExecutionConfig();
	config.registerKryoType(File.class);

	final TestStateDescriptor<Path> original = new TestStateDescriptor<>("test", Path.class);
	TestStateDescriptor<Path> clone = CommonTestUtils.createCopySerializable(original);

	clone.initializeSerializerUnlessSet(config);

	// serialized one (later initialized) carries the registration
	assertTrue(((KryoSerializer<?>) clone.getSerializer()).getKryo()
			.getRegistration(File.class).getId() > 0);
}
 
Example 13
Source Project: flink   Source File: StateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testHashCodeAndEquals() throws Exception {
	final String name = "testName";

	TestStateDescriptor<String> original = new TestStateDescriptor<>(name, String.class);
	TestStateDescriptor<String> same = new TestStateDescriptor<>(name, String.class);
	TestStateDescriptor<String> sameBySerializer = new TestStateDescriptor<>(name, StringSerializer.INSTANCE);

	// test that hashCode() works on state descriptors with initialized and uninitialized serializers
	assertEquals(original.hashCode(), same.hashCode());
	assertEquals(original.hashCode(), sameBySerializer.hashCode());

	assertEquals(original, same);
	assertEquals(original, sameBySerializer);

	// equality with a clone
	TestStateDescriptor<String> clone = CommonTestUtils.createCopySerializable(original);
	assertEquals(original, clone);

	// equality with an initialized
	clone.initializeSerializerUnlessSet(new ExecutionConfig());
	assertEquals(original, clone);

	original.initializeSerializerUnlessSet(new ExecutionConfig());
	assertEquals(original, same);
}
 
Example 14
Source Project: flink   Source File: SerializedValueTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSimpleValue() {
	try {
		final String value = "teststring";

		SerializedValue<String> v = new SerializedValue<>(value);
		SerializedValue<String> copy = CommonTestUtils.createCopySerializable(v);

		assertEquals(value, v.deserializeValue(getClass().getClassLoader()));
		assertEquals(value, copy.deserializeValue(getClass().getClassLoader()));

		assertEquals(v, copy);
		assertEquals(v.hashCode(), copy.hashCode());

		assertNotNull(v.toString());
		assertNotNull(copy.toString());

	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example 15
Source Project: flink   Source File: ListStateDescriptorTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testListStateDescriptor() throws Exception {

	TypeSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());

	ListStateDescriptor<String> descr =
			new ListStateDescriptor<>("testName", serializer);

	assertEquals("testName", descr.getName());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof ListSerializer);
	assertNotNull(descr.getElementSerializer());
	assertEquals(serializer, descr.getElementSerializer());

	ListStateDescriptor<String> copy = CommonTestUtils.createCopySerializable(descr);

	assertEquals("testName", copy.getName());
	assertNotNull(copy.getSerializer());
	assertTrue(copy.getSerializer() instanceof ListSerializer);

	assertNotNull(copy.getElementSerializer());
	assertEquals(serializer, copy.getElementSerializer());
}
 
Example 16
Source Project: flink   Source File: PojoSerializerUpgradeTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Changing field types of a POJO as keyed state should require a state migration.
 */
@Test
public void testChangedFieldTypesWithKeyedState() throws Exception {
	try {
		testPojoSerializerUpgrade(SOURCE_A, SOURCE_C, true, true);
		fail("Expected a state migration exception.");
	} catch (Exception e) {
		if (CommonTestUtils.containsCause(e, StateMigrationException.class)) {
			// StateMigrationException expected
		} else {
			throw e;
		}
	}
}
 
Example 17
Source Project: Flink-CEPplus   Source File: PojoSerializerUpgradeTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Changing field types of a POJO as keyed state should require a state migration.
 */
@Test
public void testChangedFieldTypesWithKeyedState() throws Exception {
	try {
		testPojoSerializerUpgrade(SOURCE_A, SOURCE_C, true, true);
		fail("Expected a state migration exception.");
	} catch (Exception e) {
		if (CommonTestUtils.containsCause(e, StateMigrationException.class)) {
			// StateMigrationException expected
		} else {
			throw e;
		}
	}
}
 
Example 18
Source Project: flink   Source File: ProcessMemoryUtilsTestBase.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testConfigLegacyHeapEnv() {
	MemorySize jvmHeapSize = MemorySize.parse("1g");

	Map<String, String> env = new HashMap<>();
	env.put(legacyMemoryOptions.getEnvVar(), "1g");
	CommonTestUtils.setEnv(env);

	testConfigLegacyHeapMemory(new Configuration(), jvmHeapSize);
}
 
Example 19
Source Project: Flink-CEPplus   Source File: KryoSerializerSnapshotTest.java    License: Apache License 2.0 5 votes vote down vote up
private static ExecutionConfig registerClassThatIsNotInClassPath(ClassLoader tempClassLoader) {
	Object objectForClassNotInClassPath =
		CommonTestUtils.createObjectForClassNotInClassPath(tempClassLoader);

	ExecutionConfig conf = new ExecutionConfig();
	conf.registerKryoType(objectForClassNotInClassPath.getClass());
	return conf;
}
 
Example 20
Source Project: Flink-CEPplus   Source File: SimpleStringSchemaTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSerializability() throws Exception {
	final SimpleStringSchema schema = new SimpleStringSchema(StandardCharsets.UTF_16LE);
	final SimpleStringSchema copy = CommonTestUtils.createCopySerializable(schema);

	assertEquals(schema.getCharset(), copy.getCharset());
}
 
Example 21
Source Project: flink   Source File: PluginConfigTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void getPluginsDir_nonExistingDirectory_returnsEmpty() {
	final Map<String, String> envVariables = ImmutableMap.of(ConfigConstants.ENV_FLINK_PLUGINS_DIR, new File(temporaryFolder.getRoot().getAbsoluteFile(), "should_not_exist").getAbsolutePath());
	CommonTestUtils.setEnv(envVariables);

	assertFalse(PluginConfig.getPluginsDir().isPresent());
}
 
Example 22
Source Project: flink   Source File: AbstractIDTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests the serialization/deserialization of an abstract ID.
 */
@Test
public void testSerialization() throws Exception {
	final AbstractID origID = new AbstractID();
	final AbstractID copyID = CommonTestUtils.createCopySerializable(origID);

	assertEquals(origID.hashCode(), copyID.hashCode());
	assertEquals(origID, copyID);
}
 
Example 23
Source Project: flink   Source File: ErrorInfoTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSerializationWithExceptionOutsideClassLoader() throws Exception {
	final ErrorInfo error = new ErrorInfo(new ExceptionWithCustomClassLoader(), System.currentTimeMillis());
	final ErrorInfo copy = CommonTestUtils.createCopySerializable(error);

	assertEquals(error.getTimestamp(), copy.getTimestamp());
	assertEquals(error.getExceptionAsString(), copy.getExceptionAsString());
	assertEquals(error.getException().getMessage(), copy.getException().getMessage());

}
 
Example 24
Source Project: flink   Source File: CheckpointMessagesTest.java    License: Apache License 2.0 5 votes vote down vote up
private static void testSerializabilityEqualsHashCode(Serializable o) throws IOException {
	Object copy = CommonTestUtils.createCopySerializable(o);
	assertEquals(o, copy);
	assertEquals(o.hashCode(), copy.hashCode());
	assertNotNull(o.toString());
	assertNotNull(copy.toString());
}
 
Example 25
Source Project: flink   Source File: GenericMessageTester.java    License: Apache License 2.0 5 votes vote down vote up
public static void testMessageInstance(Serializable instance) throws Exception {
	Serializable copy = CommonTestUtils.createCopySerializable(instance);
	
	// test equals, hash code, toString
	assertTrue(instance.equals(copy));
	assertTrue(copy.equals(instance));
	assertTrue(instance.hashCode() == copy.hashCode());
	assertTrue(instance.toString().equals(copy.toString()));
}
 
Example 26
Source Project: Flink-CEPplus   Source File: MapStateDescriptorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testMapStateDescriptor() throws Exception {

	TypeSerializer<Integer> keySerializer = new KryoSerializer<>(Integer.class, new ExecutionConfig());
	TypeSerializer<String> valueSerializer = new KryoSerializer<>(String.class, new ExecutionConfig());

	MapStateDescriptor<Integer, String> descr =
			new MapStateDescriptor<>("testName", keySerializer, valueSerializer);

	assertEquals("testName", descr.getName());
	assertNotNull(descr.getSerializer());
	assertTrue(descr.getSerializer() instanceof MapSerializer);
	assertNotNull(descr.getKeySerializer());
	assertEquals(keySerializer, descr.getKeySerializer());
	assertNotNull(descr.getValueSerializer());
	assertEquals(valueSerializer, descr.getValueSerializer());

	MapStateDescriptor<Integer, String> copy = CommonTestUtils.createCopySerializable(descr);

	assertEquals("testName", copy.getName());
	assertNotNull(copy.getSerializer());
	assertTrue(copy.getSerializer() instanceof MapSerializer);

	assertNotNull(copy.getKeySerializer());
	assertEquals(keySerializer, copy.getKeySerializer());
	assertNotNull(copy.getValueSerializer());
	assertEquals(valueSerializer, copy.getValueSerializer());
}
 
Example 27
Source Project: flink   Source File: SubtaskStateStatsTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Tests that the snapshot is actually serializable.
 */
@Test
public void testIsJavaSerializable() throws Exception {
	SubtaskStateStats stats = new SubtaskStateStats(
		0,
		Integer.MAX_VALUE + 1L,
		Integer.MAX_VALUE + 2L,
		Integer.MAX_VALUE + 3L,
		Integer.MAX_VALUE + 4L,
		Integer.MAX_VALUE + 5L,
		Integer.MAX_VALUE + 6L);

	SubtaskStateStats copy = CommonTestUtils.createCopySerializable(stats);

	assertEquals(0, copy.getSubtaskIndex());
	assertEquals(Integer.MAX_VALUE + 1L, copy.getAckTimestamp());
	assertEquals(Integer.MAX_VALUE + 2L, copy.getStateSize());
	assertEquals(Integer.MAX_VALUE + 3L, copy.getSyncCheckpointDuration());
	assertEquals(Integer.MAX_VALUE + 4L, copy.getAsyncCheckpointDuration());
	assertEquals(Integer.MAX_VALUE + 5L, copy.getAlignmentBuffered());
	assertEquals(Integer.MAX_VALUE + 6L, copy.getAlignmentDuration());

	// Check duration helper
	long ackTimestamp = copy.getAckTimestamp();
	long triggerTimestamp = ackTimestamp - 10123;
	assertEquals(10123, copy.getEndToEndDuration(triggerTimestamp));

	// Trigger timestamp < ack timestamp
	assertEquals(0, copy.getEndToEndDuration(ackTimestamp + 1));

}
 
Example 28
Source Project: flink   Source File: GenericMessageTester.java    License: Apache License 2.0 5 votes vote down vote up
public static void testMessageInstances(Serializable instance1, Serializable instance2) throws Exception {
	// test equals, hash code, toString
	assertTrue(instance1.equals(instance2));
	assertTrue(instance2.equals(instance1));
	assertTrue(instance1.hashCode() == instance2.hashCode());
	assertTrue(instance1.toString().equals(instance2.toString()));

	// test serializability
	Serializable copy = CommonTestUtils.createCopySerializable(instance1);
	assertTrue(instance1.equals(copy));
	assertTrue(copy.equals(instance1));
	assertTrue(instance1.hashCode() == copy.hashCode());
}
 
Example 29
Source Project: Flink-CEPplus   Source File: MemorySizeTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testStandardUtils() throws IOException {
	final MemorySize size = new MemorySize(1234567890L);
	final MemorySize cloned = CommonTestUtils.createCopySerializable(size);

	assertEquals(size, cloned);
	assertEquals(size.hashCode(), cloned.hashCode());
	assertEquals(size.toString(), cloned.toString());
}
 
Example 30
Source Project: flink   Source File: ResourceSpecTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testSerializable() throws Exception {
	ResourceSpec rs1 = ResourceSpec.newBuilder(1.0, 100).
			setGPUResource(1.1).
			build();

	ResourceSpec rs2 = CommonTestUtils.createCopySerializable(rs1);
	assertEquals(rs1, rs2);
}