mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-19 16:41:53 +00:00
Cleanup code for variable usage. Remvoed dummy test classes.
This commit is contained in:
@@ -70,8 +70,10 @@ public class HABridge {
|
|||||||
theResources = new DeviceResource(bridgeSettings);
|
theResources = new DeviceResource(bridgeSettings);
|
||||||
// setup the class to handle the hue emulator rest api
|
// setup the class to handle the hue emulator rest api
|
||||||
theHueMulator = new HueMulator(theResources.getDeviceRepository());
|
theHueMulator = new HueMulator(theResources.getDeviceRepository());
|
||||||
|
theHueMulator.setupServer();
|
||||||
// setup the class to handle the upnp response rest api
|
// setup the class to handle the upnp response rest api
|
||||||
theSettingResponder = new UpnpSettingsResource(bridgeSettings);
|
theSettingResponder = new UpnpSettingsResource(bridgeSettings);
|
||||||
|
theSettingResponder.setupServer();
|
||||||
// wait for the sparkjava initialization of the rest api classes to be complete
|
// wait for the sparkjava initialization of the rest api classes to be complete
|
||||||
awaitInitialization();
|
awaitInitialization();
|
||||||
|
|
||||||
|
|||||||
@@ -75,17 +75,20 @@ public class DeviceResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getPointsymbol() {
|
public Map<String, String> getPointsymbol() {
|
||||||
Map<String, String> dummyValue = new HashMap<>();
|
if(pointsymbol == null)
|
||||||
dummyValue.put("1", "none");
|
{
|
||||||
dummyValue.put("2", "none");
|
pointsymbol = new HashMap<>();
|
||||||
dummyValue.put("3", "none");
|
pointsymbol.put("1", "none");
|
||||||
dummyValue.put("4", "none");
|
pointsymbol.put("2", "none");
|
||||||
dummyValue.put("5", "none");
|
pointsymbol.put("3", "none");
|
||||||
dummyValue.put("6", "none");
|
pointsymbol.put("4", "none");
|
||||||
dummyValue.put("7", "none");
|
pointsymbol.put("5", "none");
|
||||||
dummyValue.put("8", "none");
|
pointsymbol.put("6", "none");
|
||||||
|
pointsymbol.put("7", "none");
|
||||||
|
pointsymbol.put("8", "none");
|
||||||
|
}
|
||||||
|
|
||||||
return dummyValue;
|
return pointsymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPointsymbol(Map<String, String> pointsymbol) {
|
public void setPointsymbol(Map<String, String> pointsymbol) {
|
||||||
|
|||||||
@@ -54,11 +54,10 @@ public class HueMulator {
|
|||||||
mapper = new ObjectMapper(); //armzilla: work around Echo incorrect content type and breaking mapping. Map manually
|
mapper = new ObjectMapper(); //armzilla: work around Echo incorrect content type and breaking mapping. Map manually
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
repository = aDeviceRepository;
|
repository = aDeviceRepository;
|
||||||
setupEndpoints();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function sets up the sparkjava rest calls for the hue api
|
// This function sets up the sparkjava rest calls for the hue api
|
||||||
private void setupEndpoints() {
|
public void setupServer() {
|
||||||
log.info("Hue emulator service started....");
|
log.info("Hue emulator service started....");
|
||||||
// http://ip_address:port/api/{userId}/lights returns json objects of all lights configured
|
// http://ip_address:port/api/{userId}/lights returns json objects of all lights configured
|
||||||
get(HUE_CONTEXT + "/:userid/lights", "application/json", (request, response) -> {
|
get(HUE_CONTEXT + "/:userid/lights", "application/json", (request, response) -> {
|
||||||
|
|||||||
@@ -90,10 +90,9 @@ public class UpnpSettingsResource {
|
|||||||
public UpnpSettingsResource(BridgeSettings theSettings) {
|
public UpnpSettingsResource(BridgeSettings theSettings) {
|
||||||
super();
|
super();
|
||||||
this.theSettings = theSettings;
|
this.theSettings = theSettings;
|
||||||
setupListener(this.theSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupListener (BridgeSettings theSettings) {
|
public void setupServer() {
|
||||||
log.info("Hue description service started....");
|
log.info("Hue description service started....");
|
||||||
// http://ip_adress:port/description.xml which returns the xml configuration for the hue emulator
|
// http://ip_adress:port/description.xml which returns the xml configuration for the hue emulator
|
||||||
get("/description.xml", "application/xml; charset=utf-8", (request, response) -> {
|
get("/description.xml", "application/xml; charset=utf-8", (request, response) -> {
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.test;
|
|
||||||
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class TestBean {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
try {
|
|
||||||
InetAddress address = InetAddress.getLocalHost();
|
|
||||||
System.out.println("Using InetAddress");
|
|
||||||
System.out.println("Host Address: "+ address.getHostAddress());
|
|
||||||
System.out.println("Host Name: "+ address.getHostName());
|
|
||||||
System.out.println("Address List: "+ Arrays.toString(InetAddress.getAllByName(address.getHostName())));
|
|
||||||
System.out.println("CanonicalHostName: "+ address.getCanonicalHostName());
|
|
||||||
System.out.println("Address: "+ address.getAddress());
|
|
||||||
System.out.println("LocalHost: "+ address.getLocalHost());
|
|
||||||
System.out.println("LoopbackAddress: "+ address.getLoopbackAddress());
|
|
||||||
|
|
||||||
String os = "os.name";
|
|
||||||
String version = "os.version";
|
|
||||||
String arch = "os.arch";
|
|
||||||
System.out.println("Name of the OS: "+ System.getProperty(os));
|
|
||||||
System.out.println("Version of the OS: "+ System.getProperty(version));
|
|
||||||
System.out.println("Architecture of the OS: "+ System.getProperty(arch));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package demo;
|
|
||||||
|
|
||||||
import com.bwssystems.HABridge.HABridge;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Dummy test holder
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class DemoApplicationTests {
|
|
||||||
|
|
||||||
public void contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user