|
17 | 17 | package io.supertokens.test; |
18 | 18 |
|
19 | 19 | import com.google.gson.JsonObject; |
20 | | -import io.supertokens.config.Config; |
21 | 20 | import io.supertokens.ProcessState; |
22 | 21 | import io.supertokens.ProcessState.EventAndException; |
23 | 22 | import io.supertokens.ProcessState.PROCESS_STATE; |
| 23 | +import io.supertokens.config.Config; |
24 | 24 | import io.supertokens.exceptions.QuitProgramException; |
25 | 25 | import io.supertokens.httpRequest.HttpRequest; |
26 | 26 | import io.supertokens.httpRequest.HttpResponseException; |
@@ -490,31 +490,62 @@ public void serverHelloWithoutDB() throws Exception { |
490 | 490 | } |
491 | 491 |
|
492 | 492 | private void hello(String hostName, String port) throws InterruptedException, IOException, HttpResponseException { |
493 | | - String[] args = { "../" }; |
494 | | - TestingProcess process = TestingProcessManager.start(args); |
495 | | - assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STARTED)); |
496 | | - try { |
| 493 | + { |
| 494 | + String[] args = { "../" }; |
| 495 | + TestingProcess process = TestingProcessManager.start(args); |
| 496 | + assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STARTED)); |
| 497 | + try { |
497 | 498 |
|
498 | | - String response = HttpRequest.sendGETRequest(process.getProcess(), "", |
499 | | - "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
500 | | - assertEquals("Hello", response); |
| 499 | + String response = HttpRequest.sendGETRequest(process.getProcess(), "", |
| 500 | + "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
| 501 | + assertEquals("Hello", response); |
501 | 502 |
|
502 | | - response = HttpRequest.sendJsonPOSTRequest(process.getProcess(), "", |
503 | | - "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
504 | | - assertEquals("Hello", response); |
| 503 | + response = HttpRequest.sendJsonPOSTRequest(process.getProcess(), "", |
| 504 | + "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
| 505 | + assertEquals("Hello", response); |
505 | 506 |
|
506 | | - response = HttpRequest.sendJsonPUTRequest(process.getProcess(), "", |
507 | | - "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
508 | | - assertEquals("Hello", response); |
| 507 | + response = HttpRequest.sendJsonPUTRequest(process.getProcess(), "", |
| 508 | + "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
| 509 | + assertEquals("Hello", response); |
509 | 510 |
|
510 | | - response = HttpRequest.sendJsonDELETERequest(process.getProcess(), "", |
511 | | - "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
512 | | - assertEquals("Hello", response); |
| 511 | + response = HttpRequest.sendJsonDELETERequest(process.getProcess(), "", |
| 512 | + "http://" + hostName + ":" + port + "/hello", null, 1000, 1000, null); |
| 513 | + assertEquals("Hello", response); |
513 | 514 |
|
514 | | - } finally { |
515 | | - process.kill(); |
516 | | - assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STOPPED)); |
| 515 | + } finally { |
| 516 | + process.kill(); |
| 517 | + assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STOPPED)); |
| 518 | + } |
| 519 | + } |
| 520 | + |
| 521 | + { |
| 522 | + String[] args = { "../" }; |
| 523 | + TestingProcess process = TestingProcessManager.start(args); |
| 524 | + assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STARTED)); |
| 525 | + try { |
| 526 | + |
| 527 | + String response = HttpRequest.sendGETRequest(process.getProcess(), "", |
| 528 | + "http://" + hostName + ":" + port + "/", null, 1000, 1000, null); |
| 529 | + assertEquals("Hello", response); |
| 530 | + |
| 531 | + response = HttpRequest.sendJsonPOSTRequest(process.getProcess(), "", "http://" + hostName + ":" + port, |
| 532 | + null, 1000, 1000, null); |
| 533 | + assertEquals("Hello", response); |
| 534 | + |
| 535 | + response = HttpRequest.sendJsonPUTRequest(process.getProcess(), "", |
| 536 | + "http://" + hostName + ":" + port + "/", null, 1000, 1000, null); |
| 537 | + assertEquals("Hello", response); |
| 538 | + |
| 539 | + response = HttpRequest.sendJsonDELETERequest(process.getProcess(), "", |
| 540 | + "http://" + hostName + ":" + port, null, 1000, 1000, null); |
| 541 | + assertEquals("Hello", response); |
| 542 | + |
| 543 | + } finally { |
| 544 | + process.kill(); |
| 545 | + assertNotNull(process.checkOrWaitForEvent(PROCESS_STATE.STOPPED)); |
| 546 | + } |
517 | 547 | } |
| 548 | + |
518 | 549 | } |
519 | 550 |
|
520 | 551 | @Test |
|
0 commit comments