use of org.apache.pulsar.client.admin.Functions in project incubator-pulsar by apache.
the class CmdFunctionsTest method setup.
@BeforeMethod
public void setup() throws Exception {
this.admin = mock(PulsarAdminWithFunctions.class);
this.functions = mock(Functions.class);
when(admin.functions()).thenReturn(functions);
when(admin.getServiceUrl()).thenReturn(URI.create("http://localhost:1234").toURL());
when(admin.getClientConf()).thenReturn(new ClientConfigurationData());
this.cmd = new CmdFunctions(admin);
// mock reflections
mockStatic(Reflections.class);
when(Reflections.classExistsInJar(any(File.class), anyString())).thenReturn(true);
when(Reflections.classExists(anyString())).thenReturn(true);
when(Reflections.classInJarImplementsIface(any(File.class), anyString(), eq(Function.class))).thenReturn(true);
when(Reflections.classImplementsIface(anyString(), any())).thenReturn(true);
when(Reflections.createInstance(eq(DummyFunction.class.getName()), any(File.class))).thenReturn(new DummyFunction());
when(Reflections.createInstance(eq(DefaultSerDe.class.getName()), any(File.class))).thenReturn(new DefaultSerDe(String.class));
}
Aggregations