use of org.pentaho.di.trans.dataservice.jdbc.ThinServiceInformation in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceClient method getServiceInformation.
@Override
public List<IThinServiceInformation> getServiceInformation() throws SQLException {
List<IThinServiceInformation> services = Lists.newArrayList();
for (DataServiceMeta service : resolver.getDataServices(logErrors()::apply)) {
TransMeta transMeta = service.getServiceTrans();
try {
transMeta.activateParameters();
RowMetaInterface serviceFields = transMeta.getStepFields(service.getStepname());
IThinServiceInformation serviceInformation = new ThinServiceInformation(service.getName(), service.isStreaming(), serviceFields);
services.add(serviceInformation);
} catch (Exception e) {
String message = MessageFormat.format("Unable to get fields for service {0}, transformation: {1}", service.getName(), transMeta.getName());
log.logError(message, e);
}
}
return services;
}
use of org.pentaho.di.trans.dataservice.jdbc.ThinServiceInformation in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceClient method getServiceInformation.
@Override
public ThinServiceInformation getServiceInformation(String name) throws SQLException {
DataServiceMeta dataServiceMeta = resolver.getDataService(name);
if (dataServiceMeta != null) {
TransMeta transMeta = dataServiceMeta.getServiceTrans();
try {
transMeta.activateParameters();
RowMetaInterface serviceFields = transMeta.getStepFields(dataServiceMeta.getStepname());
return new ThinServiceInformation(dataServiceMeta.getName(), dataServiceMeta.isStreaming(), serviceFields);
} catch (Exception e) {
String message = MessageFormat.format("Unable to get fields for service {0}, transformation: {1}", dataServiceMeta.getName(), transMeta.getName());
log.logError(message, e);
}
}
return null;
}
use of org.pentaho.di.trans.dataservice.jdbc.ThinServiceInformation in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceClientTest method testGetServiceInformationByName.
@Test
public void testGetServiceInformationByName() throws Exception {
when(transMeta.getStepFields(dataService.getStepname())).thenReturn(rowMetaInterface);
ThinServiceInformation serviceInformation = client.getServiceInformation(DATA_SERVICE_NAME);
verify(transMeta).activateParameters();
assertThat(serviceInformation.getName(), equalTo(DATA_SERVICE_NAME));
assertThat(serviceInformation.getServiceFields(), equalTo(rowMetaInterface));
}
use of org.pentaho.di.trans.dataservice.jdbc.ThinServiceInformation in project pdi-dataservice-server-plugin by pentaho.
the class ListDataServicesServletTest method setUp.
@Before
public void setUp() throws Exception {
servlet = new ListDataServicesServlet(client);
servlet.setJettyMode(true);
servlet.setup(transformationMap, null, null, null);
when(request.getContextPath()).thenReturn(CONTEXT_PATH);
StringWriter out = new StringWriter();
ThinServiceInformation thinServiceInformation = new ThinServiceInformation(DATA_SERVICE_NAME, false, rowMetaInterface);
when(response.getWriter()).thenReturn(new PrintWriter(out));
when(rowMetaInterface.getMetaXML()).thenReturn("<rowMeta mock/>");
when(client.getServiceInformation()).thenReturn(ImmutableList.of(thinServiceInformation));
outputBuffer = out.getBuffer();
}
Aggregations