@Before public void setUpPDFSService() throws IOException { NodeEndpoint endpoint = NodeEndpoint.newBuilder() .setAddress(fabric.getAddress()).setFabricPort(fabric.getPort()) .build(); PDFSProtocol pdfsProtocol = PDFSProtocol.newInstance(endpoint, DremioTest.DEFAULT_SABOT_CONFIG, allocator, true); FabricRunnerFactory factory = fabric.registerProtocol(pdfsProtocol); sabotFS = new RemoteNodeFileSystem(factory.getCommandRunner(fabric.getAddress(), fabric.getPort()), allocator); sabotFS.initialize(URI.create(format("sabot://%s:%d", fabric.getAddress(), fabric.getPort())), new Configuration(false)); }
ReceivedResponseMessage<QueryId> resp2 = ep2.getEndpoint(address, fabric.getPort()).send(expectedD, random1); assertEquals(resp2.getBody(), expectedQ); assertEqualsBytes(r2B, resp2.getBuffer());
@Test(expected=RpcException.class) public void propagateFailure() throws Exception { ProtocolBuilder builder = ProtocolBuilder.builder().allocator(allocator).name("test-fabric").protocolId(3); SendEndpointCreator<NodeEndpoint, QueryId> ep1 = builder.register(1, new AbstractReceiveHandler<NodeEndpoint, QueryId>(NodeEndpoint.getDefaultInstance(), QueryId.getDefaultInstance()) { @Override public SentResponseMessage<QueryId> handle(NodeEndpoint request, ArrowBuf dBody) throws RpcException { throw new NullPointerException("an npe."); } }); builder.register(fabric); ReceivedResponseMessage<QueryId> resp1 = ep1.getEndpoint(address, fabric.getPort()).send(expectedD); assertEquals(resp1.getBody(), expectedQ); assertTrue(resp1.getBuffer() == null); }
@Test public void basicProtocolNoBuffers() throws Exception { ProtocolBuilder builder = ProtocolBuilder.builder().allocator(allocator).name("test-fabric").protocolId(3); SendEndpointCreator<NodeEndpoint, QueryId> ep1 = builder.register(1, new AbstractReceiveHandler<NodeEndpoint, QueryId>(NodeEndpoint.getDefaultInstance(), QueryId.getDefaultInstance()) { @Override public SentResponseMessage<QueryId> handle(NodeEndpoint request, ArrowBuf dBody) throws RpcException { if (!request.equals(expectedD)) { throw new RpcException("Objects not same."); } return new SentResponseMessage<>(expectedQ); } }); builder.register(fabric); ReceivedResponseMessage<QueryId> resp1 = ep1.getEndpoint(address, fabric.getPort()).send(expectedD); assertEquals(resp1.getBody(), expectedQ); assertTrue(resp1.getBuffer() == null); }
public ServiceHolder(BufferAllocator allocator, Provider<Iterable<NodeEndpoint>> nodeProvider, PDFSMode mode, String name) throws Exception{ this.allocator = allocator.newChildAllocator(name, 0, Long.MAX_VALUE); pool = new CloseableThreadPool(name); fabric = new FabricServiceImpl(HOSTNAME, 9970, true, THREAD_COUNT, this.allocator, RESERVATION, MAX_ALLOCATION, TIMEOUT, pool); fabric.start(); endpoint = NodeEndpoint.newBuilder() .setAddress(fabric.getAddress()).setFabricPort(fabric.getPort()) .setRoles(Roles.newBuilder().setJavaExecutor(mode == PDFSMode.DATA)) .build(); service = new PDFSService(DirectProvider.wrap((FabricService) fabric), DirectProvider.wrap(endpoint), nodeProvider, DremioTest.DEFAULT_SABOT_CONFIG, this.allocator, mode); service.start(); fileSystem = service.createFileSystem(); }