use of org.apache.hadoop.registry.client.types.ServiceRecord in project hadoop by apache.
the class TestRegistryOperations method testPutNoParent2.
@Test(expected = PathNotFoundException.class)
public void testPutNoParent2() throws Throwable {
ServiceRecord record = new ServiceRecord();
record.set(YarnRegistryAttributes.YARN_ID, "testPutNoParent");
String path = "/path/without/parent";
operations.bind(path, record, 0);
}
use of org.apache.hadoop.registry.client.types.ServiceRecord in project hadoop by apache.
the class TestRegistryOperations method testPutGetServiceEntry.
@Test
public void testPutGetServiceEntry() throws Throwable {
ServiceRecord written = putExampleServiceEntry(ENTRY_PATH, 0, PersistencePolicies.APPLICATION);
ServiceRecord resolved = operations.resolve(ENTRY_PATH);
validateEntry(resolved);
assertMatches(written, resolved);
}
use of org.apache.hadoop.registry.client.types.ServiceRecord in project hadoop by apache.
the class TestMarshalling method testUnknownFieldsRoundTrip.
@Test
public void testUnknownFieldsRoundTrip() throws Throwable {
ServiceRecord record = createRecord(PersistencePolicies.APPLICATION_ATTEMPT);
record.set("key", "value");
record.set("intval", "2");
assertEquals("value", record.get("key"));
assertEquals("2", record.get("intval"));
assertNull(record.get("null"));
assertEquals("defval", record.get("null", "defval"));
byte[] bytes = marshal.toBytes(record);
ServiceRecord r2 = marshal.fromBytes("", bytes);
assertEquals("value", r2.get("key"));
assertEquals("2", r2.get("intval"));
}
use of org.apache.hadoop.registry.client.types.ServiceRecord in project hadoop by apache.
the class TestMarshalling method testUnmarshallNoType.
@Test(expected = NoRecordException.class)
public void testUnmarshallNoType() throws Throwable {
ServiceRecord record = new ServiceRecord();
record.type = "NoRecord";
byte[] bytes = marshal.toBytes(record);
ServiceRecord serviceRecord = marshal.fromBytes("marshalling", bytes, ServiceRecord.RECORD_TYPE);
}
use of org.apache.hadoop.registry.client.types.ServiceRecord in project hadoop by apache.
the class TestMarshalling method testUnmarshallWrongLongType.
@Test(expected = NoRecordException.class)
public void testUnmarshallWrongLongType() throws Throwable {
ServiceRecord record = new ServiceRecord();
record.type = "ThisRecordHasALongButNonMatchingType";
byte[] bytes = marshal.toBytes(record);
ServiceRecord serviceRecord = marshal.fromBytes("marshalling", bytes, ServiceRecord.RECORD_TYPE);
}
Aggregations