Search in sources :

Example 16 with ServiceRecord

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);
}
Also used : ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test) AbstractRegistryTest(org.apache.hadoop.registry.AbstractRegistryTest)

Example 17 with ServiceRecord

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);
}
Also used : ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test) AbstractRegistryTest(org.apache.hadoop.registry.AbstractRegistryTest)

Example 18 with ServiceRecord

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"));
}
Also used : ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test)

Example 19 with ServiceRecord

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);
}
Also used : ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test)

Example 20 with ServiceRecord

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);
}
Also used : ServiceRecord(org.apache.hadoop.registry.client.types.ServiceRecord) Test(org.junit.Test)

Aggregations

ServiceRecord (org.apache.hadoop.registry.client.types.ServiceRecord)42 Test (org.junit.Test)21 AbstractRegistryTest (org.apache.hadoop.registry.AbstractRegistryTest)14 IOException (java.io.IOException)10 RegistryPathStatus (org.apache.hadoop.registry.client.types.RegistryPathStatus)6 NoRecordException (org.apache.hadoop.registry.client.exceptions.NoRecordException)5 Endpoint (org.apache.hadoop.registry.client.types.Endpoint)5 HashMap (java.util.HashMap)4 ParseException (org.apache.commons.cli.ParseException)4 PathNotFoundException (org.apache.hadoop.fs.PathNotFoundException)4 RegistryTypeUtils.inetAddrEndpoint (org.apache.hadoop.registry.client.binding.RegistryTypeUtils.inetAddrEndpoint)4 RegistryTypeUtils.restEndpoint (org.apache.hadoop.registry.client.binding.RegistryTypeUtils.restEndpoint)4 InvalidRecordException (org.apache.hadoop.registry.client.exceptions.InvalidRecordException)4 URISyntaxException (java.net.URISyntaxException)3 Map (java.util.Map)3 PathIsNotEmptyDirectoryException (org.apache.hadoop.fs.PathIsNotEmptyDirectoryException)3 ZKPathDumper (org.apache.hadoop.registry.client.impl.zk.ZKPathDumper)3 EOFException (java.io.EOFException)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)2 URI (java.net.URI)2