本文整理汇总了Java中com.amazon.speech.json.SpeechletResponseEnvelope类的典型用法代码示例。如果您正苦于以下问题:Java SpeechletResponseEnvelope类的具体用法?Java SpeechletResponseEnvelope怎么用?Java SpeechletResponseEnvelope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpeechletResponseEnvelope类属于com.amazon.speech.json包,在下文中一共展示了SpeechletResponseEnvelope类的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doPost
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Override
// A. It must be a POST request.
protected void doPost(final HttpServletRequest httpRequest, final HttpServletResponse httpResponse) throws ServletException, IOException {
byte[] serializedSpeechletRequest = IOUtils.toByteArray(httpRequest.getInputStream());
try {
if (this.checkAmazonSignature) {
// B. It must come from the Amazon Alexa cloud.
SpeechletRequestSignatureVerifier.checkRequestSignature(serializedSpeechletRequest,
httpRequest.getHeader(Sdk.SIGNATURE_REQUEST_HEADER),
httpRequest.getHeader(Sdk.SIGNATURE_CERTIFICATE_CHAIN_URL_REQUEST_HEADER));
}
final SpeechletRequestEnvelope<?> requestEnvelope = SpeechletRequestEnvelope.fromJson(serializedSpeechletRequest);
for (SpeechletRequestEnvelopeVerifier verifier : this.requestEnvelopeVerifiers) {
if (!verifier.verify(requestEnvelope)) {
throw new SpeechletRequestHandlerException(this.createExceptionMessage(verifier, requestEnvelope));
}
}
HttpEntity<byte[]> requestEntity = new HttpEntity<>(serializedSpeechletRequest);
ResponseEntity<SpeechletResponseEnvelope> speechletResponse = this.restTemplate.postForEntity(
this.endpoint, requestEntity, SpeechletResponseEnvelope.class);
if (speechletResponse.getStatusCode().is2xxSuccessful() && speechletResponse.hasBody()) {
byte[] outputBytes = speechletResponse.getBody().toJsonBytes();
httpResponse.setContentType("application/json");
httpResponse.setStatus(speechletResponse.getStatusCodeValue());
httpResponse.setContentLength(outputBytes.length);
httpResponse.getOutputStream().write(outputBytes);
} else {
// Should never happen, cause all edge cases are already covered by actual exceptions thrown.
httpResponse.sendError(speechletResponse.getStatusCodeValue(), "Unexpected error in proxy");
}
} catch (Exception e) {
int statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
if (BAD_REQUEST_EXCEPTION_TYPES.contains(e.getClass())) {
statusCode = HttpServletResponse.SC_BAD_REQUEST;
}
this.log.error("Exception occurred in doPost, returning status code {}", statusCode, e);
httpResponse.sendError(statusCode, e.getClass().getSimpleName() + ": " + e.getMessage());
}
}
开发者ID:ewjmulder,
项目名称:alexa-proxy,
代码行数:44,
代码来源:AlexaProxyServlet.java
示例2: nextEvents
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void nextEvents() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
doReturn(events).when(toTestQuery.calendarService).getNextEvents();
doReturn(speech).when(toTestQuery.speechService).readEvents(any(), anyList());
HttpEntity<String> request = buildRequest("NextEvents");
//when
final SpeechletResponseEnvelope response = perform(request);
//then
verify(toTestQuery.calendarService, times(1)).getNextEvents();
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
speech.getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:24,
代码来源:CalendarSpeechletIT.java
示例3: nextEvents_readError
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void nextEvents_readError() throws CalendarReadException {
//given
doThrow(new CalendarReadException("error")).when(toTestQuery.calendarService).getNextEvents();
HttpEntity<String> request = buildRequest("NextEvents");
//when
final SpeechletResponseEnvelope response = perform(request);
//then
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
msg.de("event.error.read"),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:18,
代码来源:CalendarSpeechletIT.java
示例4: testUseCase
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
private void testUseCase(String precision, String day,
Moment expectedMoment, OutputSpeech expectedSpeech) throws CalendarReadException {
//when
HttpEntity<String> request = buildRequest("EventQuery",
"precision", precision, "day", day);
final SpeechletResponseEnvelope response = perform(request);
//then
verify(toTestQuery.speechService, times(1)).readEvents(
eq(Locale.GERMANY), eq(expectedMoment.getName(Locale.GERMANY)), anyList());
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
((PlainTextOutputSpeech)expectedSpeech).getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:20,
代码来源:CalendarSpeechletIT.java
示例5: eventQuery_unknownDay
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void eventQuery_unknownDay() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
//when
HttpEntity<String> request = buildRequest("EventQuery",
"precision", "diesen", "day", "tag");
final SpeechletResponseEnvelope response = perform(request);
//then
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
msg.de("event.error.unknown.moment"),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:21,
代码来源:CalendarSpeechletIT.java
示例6: eventQuery_unknownPrasicion
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void eventQuery_unknownPrasicion() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
doReturn(events).when(toTestQuery.calendarService).getEvents(any(), any());
doReturn(speech).when(toTestQuery.speechService).readEvents(any(), anyString(), anyList());
//when
HttpEntity<String> request = buildRequest("EventQuery",
"precision", "unbekannt", "day", "montag");
final SpeechletResponseEnvelope response = perform(request);
//then
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
msg.de("event.error.unknown.moment"),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:24,
代码来源:CalendarSpeechletIT.java
示例7: nearEvents_unknown
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void nearEvents_unknown() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
doReturn(events).when(toTestQuery.calendarService).getEvents(any(), any());
doReturn(speech).when(toTestQuery.speechService).readEvents(any(), anyString(), anyList());
//when
HttpEntity<String> request = buildRequest("EventQueryNear",
"near", "unbekannt");
final SpeechletResponseEnvelope response = perform(request);
//then
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
msg.de("event.error.unknown.moment"),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:24,
代码来源:CalendarSpeechletIT.java
示例8: thisWeek
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void thisWeek() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
doReturn(events).when(toTestQuery.calendarService).getEvents(any(), any());
doReturn(speech).when(toTestQuery.speechService).readEvents(any(), anyString(), anyList());
//when
HttpEntity<String> request = buildRequest("EventQueryThisWeek");
final SpeechletResponseEnvelope response = perform(request);
//then
verify(toTestQuery.speechService, times(1)).readEvents(
eq(Locale.GERMANY), eq(Moment.THIS_WEEK.getName(Locale.GERMANY)), anyList());
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
speech.getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:26,
代码来源:CalendarSpeechletIT.java
示例9: nextWeek
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void nextWeek() throws CalendarReadException {
//given
final PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("<event-listing>");
List<Event> events = new ArrayList<>();
doReturn(events).when(toTestQuery.calendarService).getEvents(any(), any());
doReturn(speech).when(toTestQuery.speechService).readEvents(any(), anyString(), anyList());
//when
HttpEntity<String> request = buildRequest("EventQueryNextWeek");
final SpeechletResponseEnvelope response = perform(request);
//then
verify(toTestQuery.speechService, times(1)).readEvents(
eq(Locale.GERMANY), eq(Moment.NEXT_WEEK.getName(Locale.GERMANY)), anyList());
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
speech.getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:26,
代码来源:CalendarSpeechletIT.java
示例10: doPost
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
private SpeechletResponseEnvelope doPost(final AlexaSpeechletServlet servlet, final SpeechletRequestEnvelope envelope) throws Exception {
final HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
final InputStream stream = convertToStream(envelope);
final ServletInputStream servletInputStream = new ServletInputStream() {
@Override
public int read() throws IOException {
return stream.read();
}
};
when(request.getInputStream()).thenReturn(servletInputStream);
when(request.getReader()).thenReturn(new BufferedReader(new InputStreamReader(stream)));
final ByteArrayOutputStream responseStream = new ByteArrayOutputStream();
final HttpServletResponse response = givenServletResponse(responseStream);
servlet.doPost(request, response);
return convertToResponseEnvelope(responseStream);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:21,
代码来源:AlexaSpeechletServletTest.java
示例11: assertValidLaunchResponse
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
public static void assertValidLaunchResponse(final SpeechletResponseEnvelope responseEnvelope) {
Assert.assertNotNull(responseEnvelope);
Assert.assertNotNull(responseEnvelope.getResponse());
Assert.assertFalse(responseEnvelope.getResponse().getShouldEndSession());
Assert.assertNotNull(responseEnvelope.getResponse().getOutputSpeech());
Assert.assertTrue(responseEnvelope.getResponse().getOutputSpeech() instanceof SsmlOutputSpeech);
final SsmlOutputSpeech outputSpeech = (SsmlOutputSpeech)responseEnvelope.getResponse().getOutputSpeech();
Assert.assertEquals(outputSpeech.getSsml(), "<speak>Hello there</speak>");
Assert.assertNotNull(responseEnvelope.getResponse().getReprompt());
Assert.assertNotNull(responseEnvelope.getResponse().getReprompt().getOutputSpeech());
Assert.assertTrue(responseEnvelope.getResponse().getReprompt().getOutputSpeech() instanceof SsmlOutputSpeech);
final SsmlOutputSpeech repromptSpeech = (SsmlOutputSpeech)responseEnvelope.getResponse().getReprompt().getOutputSpeech();
Assert.assertEquals(repromptSpeech.getSsml(), "<speak>Hello again</speak>");
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:18,
代码来源:Assertions.java
示例12: assertValidIntentResponse
点赞 3
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
public static void assertValidIntentResponse(final SpeechletResponseEnvelope responseEnvelope) {
Assert.assertNotNull(responseEnvelope);
Assert.assertNotNull(responseEnvelope.getResponse());
Assert.assertFalse(responseEnvelope.getResponse().getShouldEndSession());
Assert.assertNotNull(responseEnvelope.getResponse().getOutputSpeech());
Assert.assertTrue(responseEnvelope.getResponse().getOutputSpeech() instanceof SsmlOutputSpeech);
final SsmlOutputSpeech outputSpeech = (SsmlOutputSpeech)responseEnvelope.getResponse().getOutputSpeech();
Assert.assertEquals(outputSpeech.getSsml(), "<speak>Hello <say-as interpret-as=\"spell-out\">Joe</say-as>. Your current score is <say-as interpret-as=\"number\">123</say-as></speak>");
Assert.assertNotNull(responseEnvelope.getResponse().getReprompt());
Assert.assertNotNull(responseEnvelope.getResponse().getReprompt().getOutputSpeech());
Assert.assertTrue(responseEnvelope.getResponse().getReprompt().getOutputSpeech() instanceof SsmlOutputSpeech);
final SsmlOutputSpeech repromptSpeech = (SsmlOutputSpeech)responseEnvelope.getResponse().getReprompt().getOutputSpeech();
Assert.assertEquals(repromptSpeech.getSsml(), "<speak>This is a reprompt <say-as interpret-as=\"spell-out\">Joe</say-as> with your score of <say-as interpret-as=\"number\">123</say-as></speak>");
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:18,
代码来源:Assertions.java
示例13: help
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void help(){
//given
HttpEntity<String> request = buildRequest("AMAZON.HelpIntent");
//when
final SpeechletResponseEnvelope response = perform(request);
//then
assertNull(response.getResponse().getCard());
assertTrue(response.getResponse().getOutputSpeech() instanceof PlainTextOutputSpeech);
assertEquals(
msg.de("help"),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:16,
代码来源:CalendarSpeechletIT.java
示例14: newEvent
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void newEvent() throws CalendarWriteException {
//given
//when
HttpEntity<String> request = buildRequest("NewEvent");
final SpeechletResponseEnvelope response = perform(request);
//then
assertFalse(response.getResponse().getDirectives().isEmpty());
assertTrue(response.getResponse().getDirectives().get(0) instanceof DelegateDirective);
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:13,
代码来源:CalendarSpeechletIT.java
示例15: cancel_dialog
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void cancel_dialog() throws CalendarWriteException {
//given
//when
HttpEntity<String> request = buildRequestWithSession("AMAZON.CancelIntent",
new SimpleEntry<>(KEY_DIALOG_TYPE, DIALOG_TYPE_NEW_EVENT)
);
final SpeechletResponseEnvelope response = perform(request);
//then
assertEquals(
((PlainTextOutputSpeech)toTestBasic.speechService.speechCancelNewEvent(Locale.GERMANY)).getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:16,
代码来源:CalendarSpeechletIT.java
示例16: cancel_noDialog
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void cancel_noDialog() throws CalendarWriteException {
//given
//when
HttpEntity<String> request = buildRequestWithSession("AMAZON.CancelIntent");
final SpeechletResponseEnvelope response = perform(request);
//then
assertEquals(
((PlainTextOutputSpeech)toTestBasic.speechService.speechBye(Locale.GERMANY)).getText(),
((PlainTextOutputSpeech)response.getResponse().getOutputSpeech()).getText());
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:14,
代码来源:CalendarSpeechletIT.java
示例17: perform
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
private SpeechletResponseEnvelope perform(HttpEntity<String> request){
try {
final ResponseEntity<String> response = rest.postForEntity(BasicSpeechlet.ENDPOINT, request, String.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
return mapper.readValue(response.getBody(), SpeechletResponseEnvelope.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:rainu,
项目名称:alexa-skill,
代码行数:11,
代码来源:CalendarSpeechletIT.java
示例18: doLaunchPost
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void doLaunchPost() throws Exception {
final AlexaSpeechletServlet servlet = new SampleServlet();
final SpeechletRequestEnvelope envelope = ModelFactory.givenLaunchSpeechletRequestEnvelope("applicationId");
final SpeechletResponseEnvelope responseEnvelope = doPost(servlet, envelope);
Assertions.assertValidLaunchResponse(responseEnvelope);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:8,
代码来源:AlexaSpeechletServletTest.java
示例19: doIntentPost
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void doIntentPost() throws Exception {
final AlexaSpeechletServlet servlet = new SampleServlet();
Map<String, Slot> slots = new HashMap<>();
slots.put("name", Slot.builder().withName("name").withValue("Joe").build());
slots.put("credits", Slot.builder().withName("credits").withValue("123").build());
final SpeechletRequestEnvelope envelope = ModelFactory.givenIntentSpeechletRequestEnvelope("IntentWithOneUtteranceAndOneReprompt", "applicationId", slots);
final SpeechletResponseEnvelope responseEnvelope = doPost(servlet, envelope);
Assertions.assertValidIntentResponse(responseEnvelope);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:12,
代码来源:AlexaSpeechletServletTest.java
示例20: handleLaunchRequest
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void handleLaunchRequest() throws Exception {
final SampleRequestStreamHandler handler = new SampleRequestStreamHandler();
final SpeechletRequestEnvelope envelope = ModelFactory.givenLaunchSpeechletRequestEnvelope("applicationId");
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
handler.handleRequest(convertToStream(envelope), outputStream, ModelFactory.givenLambdaContext());
final SpeechletResponseEnvelope responseEnvelope = convertToResponseEnvelope(outputStream);
Assertions.assertValidLaunchResponse(responseEnvelope);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:13,
代码来源:AlexaRequestStreamHandlerTest.java
示例21: handleIntentRequest
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
@Test
public void handleIntentRequest() throws Exception {
Map<String, Slot> slots = new HashMap<>();
slots.put("name", Slot.builder().withName("name").withValue("Joe").build());
slots.put("credits", Slot.builder().withName("credits").withValue("123").build());
final SampleRequestStreamHandler handler = new SampleRequestStreamHandler();
final SpeechletRequestEnvelope envelope = ModelFactory.givenIntentSpeechletRequestEnvelope("IntentWithOneUtteranceAndOneReprompt", "applicationId", slots);
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
handler.handleRequest(convertToStream(envelope), outputStream, ModelFactory.givenLambdaContext());
final SpeechletResponseEnvelope responseEnvelope = convertToResponseEnvelope(outputStream);
Assertions.assertValidIntentResponse(responseEnvelope);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:16,
代码来源:AlexaRequestStreamHandlerTest.java
示例22: AlexaResponse
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
public AlexaResponse(final AlexaRequest request, final String requestPayload, final String responsePayload) {
this.request = request;
this.requestPayload = requestPayload;
this.responsePayload = responsePayload;
try {
envelope = mapper.readValue(responsePayload, SpeechletResponseEnvelope.class);
} catch (final IOException e) {
throw new RuntimeException("Invalid response format from Lambda function.", e);
}
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tester-java,
代码行数:11,
代码来源:AlexaResponse.java
示例23: is
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
/**
* Validates a custom predicate executed against the response envelope.
* @param responseEnvelope the response envelope of the request
* @param followUp code-block executes when condition is true
* @return this response
*/
public AlexaResponse is(final Predicate<SpeechletResponseEnvelope> responseEnvelope, final Consumer<AlexaSession> followUp) {
if (is(responseEnvelope)) {
followUp.accept(request.getSession());
}
return this;
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tester-java,
代码行数:13,
代码来源:AlexaResponse.java
示例24: convertToResponseEnvelope
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
private SpeechletResponseEnvelope convertToResponseEnvelope(final ByteArrayOutputStream stream) throws IOException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(stream.toByteArray(), SpeechletResponseEnvelope.class);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:5,
代码来源:AlexaSpeechletServletTest.java
示例25: convertToResponseEnvelope
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
private SpeechletResponseEnvelope convertToResponseEnvelope(final OutputStream outputStream) throws IOException {
final ObjectMapper mapper = new ObjectMapper();
return mapper.readValue(((ByteArrayOutputStream)outputStream).toByteArray(), SpeechletResponseEnvelope.class);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tellask-java,
代码行数:5,
代码来源:AlexaRequestStreamHandlerTest.java
示例26: getResponseEnvelope
点赞 2
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
public SpeechletResponseEnvelope getResponseEnvelope() {
return this.envelope;
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tester-java,
代码行数:4,
代码来源:AlexaResponse.java
示例27: assertThat
点赞 1
import com.amazon.speech.json.SpeechletResponseEnvelope; //导入依赖的package包/类
/**
* Validates a custom predicate executed against the response envelope. It
* throws an IllegalArgumentException in case the predicate is not true.
* @param responseEnvelope the response envelope of the request
* @return this response
*/
public AlexaResponse assertThat(final Predicate<SpeechletResponseEnvelope> responseEnvelope) {
final String assertionText = "Custom predicate ifMatch.";
return validate(is(responseEnvelope), assertionText);
}
开发者ID:KayLerch,
项目名称:alexa-skills-kit-tester-java,
代码行数:11,
代码来源:AlexaResponse.java