8thlight / cob_spec Goto Github PK
View Code? Open in Web Editor NEWA fitnesse suite for a web server
A fitnesse suite for a web server
In the PatchWithEtag test a newline is being required after the file contents are updated; however, the test does not add this to the body data it sends to the server. This results in the SHA1 checksums being different than what is provided in the test.
http-server.startup=> (slurp (io/file "/cob_spec/public/patch-content.txt"))
"default content\n"
http-server.startup=> (sha1 (io/file "/cob_spec/public/patch-content.txt"))
"60bb224c68b1ed765a0f84d910de58d0beea91c4"
http-server.startup=> (spit "/cob_spec/public/patch-content.txt" "default content")
nil
http-server.startup=> (sha1 (io/file "/cob_spec/public/patch-content.txt"))
"dc50a0d27dda2eee9f65644cd7e4c9cf11de8bec"
http-server.startup=>
I have a branch where I have removed the newline from the file, and changed the checksums to match the new file.
Java 8 has a new class Called Base64 which allows encoding/decoding, per documentation this uses encoding schemes RFC 4648 and RFC 2045 which is different from sun.misc scheme RFC1521
cob_spec seems to be using RFC1521 for auth.
Should cob_spec keep using RFC1521 or use java's new RFC 2045?
Documentation:
http://www.docjar.com/docs/api/sun/misc/BASE64Encoder.html http://docs.oracle.com/javase/8/docs/api/java/util/Base64.Encoder.html
According to RFC 7233 section 2.1: "if the [suffix length] value is greater than or equal to the length...the byte range is interpreted as the remainder of the representation." In other words, if I request the range 1-1000
for a file that's 5 bytes long, I should get a valid response with Content-Range: 1-4
.
Instead, cob_spec requests the range 75-80
for a file that's 77 bytes long, and expects to receive a response with the 416
status code and a Content-Range
header with the value */77
.
After following the README instructions, tests failed with:
ruby: No such file or directory -- rubyslim/lib/run_ruby_slim.rb (LoadError)
So I needed to update the submodule, but I got No submodule mapping found in .gitmodules for path 'rubyslim'
after running git submodule update
. Apparently this happens when there's a gitlink but no actual submodule (see http://stackoverflow.com/questions/4185365/no-submodule-mapping-found-in-gitmodule-for-a-path-thats-not-a-submodule).
Anyway, I created a submodule for the project on a new branch (rubyslim_submodule) and pushed, so if someone wants to verify that's the right approach and merge that branch into master, it'll make setup easier for others in the future.
Does it make sense to update this test (maybe like + section below), to include a failed update attempt when the ETag does not match? It seemed like right now, it could pass w/o checking the ETag.
|script |http browser |
|set host|localhost |
|set port|5000 |
|get |/patch-content.txt |
|ensure |response code equals|200 |
|ensure |body has content |default content |
|set data|patched content |
|set etag|dc50a0d27dda2eee9f65644cd7e4c9cf11de8bec| * sha1 of "default content"
|patch |/patch-content.txt |
|ensure |response code equals|204 |
|get |/patch-content.txt |
|ensure |response code equals|200 |
|ensure |body has content |patched content |
# Maybe add test for ETag that doesn't match.
+|set data|patched content |
+|set etag|dc50a0d27dda2eee9f65644cd7e4c9cf11de8bec| * sha1 of "default content"
+|patch |/patch-content.txt |
+|ensure |response code equals|412 |
|set data|default content |
|set etag|5c36acad75b78b82be6d9cbbd6143ab7e0cc04b0| * sha1 of "patched content"
|patch |/patch-content.txt |
|get |/patch-content.txt |
|ensure |body has content |default content |
cob_spec is having trouble with Java 9's module system. ClassLoaders can no longer be cast as URLClassLoaders.
Given: Using Java 9 and having added two lines to the pom.xml properties to allow mvn package
to compile:
<properties>
...
<maven.compiler.source>9.0</maven.compiler.source>
<maven.compiler.target>9.0</maven.compiler.target>
</properties>
When: $ java -jar fitnesse.jar -p 9090
Then:
Exception in thread "main" java.lang.ClassCastException: java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to java.base/java.net.URLClassLoader
at util.FileUtil.addUrlToClasspath(FileUtil.java:216)
at util.FileUtil.addFileToClassPath(FileUtil.java:212)
at util.FileUtil.addItemsToClasspath(FileUtil.java:207)
at fitnesse.components.PluginsClassLoader.addPluginsToClassLoader(PluginsClassLoader.java:15)
at fitnesseMain.FitNesseMain.loadPlugins(FitNesseMain.java:47)
at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:35)
at fitnesseMain.FitNesseMain.main(FitNesseMain.java:27)
Something I found online about the issue:
Also there's this link
BogusRequest
appears to be creating requests with randomly generated HTTP methods, and spec always requires the response to be 405 Method Not Allowed
. Depending on what method name is randomly generated:
501 Not Implemented
?The last paragraph in RFC7231 Section 4 says as follows:
When a request method is received
that is unrecognized or not implemented by an origin server, the
origin server SHOULD respond with the 501 (Not Implemented) status
code. When a request method is received that is known by an origin
server but not allowed for the target resource, the origin server
SHOULD respond with the 405 (Method Not Allowed) status code.
Should MethodNotAllowed
be refactored to use one of the other IANA methods that is not used elsewhere in cob_spec
-- maybe TRACE
or CONNECT
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.