Search in sources :

Example 1 with KoreAIResponseBuilderImpl

use of org.finos.symphony.toolkit.koreai.response.KoreAIResponseBuilderImpl in project spring-bot by finos.

the class KoreAIResponseHandlerImplTest method setup.

@BeforeEach
public void setup() throws Exception {
    om = new ObjectMapper();
    ObjectMapperFactory.initialize(om, ObjectMapperFactory.extendedSymphonyVersionSpace(new VersionSpace(KoreAIResponse.class)));
    this.builder = new KoreAIResponseBuilderImpl(new ObjectMapper(), JsonNodeFactory.instance);
    this.output = new KoreAIResponseHandlerImpl(api, rl, true, true, om, "classpath:/test-templates");
    Mockito.when(api.v4StreamSidMessageCreatePost(Mockito.isNull(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull())).then((a) -> {
        streamId.add(a.getArgument(1));
        messageMLResponse.add(a.getArgument(2));
        jsonResponse.add(a.getArgument(3));
        return null;
    });
    jsonResponse = new ArrayList<String>();
    messageMLResponse = new ArrayList<String>();
    streamId = new ArrayList<String>();
}
Also used : VersionSpace(org.finos.symphony.toolkit.json.VersionSpace) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) KoreAIResponseBuilderImpl(org.finos.symphony.toolkit.koreai.response.KoreAIResponseBuilderImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with KoreAIResponseBuilderImpl

use of org.finos.symphony.toolkit.koreai.response.KoreAIResponseBuilderImpl in project spring-bot by finos.

the class KoreAIRequesterImplTest method setupWireMock.

@BeforeEach
public void setupWireMock() throws Exception {
    String response = StreamUtils.copyToString(KoreAIRequesterImplTest.class.getResourceAsStream("ans1.json"), Charsets.UTF_8);
    wireMockRule.stubFor(post(urlEqualTo("/kore")).withHeader("Authorization", new EqualToPattern("Bearer some-jwt")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(response)));
    requester = new KoreAIRequesterImpl(responseHandler, new KoreAIResponseBuilderImpl(om, JsonNodeFactory.instance), "http://localhost:9998/kore", JsonNodeFactory.instance, "some-jwt");
    ((KoreAIRequesterImpl) requester).afterPropertiesSet();
    wireMockRule.start();
}
Also used : EqualToPattern(com.github.tomakehurst.wiremock.matching.EqualToPattern) KoreAIResponseBuilderImpl(org.finos.symphony.toolkit.koreai.response.KoreAIResponseBuilderImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

KoreAIResponseBuilderImpl (org.finos.symphony.toolkit.koreai.response.KoreAIResponseBuilderImpl)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 EqualToPattern (com.github.tomakehurst.wiremock.matching.EqualToPattern)1 VersionSpace (org.finos.symphony.toolkit.json.VersionSpace)1