- GET /features is now tested on controller level
- added DataService as a data provider
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
package click.poweronoff.satellite.api;
|
||||
|
||||
|
||||
import click.poweronoff.satellite.domain.Feature;
|
||||
import click.poweronoff.satellite.service.DataService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class FeaturesController {
|
||||
@RequestMapping("/features")
|
||||
|
||||
@Autowired
|
||||
DataService dataService;
|
||||
|
||||
@RequestMapping(value = "/features", method = RequestMethod.GET, produces = "application/json")
|
||||
public @ResponseBody
|
||||
String features() {
|
||||
return "a dummy message";
|
||||
List<Feature> features() {
|
||||
return dataService.getAllFeatures();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package click.poweronoff.satellite.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
public class Feature {
|
||||
|
||||
private String id;
|
||||
|
||||
private long timestamp;
|
||||
|
||||
private long beginViewingDate;
|
||||
|
||||
private long endViewingDate;
|
||||
|
||||
private String missionName;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package click.poweronoff.satellite.service;
|
||||
|
||||
import click.poweronoff.satellite.domain.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DataService {
|
||||
|
||||
/**
|
||||
* returned all possible Features as a list
|
||||
*
|
||||
* @return list of Features
|
||||
*/
|
||||
List<Feature> getAllFeatures();
|
||||
|
||||
/**
|
||||
* returned specific Feature by given id
|
||||
*
|
||||
* @param featureId feature id
|
||||
* @return Feature
|
||||
*/
|
||||
Feature getFeature(final String featureId);
|
||||
|
||||
|
||||
/**
|
||||
* returned a picture as a Base64 encoded String representation for given feature id
|
||||
*
|
||||
* @param featureId feature id
|
||||
* @return a Base64 encoded String representation for a picture
|
||||
*/
|
||||
String getPictureAsB64(final String featureId);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package click.poweronoff.satellite.service;
|
||||
|
||||
import click.poweronoff.satellite.domain.Feature;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class DataServiceImpl implements DataService {
|
||||
|
||||
public List<Feature> getAllFeatures() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feature getFeature(String featureId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPictureAsB64(String featureId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user