레이블이 watson인 게시물을 표시합니다. 모든 게시물 표시
레이블이 watson인 게시물을 표시합니다. 모든 게시물 표시

2018년 10월 16일 화요일

[watson-developer-cloud/java-sdk] #996

   요약


   메일
conversation is not entering into child node in Android Application

yashpatel001

Conversation service = new Conversation("2018-02-16");
service.setUsernameAndPassword("", "");

InputData input = new InputData.Builder("Hi").build();
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
MassageResponse response = service.message(options).execute();
System.out.println(response);

Conversation API : 6.7.0
Android sdk : 0.4.3
java sdk : 3.9.1

how to enter into shild node suggest me





   번역

conversation이 Android 애플리케이션 하위 노드에 들어가지 않습니다.

yashpatel001

Conversation service = new Conversation("2018-02-16");
service.setUsernameAndPassword("", "");

InputData input = new InputData.Builder("Hi").build();
MessageOptions options = new MessageOptions.Builder(workspaceId).input(input).build();
MassageResponse response = service.message(options).execute();
System.out.println(response);

Conversation API : 6.7.0
Android sdk : 0.4.3
java sdk : 3.9.1

shild 노드에 넣는 방법을 알려주세요.



[watson-developer-cloud/java-sdk] #994


   요약
StringHelper.createFormPartName() 및 test가 추가되었습니다.

   메일
Added StringHelper.createFormPartName and tests

Phil Adams

Summary
The new StringHelper.createFormPartName() function introduced by this PR will be used by generated java code when the "mapified form parameter" feature is used.


Mike Kistler

@mkistler requested changes on this pull request.

I think we can avoid adding this code to the SDK with some small changes to the generator.


> +     * Creates a parameterized part name for a form part based on a template and a key name and value.
+     * Example:
+     *     template: "{classname}_positive_examples"
+     *     keyName:  "classname"
+     *     keyValue: "truck"
+     *     result: "truck_positive_examples"
+     *
+     * @param template the part name template
+     * @param keyName the name of the key within the template
+     * @param keyValue the value of the key to use as a replacement
+     * @return
+     */
+    public static String createFormPartName(String template, String keyName, String keyValue) {
+        String toBeReplaced = "{" + keyName + "}";
+        return template.replace(toBeReplaced, keyValue);
+    }
It seems like we could avoid having this special function if we did just a little more work in the generator.
In particular, I think we could, in the generator, create a "format string" from the template:
"{classname}_positive_examples" -> "%s_positive_examples"
Then in the service method, we change
String partName = StringHelper.createFormPartName("{{partNameTemplate}}", "{{mapKeyName}}", entry.getKey());
to
String partName = String.format("{{partNameFormatString}}", entry.getKey());

Codecov

Codecov Report
Merging #994 into master will decrease coverage by <.01%.
The diff coverage is 100%.
....

Phil Adams

This PR will not be needed afterall...

   번역
StringHelper.createFormPartName 및 tests가 추가되었습니다.

Phil Adams

개요
이 PR로 도입된 새로운 StringHelper.createFormPartName() 함수는 "mapified form parameter" 기능이 사용될 때 생성된 java code에 의해 사용됩니다.

Mike Kistler

@mkistler pull 요청에 대한 변경을 요청했습니다.

생성자에 조금 변경을 가하면 이 코드를 SDK에 추가하는 것을 피할 수 있을 겁니다.


> +     * Creates a parameterized part name for a form part based on a template and a key name and value.
+     * Example:
+     *     template: "{classname}_positive_examples"
+     *     keyName:  "classname"
+     *     keyValue: "truck"
+     *     result: "truck_positive_examples"
+     *
+     * @param template the part name template
+     * @param keyName the name of the key within the template
+     * @param keyValue the value of the key to use as a replacement
+     * @return
+     */
+    public static String createFormPartName(String template, String keyName, String keyValue) {
+        String toBeReplaced = "{" + keyName + "}";
+        return template.replace(toBeReplaced, keyValue);
+    }
생성자에 좀 더 많은 작업을 했다면, 이 특수 function을 사용하지 않아도 될 것 같습니다.
특히 생성자에서 템플릿으로부터 "형식 string"을 만들 수 있다고 생각합니다.
"{classname}_positive_examples" -> "%s_positive_examples"
그런 다음 서비스 method에서 
String partName = StringHelper.createFormPartName("{{partNameTemplate}}", "{{mapKeyName}}", entry.getKey());
String partName = String.format("{{partNameFormatString}}", entry.getKey());

로 변경합니다.

Codecov

Codecov Report
#994를 master에 merge하면 적용범휘가 <.01 % 감소합니다.
변경된 적용범위는 100%입니다.
....

Phil Adams

결국 이 PR은 필요없을 것입니다...

[watson-develope-cloud/java-sdk] #995

   요약
#995 RequestBuilder에 HTTP HEAD를 추가합니다.

   내용
feat(Core): Add HTTP HEAD method to RequestBuilder

Rich Ellis

Summary
Add the HTTP HEAD method to com.ibm.watson.developer_cloud.http.RequestBuilder, which did not include it.

Added two new tests:

  • RequestBuilderTest#testHead() to check we can build a head request
  • ResponseTest#testExecuteWithDetailsForHead() to validate that the headers can be retrieved from the Response when using the head method.
Other Information
There is a slight weirdness in the test's header assertion assertEquals(expectedHeaders, actualHeaders) appears not to work because the underlying Headers class equality fails-I believe the MockWebServer and the Headers. of(...) methods different whitespace in the Headers object. Calling toString() on both objects produces identical strings that do pass an equals assertion.


Codecov Report

Merging #995 into master will decrease coverage by 23.71%.
The diff coverage is 100%
...

Coday Bot

Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- core/src/main/java/com/ibm/watson/developer_cloud/http/RequestBuilder.java  1
         

Clones removed
==============
+ core/src/test/java/com/ibm/watson/developer_cloud/service/ResponseTest.java  -1
         
See the complete overview on Codacy.

German Attanasio

@germanattanasio approved this pull request.

Logan Patino

This looks good to me I'll merge it in and it'll be included in the next release.
Thanks for the contribution!

   해석

feat(Core): RequestBuilder에 HTTP HEAD를 추가합니다.

Rich Ellis

개요
HTTP HEAD method가 com.ibm.watson.developer_cloud.http.RequestBuilder 에 포함되지 않아 추가합니다.

두 개의 새로운 tests를 추가:
  • RequestBuilderTest#testHead() head를 build할 수 있는지 확인합니다.
  • ResponseTest#testExecuteWithDetailsForHead() head method를 사용할 때, 응답에서 헤더를 검색할 수 있는지 확인합니다.

기타 정보
test의 header assertion에 약간 이상한 점이 있습니다. assertEquals(expectedHeaders, actualHeaders)가 기본 헤더 클래스 동등성이 실패하기 때문에 작동하지 않습니다 - I MockWebServer와 Header 때문이라 생각합니다. of(...) method가 Header 객체의 각기 다른 공백을 처리합니다. 두 Header 객체에서 toString()을 호출하면 같은 assertion을 전달하는 동일한 문자열이 생성됩니다.