Comment test out and add null check for tenant and baseUrl

Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-04-26 11:14:23 +02:00
parent d67e0c6381
commit 05d9536cae
3 changed files with 18 additions and 20 deletions

View File

@@ -8,6 +8,7 @@
*/
package org.eclipse.hawkbit.ddi.client;
import org.apache.commons.lang.Validate;
import org.eclipse.hawkbit.ddi.client.resource.RootControllerResourceClient;
import feign.Feign;
@@ -17,7 +18,7 @@ import feign.Logger.Level;
import feign.jackson.JacksonEncoder;
/**
* @author Jonathan Knoblauch
* TODO
*
*/
public class DdiDefaultFeignClient {
@@ -32,18 +33,10 @@ public class DdiDefaultFeignClient {
feignBuilder = Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract())
.requestInterceptor(new ApplicationJsonRequestHeaderInterceptor()).logLevel(Level.FULL)
.logger(new Logger.ErrorLogger()).encoder(new JacksonEncoder()).decoder(new DdiDecoder());
if (baseUrl == null) {
throw new IllegalStateException("A baseUrl has to be set");
}
if (tenant == null) {
throw new IllegalStateException("A tenant has to be set");
}
Validate.notNull(baseUrl, "A baseUrl has to be set");
Validate.notNull(tenant, "A tenant has to be set");
this.baseUrl = baseUrl;
this.tenant = tenant;
}
public Builder getFeignBuilder() {
@@ -52,12 +45,9 @@ public class DdiDefaultFeignClient {
public RootControllerResourceClient getRootControllerResourceClient() {
// TODO tenant null throw exception
if (rootControllerResourceClient == null) {
String rootControllerResourcePath = this.baseUrl + RootControllerResourceClient.PATH;
rootControllerResourcePath = rootControllerResourcePath.replace("{tenant}", tenant);
rootControllerResourceClient = feignBuilder.target(RootControllerResourceClient.class,
rootControllerResourcePath);
}

View File

@@ -1,6 +1,5 @@
package org.eclipse.hawkbit.example.ddi.client;
import org.eclipse.hawkbit.ddi.client.DdiExampleClient;
import org.junit.Test;
/**
@@ -10,11 +9,14 @@ public class AppTest {
@Test
public void AppTest() {
final DdiExampleClient ddiClient = new DdiExampleClient("http://localhost:8080/", "jktest", "DEFAULT");
ddiClient.run();
System.out.println("next steps........................");
// final DdiExampleClient ddiClient = new
// DdiExampleClient("http://localhost:8080/", "Einstein1", "DEFAULT",
// 2000,
// new SaveArtifactsStrategy());
// final Thread thread = new Thread(ddiClient);
// thread.run();
//
// System.out.println("next steps........................");
}
}