JsfUnit without JBoss in spring web app - maven dependency setup - java

I can't find an easy JSFUnit setup for my pom anywhere. What repository do I use and which dependencies? We have a running web app with JSF and Spring. Can't be that hard to get JSFUnit into the mix..?!
Also we want to run the tests from Eclipse (I think I found something there) and via Maven when building the artifacts on jenkins.
Can anyone please post their dependency setup (as well as maven build cycle integration)?
Thanks!

Related

Develop Spring Boot project in a totally off-line environment, is that possible?

Our group wanna reconstruct our old Spring project into Spring Cloud
and several Spring Boot projects.
And what bothers us is that we cannot connect to Internet for some classified & security reasons. We can only download the dependencies at home and take them to our office (this process is very complicate and takes a long time).
I have read some maven document in apache website, and got the conclusion that we can't download the whole maven respository. It is almost impossible for us to download the jars on maven respository one-by-one because they are so many.
For now, we have setup a nexus server and spring boot initializr, all the problem for now is the maven repository.
Therefore, I wonder if this method is OK or not? Should we quit or is there any other ways?
If you've read this, Thanks.
—— An off-line old school programmer
You can download all spring framework jars as songle zip according to required spring release here
I would suggest you to then upload them to a private repository like Nexus/jfrog and configure all of your Maven/Gradle projects to use this as repository rather than the public repository, This way you don't need access to internet to download dependencies.
You can download all maven dependencies on nexus server and you have to connect your maven repositories with nexus server for that you just have to provide the configuration in setting.xml(will consist of nexus url) file and have to put xml file in .m2 folder of maven and provide the path in eclipse maven user settings and when you will clean and install the project in eclipse it will automatically download all dependencies from nexus server.
please let me know for more details.

How to add and use one project in another project?

I have a project based on Spring which is running successfully. Now I have created another project based on Jersey which I want to integrate with spring project in Jersey.
I have gone through internet and I added spring project in the build-path of the Jersey project.
Here the problem is whenever I run my Jersey project, it has to execute the Spring project first.
How to configure spring project in Jersey?
You should consider using a dependency management/build tool such as Maven or Gradle.
This way each of your projects will be a module, which can be referenced from the other project as a dependency. You can still use the first project alone and the two-dependent projects alone as wall. Then the tool lets you just simply package the resulting project in a artifact such as WAR with all the dependencies.
Here is a quick maven tutorial - Maven in 5 Minutes
It is a good idea to use such a tool in any case as it has many additional advantages:
Lets you manage also your third party dependencies without needing to manually download the libraries and add them to the classpath
It is much easier to use such a project in cases like continuous integration.
You can run all your tests automatically during the build process to make sure everything works
It resolves transitive dependencies (dependencies of your dependencies)
It builds resulting archive file for you
You can have multiple profiles for different environments
...
Make both of your projects modules of one Maven parent pom project. This way you can build them both at the same time.

How to obtain Spring library to set up Spring environment?

I have been trying to start a simple Spring project as a part of my study. From the tutorials (they are about a year old resources i am refering), it seems the Spring related libraries were easily available online then. But now; I was unable to get something like a "spring_ver_no.zip" from the spring source site. It is having options to download a tool suite which is about 350 MBs large.
Can you please guide me if that download is the way to setup a Spring development environment?If not what is the way to set up a simple Spring environment in eclipse.
Thanks
Angie
You should use a dependency management tool like Gradle or Maven, and let this tool download the libraries for you. See the quick start for how to include Spring in your dependencies. If you still want to download the jar files and add them manually to your project, then download them directly from the Maven central repository: http://search.maven.org/#search|ga|1|g%3A%22org.springframework%22
Spring is, for a long time, splitted in several modules. You have to download all the modules you need.
Spring is using Maven lately. You should use it too. Maven is a build tool and dependency manager that will ease your life.

Measuring integration test coverage with Maven

The followings are ok now:
I have a multi-module project in maven with EJB and WAR projects
I want to use JMeter (and later selenium) for integration testing. I can run both from Maven. The JMeter plan is ready, I run it with Chronos maven plugin.
My application is a Java EE application, so I want to test the code with the planned production aplication server, which is Glassfish 2.11. I can create/start/deploy/stop and anything like that with glassfish maven plugin
I have put jmeter and glassfish related build settings into a submodule in maven, which is dependent on all of the other modules, so in build lifecycle it is the least, and for this reason a good point to test the whole application
My problem is, that how can I reach the followings:
deploy NOT instrumented code, but run integration tests on instrumented one
how to get coverage info from application server
I wanted to use emma4it which was created to instrument artifacts. It would be good for me, but i cannot make it instrument the war file in the other submodule. I do not even know anything about the supported arguments of emma4it, since I did not find it at all (just a binary in repository), no documentation and no source (I know I can decompile it)
I want to have a coverage raport at least in maven site, but the top would be to have it in Sonar
Could you give me advice, how to do this? I can provide POM snippets if you need it.
FINALLY. The solution arrived. See at http://www.sonarsource.org/measure-code-coverage-by-integration-tests-with-sonar/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+Sonar+(Sonar)&utm_content=Google+Reader
I currently try to do it.

Assistance need to get Spring MVC project going with IntelliJ IDEA

So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat.
So I setup a new project, configured it to use sun jdk.
I chose a spring application, and it created and downloaded the following:
I don't see any spring-mvc libraries, are they included in there or do I have to do something about that?
Can someone outline what I have to do to get this to build like a spring mvc web application?
I find that the best way to start a new IDEA project is to use the Maven. This allows you to easily build your project without launching the IDE, automatically maintaining all libraries for you.
"Create project from scratch", then select "Maven module" in the next screen. Click on "Create from archetype" and select the "maven-archetype-webapp". This will give you a basic Maven layout which builds a simple WAR file.
Now to add the Spring libraries, open the Maven build file - pom.xml - and insert a new dependency on the Spring MVC framework:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
From here, you can follow the Spring MVC reference documentation - add the Dispatcher Servlet and Context Listener to web.xml, a Spring XML context and so on.
Something else you might find useful is the Maven Jetty plugin. Once configured, you can run your app by simply typing "mvn jetty:run" at the command prompt (or launching it from within the IDE). Maven will fetch all that's required and deploy the app for you, no need for an external app server setup for quick testing.
I'm not sure if your setup would be identical to mine, but when I downloaded spring-framework-2.5.6 there were jar files named spring-web.jar, spring-webmvc.jar, etc. in the \dist\modules subfolders. The tutorial indicated at least spring-webmvc.jar should be in your WEB-INF/lib folder.
This tutorial optionally used eclipse, but might be helpful anyways, especially getting started:
http://static.springsource.org/docs/Spring-MVC-step-by-step/
I think there are specific JARs for the Spring MVC stuff. Basically when you download the latest Spring Framework and you extract the zip you need to go to the dist folder and add the org.springframework.web.jar and org.springframework.web.servlet.jar/org.springframework.portlet.jar to your project. I'm pretty sure that the servlet/portlet jars will have your MVC specific classes.

Categories

Resources