use of org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests in project simba-os by cegeka.
the class SimbaCredentialsTest method asRequestData_ReturnsRequestDataFromInternals.
@Test
public void asRequestData_ReturnsRequestDataFromInternals() throws Exception {
Map<String, String> requestHeaders = Maps.newHashMap();
requestHeaders.put(HttpHeaders.WWW_AUTHENTICATE, "auth-string");
Map<String, String> requestParameters = Maps.newHashMap();
requestParameters.put("format", "timeseries");
SimbaCredentials simbaCredentials = new SimbaCredentialsBuilderForTests().withRequestUrl(SimbaCredentialsBuilderForTests.REQUESTURL + "?format=timeseries").withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsotoken("123456").withIsLoginRequest(true).build();
RequestData expected = new RequestDataBuilderForTests().withHostServerName(HOSTSERVERNAME).withRequestMethod(HTTP_METHOD).withRequestUrl(REQUESTURL + "?format=timeseries").withSimbaWebURL(SIMBAWEBURL).withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsoToken(new SSOToken("123456")).withLoginRequest(true).build();
RequestData actual = simbaCredentials.asRequestData();
assertThat(actual).isEqualTo(expected);
}
use of org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests in project simba-os by cegeka.
the class SimbaCredentialsTest method asRequestData_IfNoSSOTokenOnCredentials_ReturnsRequestDataWithSSOTokenNull.
@Test
public void asRequestData_IfNoSSOTokenOnCredentials_ReturnsRequestDataWithSSOTokenNull() throws Exception {
Map<String, String> requestHeaders = Maps.newHashMap();
requestHeaders.put(HttpHeaders.WWW_AUTHENTICATE, "auth-string");
Map<String, String> requestParameters = Maps.newHashMap();
requestParameters.put("format", "timeseries");
SimbaCredentials simbaCredentials = new SimbaCredentialsBuilderForTests().withRequestUrl(SimbaCredentialsBuilderForTests.REQUESTURL + "?format=timeseries").withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsotoken(null).build();
RequestData expected = new RequestDataBuilderForTests().withHostServerName(HOSTSERVERNAME).withRequestMethod(HTTP_METHOD).withRequestUrl(REQUESTURL + "?format=timeseries").withSimbaWebURL(SIMBAWEBURL).withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsoToken(null).build();
RequestData actual = simbaCredentials.asRequestData();
assertThat(actual).isEqualTo(expected);
}
use of org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests in project simba-os by cegeka.
the class SimbaCredentialsTest method asRequestData_IfEmptySSOTokenOnCredentials_ReturnsRequestDataWithSSOTokenNull.
@Test
public void asRequestData_IfEmptySSOTokenOnCredentials_ReturnsRequestDataWithSSOTokenNull() throws Exception {
Map<String, String> requestHeaders = Maps.newHashMap();
requestHeaders.put(HttpHeaders.WWW_AUTHENTICATE, "auth-string");
Map<String, String> requestParameters = Maps.newHashMap();
requestParameters.put("format", "timeseries");
SimbaCredentials simbaCredentials = new SimbaCredentialsBuilderForTests().withRequestUrl(SimbaCredentialsBuilderForTests.REQUESTURL + "?format=timeseries").withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsotoken("").build();
RequestData expected = new RequestDataBuilderForTests().withHostServerName(HOSTSERVERNAME).withRequestMethod(HTTP_METHOD).withRequestUrl(REQUESTURL + "?format=timeseries").withSimbaWebURL(SIMBAWEBURL).withRequestHeaders(requestHeaders).withRequestParameters(requestParameters).withSsoToken(null).build();
RequestData actual = simbaCredentials.asRequestData();
assertThat(actual).isEqualTo(expected);
}
Aggregations