Search in sources :

Example 1 with FunctionsImpl

use of org.apache.pulsar.functions.worker.rest.api.FunctionsImpl in project incubator-pulsar by apache.

the class FunctionApiV2ResourceTest method setup.

@BeforeMethod
public void setup() {
    this.mockedManager = mock(FunctionMetaDataManager.class);
    this.mockedInputStream = mock(InputStream.class);
    this.mockedFormData = mock(FormDataContentDisposition.class);
    this.mockedNamespace = mock(Namespace.class);
    this.mockedWorkerService = mock(WorkerService.class);
    when(mockedWorkerService.getFunctionMetaDataManager()).thenReturn(mockedManager);
    when(mockedWorkerService.getDlogNamespace()).thenReturn(mockedNamespace);
    // worker config
    WorkerConfig workerConfig = new WorkerConfig().setWorkerId("test").setWorkerPort(8080).setDownloadDirectory("/tmp/pulsar/functions").setFunctionMetadataTopicName("pulsar/functions").setNumFunctionPackageReplicas(3).setPulsarServiceUrl("pulsar://localhost:6650/");
    when(mockedWorkerService.getWorkerConfig()).thenReturn(workerConfig);
    this.resource = spy(new FunctionsImpl(() -> mockedWorkerService));
}
Also used : FunctionMetaDataManager(org.apache.pulsar.functions.worker.FunctionMetaDataManager) InputStream(java.io.InputStream) FunctionsImpl(org.apache.pulsar.functions.worker.rest.api.FunctionsImpl) WorkerConfig(org.apache.pulsar.functions.worker.WorkerConfig) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) Namespace(org.apache.distributedlog.api.namespace.Namespace) WorkerService(org.apache.pulsar.functions.worker.WorkerService) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

InputStream (java.io.InputStream)1 Namespace (org.apache.distributedlog.api.namespace.Namespace)1 FunctionMetaDataManager (org.apache.pulsar.functions.worker.FunctionMetaDataManager)1 WorkerConfig (org.apache.pulsar.functions.worker.WorkerConfig)1 WorkerService (org.apache.pulsar.functions.worker.WorkerService)1 FunctionsImpl (org.apache.pulsar.functions.worker.rest.api.FunctionsImpl)1 FormDataContentDisposition (org.glassfish.jersey.media.multipart.FormDataContentDisposition)1 BeforeMethod (org.testng.annotations.BeforeMethod)1