diff --git a/README.md b/README.md
index 5abe8f8..e7f7ba5 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,6 @@ It creates a self-contained, executable JAR in the `target` directory.
* [Update a test](src/test/java/io/harness/jhttp/server/HeaderListTest.java)
* [Update README](README.md)
-
+
diff --git a/config/.harness/Hello_World_Java.yaml b/config/.harness/Hello_World_Java.yaml
index 4b0894d..d72acd9 100644
--- a/config/.harness/Hello_World_Java.yaml
+++ b/config/.harness/Hello_World_Java.yaml
@@ -1,5 +1,5 @@
pipeline:
- name: Hello World Java
+ name: Hello World
identifier: Hello_World_Java
projectIdentifier: Product_Demos_CIE
orgIdentifier: default
@@ -9,42 +9,55 @@ pipeline:
codebase:
connectorRef: account.Keen_jhttp
build: <+input>
+ sslVerify: false
+ prCloneStrategy: MergeCommit
stages:
- stage:
name: Build Test and Push
identifier: Test_Build_and_Push
+ description: hello world java demo
type: CI
spec:
cloneCodebase: true
execution:
steps:
- - step:
- type: RunTests
- timeout: 5h
- description: simple desc
- name: runTestsWithIntelligence
- identifier: runTestsWithIntelligence
- spec:
- connectorRef: account.nofar_dockerhub
- image: maven:3.5.2-jdk-8-alpine
- args: test
- buildTool: maven
- language: java
- packages: io.harness.
- runOnlySelectedTests: true
- reports:
- type: JUnit
- spec:
- paths:
- - "**/*.xml"
- resources:
- limits:
- memory: 1000Mi
- postCommand: mvn package -DskipTests
+ - parallel:
+ - step:
+ type: RunTests
+ description: test123
+ name: runTestsWithIntelligence
+ identifier: runTestsWithIntelligence
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: maven:3.5.2-jdk-8-alpine
+ args: test
+ buildTool: Maven
+ language: Java
+ packages: io.harness.
+ runOnlySelectedTests: true
+ postCommand: mvn package -DskipTests
+ reports:
+ type: JUnit
+ spec:
+ paths:
+ - "**/*.xml"
+ resources:
+ limits:
+ memory: 1000Mi
+ - step:
+ type: Run
+ name: run tests no TI
+ identifier: run_tests_no_TI
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: maven:3.5.2-jdk-8-alpine
+ command: |-
+ mvn test
+ mvn package -DskipTests
+ privileged: false
- step:
type: BuildAndPushDockerRegistry
name: Build and push image to DockerHub
- timeout: 4h
identifier: Build_and_push_image_to_DockerHub
spec:
connectorRef: account.nofar_dockerhub
@@ -57,7 +70,6 @@ pipeline:
spec:
connectorRef: account.k8scluster
namespace: harness-delegate-pmdemo
- serviceDependencies: []
sharedPaths:
- ""
variables:
@@ -80,8 +92,9 @@ pipeline:
connectorRef: account.nofar_dockerhub
image: curlimages/curl:7.69.1
command: |-
- sleep 5
+ sleep 7
curl localhost:8888
+ privileged: false
serviceDependencies:
- identifier: runhelloworldserver
name: Run Hello World Server
@@ -94,6 +107,7 @@ pipeline:
sharedPaths:
- ""
description: running integ tests
+ variables: []
variables:
- name: pipelineVar
type: String
diff --git a/config/.harness/bad_connector.yaml b/config/.harness/bad_connector.yaml
new file mode 100644
index 0000000..4b1f273
--- /dev/null
+++ b/config/.harness/bad_connector.yaml
@@ -0,0 +1,18 @@
+connector:
+ name: bad connector
+ identifier: bad_connector
+ description:
+ orgIdentifier: default
+ projectIdentifier: Product_Demos_CIE
+ type: Github
+ spec:
+ url: http://skdfjhskdjfh.com
+ validationRepo: yada
+ authentication:
+ type: Http
+ spec:
+ type: UsernamePassword
+ spec:
+ username: werwe
+ passwordRef: account.Nofar_bitbucket_cloud
+ type: Account
diff --git a/config/.harness/basic_piepline.yaml b/config/.harness/basic_piepline.yaml
new file mode 100644
index 0000000..eb2885f
--- /dev/null
+++ b/config/.harness/basic_piepline.yaml
@@ -0,0 +1,31 @@
+pipeline:
+ name: basic piepline
+ identifier: basic_piepline
+ projectIdentifier: Product_Demos_CIE
+ orgIdentifier: default
+ tags: {}
+ stages:
+ - stage:
+ name: basic
+ identifier: basic
+ description: ""
+ type: CI
+ spec:
+ cloneCodebase: false
+ infrastructure:
+ type: KubernetesDirect
+ spec:
+ connectorRef: account.k8scluster
+ namespace: harness-delegate-pmdemo
+ execution:
+ steps:
+ - step:
+ type: Run
+ name: echo
+ identifier: echo
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: alpine
+ command: echo "hey"
+ privileged: false
+ variables: []
diff --git a/config/.harness/java_http_client.yaml b/config/.harness/java_http_client.yaml
new file mode 100644
index 0000000..bb019d7
--- /dev/null
+++ b/config/.harness/java_http_client.yaml
@@ -0,0 +1,104 @@
+pipeline:
+ name: Java HTTP Server
+ identifier: java_http_client
+ projectIdentifier: Product_Demos_CIE
+ orgIdentifier: default
+ tags: {}
+ properties:
+ ci:
+ codebase:
+ connectorRef: account.Keen_jhttp
+ repoName: jhttp
+ build: <+input>
+ sslVerify: false
+ prCloneStrategy: MergeCommit
+ stages:
+ - stage:
+ name: Build Test and Push
+ identifier: Test_Build_and_Push
+ description: hello world java demo
+ type: CI
+ spec:
+ cloneCodebase: true
+ execution:
+ steps:
+ - step:
+ type: RunTests
+ description: run unit tests
+ name: runTestsWithIntelligence
+ timeout: 20m
+ identifier: runTestsWithIntelligence
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: maven:3.5.2-jdk-8-alpine
+ args: test
+ buildTool: Maven
+ language: Java
+ packages: io.harness.
+ runOnlySelectedTests: true
+ postCommand: mvn package -DskipTests
+ reports:
+ type: JUnit
+ spec:
+ paths:
+ - "**/*.xml"
+ resources:
+ limits:
+ memory: 1000Mi
+ - step:
+ type: BuildAndPushDockerRegistry
+ name: Build and push image to DockerHub
+ identifier: Build_and_push_image_to_DockerHub
+ spec:
+ connectorRef: account.nofar_dockerhub
+ repo: bluebbb/javademo
+ tags:
+ - <+pipeline.sequenceId>
+ optimize: true
+ infrastructure:
+ type: KubernetesDirect
+ spec:
+ connectorRef: account.k8scluster
+ namespace: harness-delegate-pmdemo
+ sharedPaths:
+ - ""
+ variables:
+ - name: myStageVar
+ type: String
+ value: stageVarValue
+ - stage:
+ name: Run Integration Test
+ identifier: Run_Integration_Test
+ type: CI
+ spec:
+ cloneCodebase: false
+ execution:
+ steps:
+ - step:
+ type: Run
+ name: test connection to server
+ identifier: test_connection_to_server
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: curlimages/curl:7.69.1
+ command: |-
+ sleep 5
+ curl localhost:8888
+ privileged: false
+ serviceDependencies:
+ - identifier: runhelloworldserver
+ name: Run Hello World Server
+ type: Service
+ spec:
+ connectorRef: account.nofar_dockerhub
+ image: bluebbb/javademo:<+pipeline.sequenceId>
+ infrastructure:
+ useFromStage: Test_Build_and_Push
+ sharedPaths:
+ - ""
+ description: running integ tests
+ variables: []
+ variables:
+ - name: pipelineVar
+ type: String
+ value: pipelineVarValue
diff --git a/src/main/java/io/harness/jhttp/processor/DirectoryListing.java b/src/main/java/io/harness/jhttp/processor/DirectoryListing.java
index 1a3e3ae..42006a2 100644
--- a/src/main/java/io/harness/jhttp/processor/DirectoryListing.java
+++ b/src/main/java/io/harness/jhttp/processor/DirectoryListing.java
@@ -44,8 +44,8 @@ public boolean process(HttpRequest request, HttpResponse response) {
private void appendLink(String fileName, String uri, PrintWriter writer) {
// writer.append(String.format("
\n%s\n\n", uri, fileName, fileName));
- writer.append(String.format("\n%s\n\n", uri, fileName, fileName));
+ writer.append(String.format("\n%s\n\n", uri, fileName, fileName));
// writer.append(String.format("\n%s\n\n", uri, fileName, fileName));
- }
-}
+ }
+}
diff --git a/src/test/java/io/harness/jhttp/functional/HttpClientTest.java b/src/test/java/io/harness/jhttp/functional/HttpClientTest.java
index 80c9042..e484c12 100644
--- a/src/test/java/io/harness/jhttp/functional/HttpClientTest.java
+++ b/src/test/java/io/harness/jhttp/functional/HttpClientTest.java
@@ -61,16 +61,204 @@ public void testReflection() throws IOException {
}
@Test
- public void testDirectoryIndex() throws IOException {
+ public void testDirectoryIndex() throws IOException, InterruptedException {
+ Thread.sleep(10000); // sleep 10 sec
testRequest("/directory1", "/http-server/server-root/directory1/index.html");
}
@Test
- public void testStaticFile() throws IOException {
+ public void testStaticFile() throws IOException , InterruptedException {
+ Thread.sleep(20000); // sleep 20 sec
testRequest("/file1.html", "/http-server/server-root/file1.html");
testRequest("/file2.html", "/http-server/server-root/file2.html");
}
+ @Test
+ public void testStaticFile123() throws IOException , InterruptedException{
+ Thread.sleep(10000); // sleep 10 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile1234() throws IOException , InterruptedException {
+ Thread.sleep(10000); // sleep 10 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile2234() throws IOException , InterruptedException {
+ Thread.sleep(16000); // sleep 16 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile2341() throws IOException, InterruptedException {
+ Thread.sleep(10000); // sleep 10 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile6341() throws IOException, InterruptedException {
+ Thread.sleep(10000); // sleep 10 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile6141() throws IOException, InterruptedException {
+ Thread.sleep(10000); // sleep 10 sec
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile6121() throws IOException, InterruptedException {
+ Thread.sleep(12000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile61212() throws IOException, InterruptedException {
+ Thread.sleep(9000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile61272() throws IOException, InterruptedException {
+ Thread.sleep(21000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile7777() throws IOException, InterruptedException {
+ Thread.sleep(4000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile07776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile01776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile02776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile03776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile04776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile0576() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+
+ @Test
+ public void testStaticFile0676() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile0776() throws IOException, InterruptedException {
+ Thread.sleep(2000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile0876() throws IOException, InterruptedException {
+ Thread.sleep(6000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile0976() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile09176() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile09276() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile09376() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+
+ @Test
+ public void testStaticFile09476() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
+ @Test
+ public void testStaticFile09576() throws IOException, InterruptedException {
+ Thread.sleep(1000);
+ testRequest("/file1.html", "/http-server/server-root/file1.html");
+ testRequest("/file2.html", "/http-server/server-root/file2.html");
+ }
+
@Test
public void test404() throws IOException {
testRequest("/invalid-file.html", "/http-server/404.html", 404);