Search in sources :

Example 1 with UseSharedCacheResourceResponsePBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl in project hadoop by apache.

the class TestSharedCacheClientImpl method testUseWithResourceName.

@Test
public void testUseWithResourceName() throws Exception {
    Path file = new Path("viewfs://test/path");
    URI useUri = new URI("viewfs://test/path#linkName");
    Path usePath = new Path(useUri);
    UseSharedCacheResourceResponse response = new UseSharedCacheResourceResponsePBImpl();
    response.setPath(file.toString());
    when(cProtocol.use(isA(UseSharedCacheResourceRequest.class))).thenReturn(response);
    Path newPath = client.use(mock(ApplicationId.class), "key", "linkName");
    assertEquals("The paths are not equal!", usePath, newPath);
}
Also used : Path(org.apache.hadoop.fs.Path) UseSharedCacheResourceRequest(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceRequest) UseSharedCacheResourceResponse(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceResponse) UseSharedCacheResourceResponsePBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) URI(java.net.URI) Test(org.junit.Test)

Example 2 with UseSharedCacheResourceResponsePBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl in project hadoop by apache.

the class TestSharedCacheClientImpl method testUseWithSameResourceName.

@Test
public void testUseWithSameResourceName() throws Exception {
    Path file = new Path("viewfs://test/path");
    URI useUri = new URI("viewfs://test/path");
    Path usePath = new Path(useUri);
    UseSharedCacheResourceResponse response = new UseSharedCacheResourceResponsePBImpl();
    response.setPath(file.toString());
    when(cProtocol.use(isA(UseSharedCacheResourceRequest.class))).thenReturn(response);
    Path newPath = client.use(mock(ApplicationId.class), "key", "path");
    assertEquals("The paths are not equal!", usePath, newPath);
}
Also used : Path(org.apache.hadoop.fs.Path) UseSharedCacheResourceRequest(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceRequest) UseSharedCacheResourceResponse(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceResponse) UseSharedCacheResourceResponsePBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) URI(java.net.URI) Test(org.junit.Test)

Example 3 with UseSharedCacheResourceResponsePBImpl

use of org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl in project hadoop by apache.

the class TestSharedCacheClientImpl method testUseCacheMiss.

@Test
public void testUseCacheMiss() throws Exception {
    UseSharedCacheResourceResponse response = new UseSharedCacheResourceResponsePBImpl();
    response.setPath(null);
    when(cProtocol.use(isA(UseSharedCacheResourceRequest.class))).thenReturn(response);
    Path newPath = client.use(mock(ApplicationId.class), "key", null);
    assertNull("The path is not null!", newPath);
}
Also used : UseSharedCacheResourceRequest(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceRequest) Path(org.apache.hadoop.fs.Path) UseSharedCacheResourceResponse(org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceResponse) UseSharedCacheResourceResponsePBImpl(org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) Test(org.junit.Test)

Aggregations

Path (org.apache.hadoop.fs.Path)3 UseSharedCacheResourceRequest (org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceRequest)3 UseSharedCacheResourceResponse (org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceResponse)3 UseSharedCacheResourceResponsePBImpl (org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UseSharedCacheResourceResponsePBImpl)3 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)3 Test (org.junit.Test)3 URI (java.net.URI)2