Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83b69a7
Add okhttp3 library
PrzemyslawFormella Feb 25, 2020
49f45bf
change name
PrzemyslawFormella Feb 25, 2020
9255550
add mock server for API
PrzemyslawFormella Feb 25, 2020
d190b69
travis test1
PrzemyslawFormella Feb 26, 2020
52a89a4
travis test2
PrzemyslawFormella Feb 26, 2020
bbe3722
travis test3
PrzemyslawFormella Feb 26, 2020
0ae9d55
travis test4
PrzemyslawFormella Feb 26, 2020
e7d6230
travis test5
PrzemyslawFormella Feb 26, 2020
38caff9
travis test6
PrzemyslawFormella Feb 26, 2020
857cd1e
travis test8
PrzemyslawFormella Feb 26, 2020
f6672da
travis test9
PrzemyslawFormella Feb 26, 2020
5576322
travis test10
PrzemyslawFormella Feb 26, 2020
32296cc
travis test11
PrzemyslawFormella Feb 26, 2020
2c6d237
travis test12
PrzemyslawFormella Feb 26, 2020
ebc5e78
travis test13
PrzemyslawFormella Feb 26, 2020
71f8076
travis test14
PrzemyslawFormella Feb 26, 2020
5884581
travis test15
PrzemyslawFormella Feb 26, 2020
75cf25d
travis test16
PrzemyslawFormella Feb 26, 2020
a5e058e
travis test17
PrzemyslawFormella Feb 26, 2020
7c5fce2
travis test18
PrzemyslawFormella Feb 26, 2020
cf3a1f2
travis test19
PrzemyslawFormella Feb 26, 2020
edb1e61
travis test20
PrzemyslawFormella Feb 26, 2020
02da77f
travis test21
PrzemyslawFormella Feb 26, 2020
6008fd8
travis test22
PrzemyslawFormella Feb 26, 2020
73f8909
travis test23
PrzemyslawFormella Feb 26, 2020
4319342
travis test24
PrzemyslawFormella Feb 26, 2020
7e9ad0a
travis test25
PrzemyslawFormella Feb 26, 2020
005761d
travis test26
PrzemyslawFormella Feb 26, 2020
37a755d
travis test27
PrzemyslawFormella Feb 26, 2020
da66c3e
travis test28
PrzemyslawFormella Feb 26, 2020
cb0e2ce
travis test29
PrzemyslawFormella Feb 27, 2020
c7184f3
travis czwartek1
PrzemyslawFormella Feb 27, 2020
4c7f12c
travis test36
PrzemyslawFormella Feb 27, 2020
b708444
travis test37
PrzemyslawFormella Feb 27, 2020
14d3361
travis test38
PrzemyslawFormella Feb 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
language: java

#dist: trusty
#sudo: false
jdk:
- openjdk9
- openjdk9
env:
- GH_URL=https://raw.githubusercontent.com VALIDATOR_URL=http://localhost:5050 URL_TO_VALIDATE=$GH_URL/$TRAVIS_REPO_SLUG/${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}


before_install:
skip
# - ./gradlew run
# - git clone https://github.com/NetworkedCoders/speech-rank.git
# - gradlew run
# - npm install
# - npm run gulp
# test1



script:
- ./gradlew tasks test
# apply plugin: 'java'

# test {
# testLogging {
# events "failed"
# exceptionFormat "short"
#
# debug {
# events "started", "skipped", "failed"
# exceptionFormat "full"
# }
# info.events = ["failed", "skipped"]
# }
# }
# validate
# - echo "Validating $URL_TO_VALIDATE:"
# - VALIDATION_OUTPUT=`curl -sS "$VALIDATOR_URL=$URL_TO_VALIDATE"`
#
# # print validation errors
# - echo $VALIDATION_OUTPUT
#
# # check if the validation output is an empty array, i.e. no errors
# - test "$VALIDATION_OUTPUT" == "[]"

after_failure:
skip
# -cat file:///home/travis/build/NetworkedCoders/speech-rank/build/reports/tests/test/index.html


1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies {
exclude module: "groovy-all"
}
implementation 'junit:junit:4.12'
implementation("com.squareup.okhttp3:okhttp:4.4.0")

}

Expand Down
40 changes: 40 additions & 0 deletions src/test/java/com/github/speechrank/rest/GetConferencesTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.github.speechrank.rest;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertEquals;

public class GetConferencesTest {

@Test
public void conferences() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("http://localhost:5050/api/conferences")
// .url("$VALIDATOR_URL/api/conferences")
.method("GET", null)
.build();

System.out.println("testowySOUT");
System.out.println("$VALIDATOR_URL");
// System.out.println($VALIDATOR_URL);
Response response = client.newCall(request).execute();

//check is content-type is application/json
// assertEquals("text/html; charset=utf-8", response.header("content-type"));

//check if status code is 200
assertEquals(200, response.code());

//check responseBody
String responseBody = response.body().string();
assertEquals("[{\"year\":\"2019\",\"conferences\":[{\"id\":\"12\",\"name\":\"DevConf\",\"presentations\":25},{\"id\":\"31\",\"name\":\"Boiling Frogs\",\"presentations\":25},{\"id\":\"41\",\"name\":\"Scalar\",\"presentations\":16},{\"id\":\"51\",\"name\":\"Confitura\",\"presentations\":25}]},{\"year\":\"2018\",\"conferences\":[{\"id\":\"21\",\"name\":\"Boiling Frogs\",\"presentations\":25},{\"id\":\"51\",\"name\":\"Confitura\",\"presentations\":25}]},{\"year\":\"2017\",\"conferences\":[{\"id\":\"11\",\"name\":\"DevConf\",\"presentations\":25}]}]", responseBody);
//TODO: powyzsza asercje napewno da sie ulepszyc, ale jeszcze nie wiem jak :)
}
}