develop environment:
dremio2.0 web server 192.168.9.163:9047
when I run this code to invoke the interface of apiv2 ,to test the function how to add source in the dremio2.0. it can invoke the interface of apiv2 to get logining session.but can not add the source . test code and error info underneath:
test code:
DremioSQLEngineService tempDremioSQLEngineService=new DremioSQLEngineService();
tempDremioSQLEngineService.initClient();
UserLoginSession uls = tempDremioSQLEngineService.expectSuccess(getAPIv2().path("/login").request(JSON).buildPost(Entity.json(new UserLogin(“cellen”, “lanyun123”))), UserLoginSession.class);
System.out.println(“uls=”+uls);
tempDremioSQLEngineService.setUls(uls);
//tempDremioSQLEngineService.TestMysqlSourceAdd();
tempDremioSQLEngineService.testAddSourceWithAccelerationTTL();
testAddSourceWithAccelerationTTL(){
NASConf nas = new NASConf();
nas.path = “D:/work_lykj/all_meta/tmp”;
SourceConfig nasConfig = new SourceConfig();
nasConfig.setDescription(“lanysec mysql database”);
nasConfig.setType(“NAS”);
nasConfig.setName(“src”);
nasConfig.setId(new EntityId(SOURCE_ID));
nasConfig.setConnectionConf(nas);
SourceUI source = new SourceUI();
source.setName(sourceName);
source.setCtime(System.currentTimeMillis());
source.setAccelerationRefreshPeriod(refreshPeriod);
source.setAccelerationGracePeriod(gracePeriod);
source.setId(nasConfig.getId().getId());
source.setConfig(nas);
expectSuccess(
getBuilder(getAPIv2().path(String.format("/source/%s", sourceName)))
.buildPut(Entity.entity(source, JSON)));
final SourceUI result = expectSuccess(
getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))).buildGet(),
SourceUI.class);
}
error info
Exception in thread “main” java.lang.AssertionError: expected: but was:<CLIENT_ERROR>
InboundJaxrsResponse{context=ClientResponse{method=PUT, uri=http://192.168.9.163:9047/apiv2/source/src, status=400, reason=Bad Request}}
Unexpected token (VALUE_NULL), expected VALUE_STRING: need JSON String that contains type id (for subtype of com.dremio.exec.catalog.conf.ConnectionConf)
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@6f0734c8; line: 1, column: 1330]
at com.lanysec.service.sql.utils.BaseClientUtils.expect(BaseClientUtils.java:77)
at com.lanysec.service.sql.utils.BaseClientUtils.expectSuccess(BaseClientUtils.java:41)
at com.lanysec.service.sql.dremio.DremioSQLEngineService.testAddSourceWithAccelerationTTL(DremioSQLEngineService.java:469)
at com.lanysec.service.sql.dremio.DremioSQLEngineService.main(DremioSQLEngineService.java:496)