Search in sources :

Example 6 with ObjectConnection

use of org.gradle.internal.remote.ObjectConnection in project gradle by gradle.

the class ForkingTestClassProcessor method forkProcess.

RemoteTestClassProcessor forkProcess() {
    WorkerProcessBuilder builder = workerFactory.create(new TestWorker(processorFactory));
    builder.setBaseName("Gradle Test Executor");
    builder.setImplementationClasspath(getTestWorkerImplementationClasspath());
    builder.applicationClasspath(classPath);
    options.copyTo(builder.getJavaCommand());
    buildConfigAction.execute(builder);
    workerProcess = builder.build();
    workerProcess.start();
    ObjectConnection connection = workerProcess.getConnection();
    connection.useParameterSerializers(TestEventSerializer.create());
    connection.addIncoming(TestResultProcessor.class, resultProcessor);
    RemoteTestClassProcessor remoteProcessor = connection.addOutgoing(RemoteTestClassProcessor.class);
    connection.connect();
    remoteProcessor.startProcessing();
    return remoteProcessor;
}
Also used : WorkerProcessBuilder(org.gradle.process.internal.worker.WorkerProcessBuilder) ObjectConnection(org.gradle.internal.remote.ObjectConnection)

Example 7 with ObjectConnection

use of org.gradle.internal.remote.ObjectConnection in project gradle by gradle.

the class TestWorker method startReceivingTests.

private void startReceivingTests(WorkerProcessContext workerProcessContext, ServiceRegistry testServices) {
    TestClassProcessor targetProcessor = factory.create(testServices);
    IdGenerator<Object> idGenerator = testServices.get(IdGenerator.class);
    targetProcessor = new WorkerTestClassProcessor(targetProcessor, idGenerator.generateId(), workerProcessContext.getDisplayName(), testServices.get(TimeProvider.class));
    ContextClassLoaderProxy<TestClassProcessor> proxy = new ContextClassLoaderProxy<TestClassProcessor>(TestClassProcessor.class, targetProcessor, workerProcessContext.getApplicationClassLoader());
    processor = proxy.getSource();
    ObjectConnection serverConnection = workerProcessContext.getServerConnection();
    serverConnection.useParameterSerializers(TestEventSerializer.create());
    this.resultProcessor = serverConnection.addOutgoing(TestResultProcessor.class);
    serverConnection.addIncoming(RemoteTestClassProcessor.class, this);
    serverConnection.connect();
}
Also used : TestResultProcessor(org.gradle.api.internal.tasks.testing.TestResultProcessor) ContextClassLoaderProxy(org.gradle.internal.dispatch.ContextClassLoaderProxy) ObjectConnection(org.gradle.internal.remote.ObjectConnection) TestClassProcessor(org.gradle.api.internal.tasks.testing.TestClassProcessor)

Aggregations

ObjectConnection (org.gradle.internal.remote.ObjectConnection)7 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TestClassProcessor (org.gradle.api.internal.tasks.testing.TestClassProcessor)1 TestResultProcessor (org.gradle.api.internal.tasks.testing.TestResultProcessor)1 UncheckedException (org.gradle.internal.UncheckedException)1 ContextClassLoaderProxy (org.gradle.internal.dispatch.ContextClassLoaderProxy)1 ClassLoaderObjectInputStream (org.gradle.internal.io.ClassLoaderObjectInputStream)1 LoggingManagerInternal (org.gradle.internal.logging.LoggingManagerInternal)1 Address (org.gradle.internal.remote.Address)1 ConnectionAcceptor (org.gradle.internal.remote.ConnectionAcceptor)1 MessagingClient (org.gradle.internal.remote.MessagingClient)1 MultiChoiceAddress (org.gradle.internal.remote.internal.inet.MultiChoiceAddress)1 MultiChoiceAddressSerializer (org.gradle.internal.remote.internal.inet.MultiChoiceAddressSerializer)1 MessagingServices (org.gradle.internal.remote.services.MessagingServices)1 Decoder (org.gradle.internal.serialize.Decoder)1 InputStreamBackedDecoder (org.gradle.internal.serialize.InputStreamBackedDecoder)1