Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Betamax tests - #26

Merged
walro merged 10 commits into
masterfrom
betamaxTests
Aug 15, 2016
Merged

walro merged 10 commits into
masterfrom
betamaxTests

Conversation

@dentarg

@dentarg dentarg commented Jul 7, 2016 •

Copy link
Copy Markdown
Contributor

Same as #18, but as a local branch we can make changes to.

This will close #9.


From #18 (comment)

Betamax 2.0 official is out. It fixes this issue, but it will require you to change how you run builds on Travis. Please see the documentation on Betamax's readme and let me know if you have any questions.

Reference: https://github.com/betamaxteam/betamax/blob/master/.travis.yml

xSAVIKx added 5 commits March 12, 2016 12:04
added betamax functional tests
rewrite UrlConnectionClientFunctionTest with groovy and Spock
ensure that VERSION constant is always initialized after version property is gathered from version.properties.
betamax-snapshot should be used until new stable release won't be presented.
add betamax-generated SSL certificated to gitignore
@dentarg

dentarg commented Jul 7, 2016

Copy link
Copy Markdown
Contributor Author
~/twingly/twingly-search-api-java master
$ git remote -v
origin  [email protected]:twingly/twingly-search-api-java.git (fetch)
origin  [email protected]:twingly/twingly-search-api-java.git (push)
xSAVIKx git://github.com/xSAVIKx/twingly-search-api-java.git (fetch)
xSAVIKx git://github.com/xSAVIKx/twingly-search-api-java.git (push)

~/twingly/twingly-search-api-java master
$ git fetch xSAVIKx betamaxTests
remote: Counting objects: 5, done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 5
Unpacking objects: 100% (5/5), done.
From git://github.com/xSAVIKx/twingly-search-api-java
 * branch            betamaxTests -> FETCH_HEAD

~/twingly/twingly-search-api-java master*
$ git co FETCH_HEAD -b betamaxTests
Switched to a new branch 'betamaxTests'

~/twingly/twingly-search-api-java betamaxTests*
$ git push -u origin betamaxTests
Counting objects: 59, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (29/29), done.
Writing objects: 100% (59/59), 38.73 KiB | 0 bytes/s, done.
Total 59 (delta 11), reused 51 (delta 8)
To [email protected]:twingly/twingly-search-api-java.git
 * [new branch]      betamaxTests -> betamaxTests
Branch betamaxTests set up to track remote branch betamaxTests from origin by rebasing.

@dentarg

dentarg commented Jul 7, 2016

Copy link
Copy Markdown
Contributor Author

I did the easy change:

$ git d
diff --git a/build.gradle b/build.gradle
index bc2bcc4..d2da25d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,8 +18,7 @@ ext {
     cglibVersion = "3.2.0"
     objenesisVersion = "2.2"
     jaxbVersion = "2.2.11"
-    betamaxVersion = "2.0.0-alpha-1"
-    betamaxSnapshotVersion = "2.0.0-SNAPSHOT"
+    betamaxVersion = "2.0.0"
     libs = [
             jaxb     : "org.glassfish.jaxb:jaxb-runtime:$jaxbVersion",
             junit    : "junit:junit:$junitVersion",
@@ -27,7 +26,7 @@ ext {
             spock    : "org.spockframework:spock-core:$spockVersion",
             cglib    : "cglib:cglib-nodep:$cglibVersion",
             objenesis: "org.objenesis:objenesis:$objenesisVersion",
-            betamax  : "software.betamax:betamax-junit:$betamaxSnapshotVersion"
+            betamax  : "software.betamax:betamax-junit:$betamaxVersion"
     ]
     buildTime = new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
     sharedManifest = manifest {

But we need to do more:

$ ./gradlew check
:compileJava UP-TO-DATE
:compileGroovy UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava UP-TO-DATE
:compileTestGroovy
Download https://repo1.maven.org/maven2/software/betamax/betamax-junit/2.0.0/betamax-junit-2.0.0.pom
Download https://repo1.maven.org/maven2/software/betamax/betamax-core/2.0.0/betamax-core-2.0.0.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava-parent/18.0/guava-parent-18.0.pom
Download https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.16/snakeyaml-1.16.pom
Download https://repo1.maven.org/maven2/io/netty/netty-all/4.0.35.Final/netty-all-4.0.35.Final.pom
Download https://repo1.maven.org/maven2/io/netty/netty-parent/4.0.35.Final/netty-parent-4.0.35.Final.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Download https://repo1.maven.org/maven2/org/apache/tika/tika-core/1.11/tika-core-1.11.pom
Download https://repo1.maven.org/maven2/org/apache/tika/tika-parent/1.11/tika-parent-1.11.pom
Download https://repo1.maven.org/maven2/org/apache/apache/17/apache-17.pom
Download https://repo1.maven.org/maven2/org/littleshoot/littleproxy/1.1.0-beta2/littleproxy-1.1.0-beta2.pom
Download https://repo1.maven.org/maven2/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/37/commons-parent-37.pom
Download https://repo1.maven.org/maven2/org/apache/apache/16/apache-16.pom
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.10/commons-codec-1.10.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/35/commons-parent-35.pom
Download https://repo1.maven.org/maven2/org/apache/apache/15/apache-15.pom
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/25/commons-parent-25.pom
Download https://repo1.maven.org/maven2/org/apache/apache/9/apache-9.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.pom
Download https://repo1.maven.org/maven2/com/barchart/udt/barchart-udt-bundle/2.3.0/barchart-udt-bundle-2.3.0.pom
Download https://repo1.maven.org/maven2/com/barchart/udt/barchart-udt-archon/2.3.0/barchart-udt-archon-2.3.0.pom
Download https://repo1.maven.org/maven2/com/barchart/base/barchart-archon/2.5.10/barchart-archon-2.5.10.pom
Download https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.19/slf4j-api-1.7.19.pom
Download https://repo1.maven.org/maven2/org/slf4j/slf4j-parent/1.7.19/slf4j-parent-1.7.19.pom
Download https://repo1.maven.org/maven2/software/betamax/betamax-junit/2.0.0/betamax-junit-2.0.0.jar
Download https://repo1.maven.org/maven2/software/betamax/betamax-core/2.0.0/betamax-core-2.0.0.jar
Download https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0.jar
Download https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar
Download https://repo1.maven.org/maven2/io/netty/netty-all/4.0.35.Final/netty-all-4.0.35.Final.jar
Download https://repo1.maven.org/maven2/org/apache/tika/tika-core/1.11/tika-core-1.11.jar
Download https://repo1.maven.org/maven2/org/littleshoot/littleproxy/1.1.0-beta2/littleproxy-1.1.0-beta2.jar
Download https://repo1.maven.org/maven2/commons-cli/commons-cli/1.3.1/commons-cli-1.3.1.jar
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
Download https://repo1.maven.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar
Download https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
Download https://repo1.maven.org/maven2/com/barchart/udt/barchart-udt-bundle/2.3.0/barchart-udt-bundle-2.3.0.jar
Download https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.19/slf4j-api-1.7.19.jar
startup failed:
/Users/dentarg/twingly/twingly-search-api-java/src/test/groovy/com/twingly/search/client/UrlConnectionClientFunctionSpockTest.groovy: 8: unable to resolve class software.betamax.ProxyConfiguration
 @ line 8, column 1.
   import software.betamax.ProxyConfiguration
   ^

1 error

:compileTestGroovy FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileTestGroovy'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 18.678 secs

@walro

walro commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

I can't get this to work in OSX, at least not on my computer. I suspect that the same command issued on Travis:

sudo keytool -importcert -keystore $JAVA_HOME/jre/lib/security/cacerts -file betamax.pem -storepass changeit -noprompt

does not add to the store actually being read

@walro walro changed the title [WIP] Betamax tests Betamax tests Aug 12, 2016
@walro

walro commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

Tried adding to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/cacerts too without much luck.

@walro

walro commented Aug 12, 2016 •

Copy link
Copy Markdown
Contributor

Ah... it worked now. I removed the temporary files that were generated and then re-ran:

  • api.twingly.com.jks
  • api.twingly.com.cert
  • api.twingly.com.csr
  • betamax-local.jks

I probably had those around since before I had added Betamax's cert to my store.

@walro

walro commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

I'll write something about this in the README and then I think we are good to go.

@jage

jage commented Aug 12, 2016

Copy link
Copy Markdown
Contributor

LGTM!

@walro
walro merged commit aaca963 into master Aug 15, 2016
@walro
walro deleted the betamaxTests branch August 15, 2016 07:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Betamax tests

4 participants