Search in sources :

Example 1 with RequestDataBuilderForTests

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);
}
Also used : SSOToken(org.simbasecurity.api.service.thrift.SSOToken) RequestDataBuilderForTests(org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests) SimbaCredentialsBuilderForTests(org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentialsBuilderForTests) RequestData(org.simbasecurity.api.service.thrift.RequestData) Test(org.junit.Test)

Example 2 with RequestDataBuilderForTests

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);
}
Also used : RequestDataBuilderForTests(org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests) SimbaCredentialsBuilderForTests(org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentialsBuilderForTests) RequestData(org.simbasecurity.api.service.thrift.RequestData) Test(org.junit.Test)

Example 3 with RequestDataBuilderForTests

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);
}
Also used : RequestDataBuilderForTests(org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests) SimbaCredentialsBuilderForTests(org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentialsBuilderForTests) RequestData(org.simbasecurity.api.service.thrift.RequestData) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 RequestData (org.simbasecurity.api.service.thrift.RequestData)3 SimbaCredentialsBuilderForTests (org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentialsBuilderForTests)3 RequestDataBuilderForTests (org.simbasecurity.dwclient.test.stub.simba.RequestDataBuilderForTests)3 SSOToken (org.simbasecurity.api.service.thrift.SSOToken)1