I have test which creates Junit XML test results based on this schema: https://maven.apache.org/surefire/maven-failsafe-plugin/xsd/failsafe-test-report-3.0.xsd
The display fails, because the XML contains a time attribute in the root, which is a legal attribute based on the XSD.
I would like to know which XSD the Eclipse JUnit view implements, so I can reformat my results to allow information to be displayed in the best possible fashion.
Removed the time attribute. The JUnit view display works.
Related
I am using an F# JSON type provider to create a type from a reference JSON document. The reference document "ReferenceItem.json" is part of the F# library. In addition I have a unit test project which tests the library. I am struggling with making the reference document available for the test project without duplicating it.
No matter how I mark "ReferenceItem.json" in Visual Studio (Content, None, Copy to Output etc.) my test project fails to compile because the statement JsonProvider<"ReferenceItem.json"> expects "Reference.json" to be present in the project source folder at compilation time. Including it as a linked item from the library project doesn't help: it's not copied at compile time to the test source folder. So I need to make a duplicate copy of the file in the test project.
I noticed that in F# projects I can mark files as "DesignData" or "DesignDataWithDesignTimeCreatableTypes", but I wasn't able to figure out how I can use them.
This is a tricky problem - when F# compiler references the library, it will invoke the type provider and so the type provider needs to be able to access the sample.
The easiest solution is to just always copy the sample json file so that it is in the folder from where the application is starting. This is obviously sub-optimal, and so we have another way of handling this using resources.
See the "Using JSON provider in a library" section of the documentation. The idea is that you can embed the sample document as a resource in the library and specify the resource name as an additional parameter:
type WB = JsonProvider<"../data/WorldBank.json",
EmbeddedResource="MyLib, worldbank.json">
This will then load the resource when using the library (but it still needs the file name in the original compilation mode). This is still somewhat experimental, so please open an issue on GitHub if you cannot get it to work!
I am looking for a maven plugin that will simply compare a json file with an associated JSON Schema file. Essentially we are getting plagued with invalid configuration files which are only run in a single environment. So testing of the "dev" environment will pass with flying colors though when the application is launched with the "prod" configurations the application will fail to start is the config is say missing a comma or otherwise the JSON doesn't parse.
Looking for a non-intrusive solution to verify that the config files are at least in the expected format before marking the build as successful (say like within a CI environment).
Posting this for completeness. The maven plugin was opensourced by Groupon and can be found here : https://github.com/groupon/json-schema-validator
Lacking a Maven plugin, I would do this with a small Java unit test which runs a schema validator over your example inputs - you could use a Maven filter to choose which file to parse based on your environment. If all configurations are stored in your SCM, you should be able to validate all configurations with one unit test.
If you're looking for a library to use in your unit test, have a look at the JSON schema validator:
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.0.1</version>
<scope>test</scope>
Another thought - if your configuration needs runtime validation, you should use the above library to validate when it changes. If you make your configuration update process interactive, you could validate as it changes and reject configuration updates which are invalid.
I've already created some html code using a XML file and based on a XSLT template.
Howerver, this time I need to create an inverse process (i.e., based on HTML code, create a XML file).
Plus, I need to create some quiz like:
Personal Info
Name:___
Age:____
etc... with input tags and stuff like that in a JSP file (or HTML). Then, after an user interaction and click on submit, this form need to create a XML file with this schema
<Personal Info>
<name>...</name>
<age>...</age>
...
</Personal Info>
In the future, this XML doc will be inserted in Form attribute on Java, through Controller, and persisted in database.
Thanks
João Vicente
One way is to use java script for reading the user inputs from html and build xml.
Dear friends,
We are developing healthcare app which will monitory patient data from remote and display the patient EcG in dynamic graphs is my requirement , basically I am new to XML and XSLT. so what I wanted to know how to transfer the xml EcG data into xslt so that then in linux xsltproc command can transfer xsl file into html file and I can view in browser.
Basic example I know but graphics like lines chat I am confusing how to do ?
please if any one knows let me know thanks in advance. any reference or any links or any example is also ok and great if any one shares.
You don't transfer your XML data to XSLT. With XSLT you can define a stylesheet which defines how to transform XML data (to HTML in your case). So you apply XSLT stylesheet to your XML data.
When you have your XSLT defined, you can use xsltproc like this:
xsltproc stylesheet.xsl myData.xml
You can start with this tutorial to get some idea how it works. (Click "Try it yourself" to see an example of an XML document, XSLT stylesheet and the result)
For graphics like bar chart, pie chart and so on you need java script help which would take your generated XML as input and pass some parameters to javascript which has the ability to produce graphics for you. You can also check FusionCharts on http://www.fusioncharts.com/products/suite/?gclid=CI71hJqsjbUCFVEX6wodPgYAeg
I am just wondering whether there is any work regarding the generation of static html files containing the output of the corresponding view of model objects.
Such an approach should also be able to regenerate outdated html files in case model object content changes.
I have done some research but couldn't find any appropriate solution...
Your question is very hard to parse–some steps/examples of what you're trying to accomplish would help.
"output of the corresponding view of model objects"
Model/objects don't have corresponding views–actions (in controllers) do. I'll assume you're talking about basic CRUD/scaffolding views related to your models.
If that's the case, take a look at render_to_string. It's basically renders a view to a string instead of to the browser.
So, if you wanted some "automatic" generation of html files, you could have a special controller action that loaded some models, looped through them, rendered a view for each to a string, and then saved that string to an HTML file using the model's ID and a time stamp as the name.
If you wanted to get really automatic, you could then call the URL of your special controller action daily/weekly/monthly from a cron job using wget (with some authentication, natch).