@GetMapping("")
@ResponseBody
@ApiOperation(value="Gat all databases name")
- //public Iterable<Db> list() throws IOException {
public List<String> list() throws IOException {
Iterable<Db> ret = dbRepository.findAll();
List<String> retString = new ArrayList<>();
newdb.setPass(dbConfig.getPassword());
newdb.setEncrypt(dbConfig.isEncrypt());
- if(!dbConfig.getName().equals("Elecsticsearch") || !dbConfig.getName().equals("Druid"))
+ if(!dbConfig.getName().equals("Elecsticsearch") || dbConfig.getName().equals("Druid"))
{
newdb.setDatabase(new String(dbConfig.getDatabase()));
}
@ResponseBody
@ApiOperation(value="Get a database's details.")
public Db getDb(@PathVariable("dbName") String dbName, HttpServletResponse response) throws IOException {
- /*Db db = dbService.getDb(dbName);
- if (db == null) {
- sendError(response, 404, "Db not found: " + dbName);
- }*/
Db db = dbRepository.findByName(dbName);
if (db == null) {
sendError(response, 404, "Db not found: " + dbName);
@ResponseBody
@ApiOperation(value="Get a database's all topics.")
public Set<Topic> getDbTopics(@PathVariable("dbName") String dbName, HttpServletResponse response) throws IOException {
- //Db db = dbService.getDb(dbName);
Set<Topic> topics;
try {
Db db = dbRepository.findByName(dbName);
topics = db.getTopics();
- }catch(Exception ex)
- {
+ } catch(Exception ex) {
sendError(response, 404, "DB: " + dbName + " or Topics not found");
- return null;
+ return Collections.emptySet();
}
return topics;
}
-
//Update Db
@PutMapping("")
@ResponseBody
@ApiOperation(value="Retrieve feeder status.")
public String status() {
String status = "Feeder is running: "+pullService.isRunning();
- log.info("sending feeder status ...");//TODO we can send what topics are monitored, how many messages are sent, etc.
+ log.info("sending feeder status ..." + status);//TODO we can send what topics are monitored, how many messages are sent, etc.
return "{\"version\": \""+config.getDatalakeVersion()+"\", \"running\": "+pullService.isRunning()+"}";
}
@Column(name="`timeout_sec`", columnDefinition = "integer default 10")
private Integer timeout;
- //don't show this field in admin UI
- //@Column(name="`check_topic_interval_sec`", columnDefinition = "integer default 10")
-// private Integer checkTopicInterval;
-
@JsonBackReference
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable( name = "map_kafka_topic",
import java.util.List;
import java.util.Optional;
import java.util.Set;
+import java.util.Collections;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
db1.setTopics(topics);
setAccessPrivateFields(dbController);
Set<Topic> elecsticsearch = dbController.getDbTopics(dbName, httpServletResponse);
- assertEquals(null, elecsticsearch);
+ assertEquals(Collections.emptySet(), elecsticsearch);
when(dbRepository.findByName(dbName)).thenReturn(db1);
elecsticsearch = dbController.getDbTopics(dbName, httpServletResponse);
for (Topic anElecsticsearch : elecsticsearch) {