This repository has been archived by the owner on Jan 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test Case for Trace Connect and Patch
- Loading branch information
1 parent
da87d16
commit 44681d6
Showing
3 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/test/java/io/parallec/core/main/http/ParallelClientHttpConnectTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.parallec.core.main.http; | ||
|
||
import java.util.Map; | ||
|
||
import io.parallec.core.ParallecResponseHandler; | ||
import io.parallec.core.ParallelClient; | ||
import io.parallec.core.ParallelTask; | ||
import io.parallec.core.TestBase; | ||
import io.parallec.core.ResponseOnSingleTask; | ||
import io.parallec.core.util.PcStringUtils; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class ParallelClientHttpConnectTest extends TestBase{ | ||
private static ParallelClient pc; | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
pc = new ParallelClient(); | ||
} | ||
|
||
@AfterClass | ||
public static void shutdown() throws Exception { | ||
pc.releaseExternalResources(); | ||
} | ||
@Test | ||
public void hitConnectTest() { | ||
|
||
ParallelTask pt = pc | ||
.prepareHttpConnect("") | ||
.setConcurrency(1000) | ||
.setSaveResponseToTask(true) | ||
.setTargetHostsFromLineByLineText(FILEPATH_TOP_100, | ||
SOURCE_LOCAL).execute(new ParallecResponseHandler() { | ||
|
||
@Override | ||
public void onCompleted(ResponseOnSingleTask res, | ||
Map<String, Object> responseContext) { | ||
logger.info("Responose Code:" + res.getStatusCode() | ||
+ " host: " + res.getHost()+ " Reponse Content: " +res.getResponseContent()); | ||
} | ||
}); | ||
logger.info("Result Summary\n{}", | ||
PcStringUtils.renderJson(pt.getAggregateResultFullSummary())); | ||
|
||
pt.saveLogToLocal(); | ||
} | ||
|
||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/test/java/io/parallec/core/main/http/ParallelClientHttpPatchTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.parallec.core.main.http; | ||
|
||
import java.util.Map; | ||
|
||
import io.parallec.core.ParallecResponseHandler; | ||
import io.parallec.core.ParallelClient; | ||
import io.parallec.core.ParallelTask; | ||
import io.parallec.core.TestBase; | ||
import io.parallec.core.ResponseOnSingleTask; | ||
import io.parallec.core.util.PcStringUtils; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class ParallelClientHttpPatchTest extends TestBase{ | ||
private static ParallelClient pc; | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
pc = new ParallelClient(); | ||
} | ||
|
||
@AfterClass | ||
public static void shutdown() throws Exception { | ||
pc.releaseExternalResources(); | ||
} | ||
@Test | ||
public void hitPatchTest() { | ||
|
||
ParallelTask pt = pc | ||
.prepareHttpPatch("") | ||
.setConcurrency(1000) | ||
.setSaveResponseToTask(true) | ||
.setTargetHostsFromLineByLineText(FILEPATH_TOP_100, | ||
SOURCE_LOCAL).execute(new ParallecResponseHandler() { | ||
|
||
@Override | ||
public void onCompleted(ResponseOnSingleTask res, | ||
Map<String, Object> responseContext) { | ||
logger.info("Responose Code:" + res.getStatusCode() | ||
+ " host: " + res.getHost()+ " Reponse Content: " +res.getResponseContent()); | ||
} | ||
}); | ||
logger.info("Result Summary\n{}", | ||
PcStringUtils.renderJson(pt.getAggregateResultFullSummary())); | ||
|
||
pt.saveLogToLocal(); | ||
} | ||
|
||
|
||
} |
52 changes: 52 additions & 0 deletions
52
src/test/java/io/parallec/core/main/http/ParallelClientHttpTraceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package io.parallec.core.main.http; | ||
|
||
import java.util.Map; | ||
|
||
import io.parallec.core.ParallecResponseHandler; | ||
import io.parallec.core.ParallelClient; | ||
import io.parallec.core.ParallelTask; | ||
import io.parallec.core.TestBase; | ||
import io.parallec.core.ResponseOnSingleTask; | ||
import io.parallec.core.util.PcStringUtils; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class ParallelClientHttpTraceTest extends TestBase{ | ||
private static ParallelClient pc; | ||
|
||
@BeforeClass | ||
public static void setUp() throws Exception { | ||
pc = new ParallelClient(); | ||
} | ||
|
||
@AfterClass | ||
public static void shutdown() throws Exception { | ||
pc.releaseExternalResources(); | ||
} | ||
@Test | ||
public void hitTraceTest() { | ||
|
||
ParallelTask pt = pc | ||
.prepareHttpTrace("") | ||
.setConcurrency(1000) | ||
.setSaveResponseToTask(true) | ||
.setTargetHostsFromLineByLineText(FILEPATH_TOP_100, | ||
SOURCE_LOCAL).execute(new ParallecResponseHandler() { | ||
|
||
@Override | ||
public void onCompleted(ResponseOnSingleTask res, | ||
Map<String, Object> responseContext) { | ||
logger.info("Responose Code:" + res.getStatusCode() | ||
+ " host: " + res.getHost()+ " Reponse Content: " +res.getResponseContent()); | ||
} | ||
}); | ||
logger.info("Result Summary\n{}", | ||
PcStringUtils.renderJson(pt.getAggregateResultFullSummary())); | ||
|
||
pt.saveLogToLocal(); | ||
} | ||
|
||
|
||
} |
44681d6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add bad test Case for HTTP methods of Trace Connect and Patch, it's hard to deploy web server to do test