'분류 전체보기'에 해당되는 글 666건
- 2021.01.10 spring boot batch mysql sample
- 2020.12.31 spring5 webclient post json sample
- 2020.12.23 노트북 모델명
- 2020.12.21 jooq, call function
- 2020.09.15 SAS, if then do
- 2020.09.11 javascript, querySelector
- 2020.09.11 javascript, canvas
- 2020.09.11 javascript, generator
- 2020.09.11 javascript, Promise
- 2020.09.10 soa msa
package com.example.demo;
/*https://github.com/hellokoding/hellokoding-courses/blob/master/spring-examples/spring-webflux/src/test/java/com/hellokoding/spring/WebClientTest.java
* */
import org.junit.jupiter.api.Test;
//import org.springframework.http.HttpHeaders;
//import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
//import static org.springframework.web.reactive.function.BodyInserters.fromFormData;
import org.springframework.http.MediaType;
//import org.springframework.util.LinkedMultiValueMap;
//import org.springframework.util.MultiValueMap;
import static org.assertj.core.api.Assertions.assertThat;
public class WebClientTest {
@Test
public void buildAnHttpRequest() {
WebClient webClient = WebClient.create("http://localhost:8080");
String request = "{\"id\":[\"HongKildong\"],\"name\":\"홍길동\"}";
Mono<String> result = webClient.mutate()
.baseUrl("http://localhost:8080")
.build()
.post()
.uri("/member/register")
.bodyValue(request)
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(String.class);
assertThat(result.block())
.isEqualTo("{\"attributes\":{},\"message\":\"등록 성공했습니다\"}");
}
}
/* DB함수 실행 후, 리턴 값 할당 */
Long prd_no = context.select(fnGetSchPoint(keyword)).fetchOne(0, Long.class);
www.jooq.org/doc/3.14/manual/sql-execution/stored-procedures/
THEN 뒤에 실행한 조건문이 두 개 이상일 경우 THEN DO문장을 사용합니다.
(www.mysas.co.kr/SAS_tiptech/a_question.asp?B_NO=2041&gotopage=4&cmd=content)
<canvas width="600" height="300"></canvas>
<script>
let cx = document.querySelector("canvas").getContext("2d");
function branch(length, angle, scale) {
cx.fillRect(0, 0, 1, length);
if (length < 8) return;
cx.save();
cx.translate(0, length);
cx.rotate(-angle);
branch(length * scale, angle, scale);
cx.rotate(2 * angle);
branch(length * scale, angle, scale);
cx.restore();
}
cx.translate(300, 0);
branch(60, 0.5, 0.8);
</script>
(https://eloquentjavascript.net)
function* idMaker(){
var index = 0;
while(true)
yield index++;
}
var gen = idMaker(); // "Generator { }"
console.log(gen.next().value); // 0
console.log(gen.next().value); // 1
console.log(gen.next().value); // 2
(https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Generator)
let myFirstPromise = new Promise((resolve, reject) => {
// We call resolve(...) when what we were doing asynchronously was successful, and reject(...) when it failed.
// In this example, we use setTimeout(...) to simulate async code.
// In reality, you will probably be using something like XHR or an HTML5 API.
setTimeout(function(){
resolve("Success!"); // Yay! Everything went well!
}, 250);
});
myFirstPromise.then((successMessage) => {
// successMessage is whatever we passed in the resolve(...) function above.
// It doesn't have to be a string, but if it is only a succeed message, it probably will be.
console.log("Yay! " + successMessage);
});
(https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Promise)