Open source projects with Java and Scala interaction - java

I'm going to give a talk about using Java and Scala together and I want to investigate some projects (large and small) which contains Java and Scala code.
If you know links to correspondent projects post them here.

This page on the Scala wiki is a good starting point...

The various scala testing frameworks come to mind. They all have some integration with JUnit or TestNG

Gimd is one example of small project: http://code.google.com/p/gimd/
Although development stalled for a while because I'm busy with other duties it already contains some examples of Scala<->Java integration. Notably:
unit tests are written using junit
Gimd is using JGit (library in Java) as underlying layer
While working on Gimd I found that using Java from Scala is mostly easy and seamless the contrary is not always true. It's not really a fault of Scala as it's simple manifestation that Java is a less expressive language.

Unfortunately I don't know any open source project but I have worked on very large projects over the last few years that have java and scala interacting and my experience has been mostly very positive. If I had one piece of advice it would be to use scala-javautils. It's a life saver and is far better than the scala jcl code. Before we started using it trying to get some interactions involving collections was heart-breaking. However I'm led to believe 2.8 will solve this.
In general I find the interactions between scala and java very close to using one language.

Related

Testing APIs with Gherkin/Java and IntelliJ IDEA

I have been asked to create some automation tests to test an API for a project. I am fairly new to automation testing with limited knowledge of java. The instructions I have been given include; create a BDD style test suite using cucumber/gherkin syntax, utilizing Apache fluent-hc to interrogate the API. I have also been asked to create the test suite using Java. How can I utilize 'Apache fluent-hc' to test my API and can this be done via a Java IDE like 'IntelliJ IDEA'? Thanks
That's indeed a very general question. I can just say in really short "yes you can use IntelliJ IDEA" for all Java related development.
From the other point, it is something that you have to learn and understand your own, before starting any development, as a sample, in which way your BDD tests will be developed based on the API technology and as you said that you have limited knowledge of Java I would suggest you read first how to create API in Java, of course, it all based on your requirements, but I prefer API development using Spring Boot.
And if you are interested in that, I will post my blog post URL here later on where I'm describing from 0 to end how to cover APIs with BDD (currently it is under preparation, next week I will post it).
Meanwhile, I will suggest you read this blog and earn some knowledge of APIs and their testing.
UPDATE: Here is the blog post about BDD that I promised - https://www.blazemeter.com/blog/api-testing-with-cucumber-bdd-configuration-tips

Building Ruby Documentation for Java Classes/Source

As I've recently started using JRuby, more specifically building Java applications using Ruby code, I've started using Java Libraries such as LWJGL and Slick.
I know JRuby changes Java method names to a more ruby-esque structure, my question is, is there any current way to generate Ruby documentation, either from source or by conversion of current documentation or even based on what JRuby exposes the methods themselves as?
At some point when JRuby 1.6.7 is out I plan on cleaning this really rough project for just such a thing:
https://github.com/enebo/noridoc
The intention is it will weave both Java and Ruby syntax together and give reasonable documentation for a Rubyist wanting to know all Ruby methods. In it's current form you should be able to generate a reasonable set of HTML docs of Java code showing you all ruby aliased methods. You will need to screw around with the javadoc comment.
Oh and we plan on making this tool available out of the box in JRuby once it is good enough to merge.

Experiences with integration testing java web applications, is cucumber viable?

I know cucumber from the rails community, and it seems to potentially be used in java.
Has anyone actually used it successfully on a project? Any issues with it?
I am thinking selenium is probably the most stable solution for integration testing a spring app?
With selenium, I guess the best way would be to use the browser add-on correct? I am looking for a simple and effective solution that isn't time consuming to create/maintain and run.
Sure, it's viable, although I used JRuby for Java library integration.
Personally, I'm not a fan. I much prefer easyb, although part of the reason was an easier transition for some devs from Java to something higher-level. I find Cucumber a bit hoop-ful, but YMMV.
We had a few glitches making easyb output play nice with Hudson, but relatively minor.

How can you use groovy inside Play! Framework, outside of templates?

The FAQ states
Is play a Groovy framework?
No. Even if we use Groovy as the base technology for the Play
templating system, it’s totally transparent. Also, you can’t write
directly any other part of the application (such as controllers,
models or other utilities) in Groovy. If you’re looking for a Groovy
based framework you should have a look at Grails.
While I get that it's not supported out of the box, I do believe/hope the integration is possible ... I mean, Java is Turing Complete after all :)
So, has anyone experimented in writing Groovy code, and calling that code from Play! Controllers? What's the best way to achieve that?
Bonus points: If the solution worked seamlessly with IntelliJ, that would be heaven.
As said in the documentation, Play is not a Groovy framework. Is is plain java and I am not aware of any initiative of using Groovy in Play.
Plus, bonus point, Play2 has completly removed Groovy even in templates to be replaced by Scala. So I think that even if a solution exists it might not be maintained in the future.

Advice for mapping an undocumented Java Eclipse Project

I have started at a new firm and as part of my duties am making small changes on a Java Project that was developed previously. The problem is that it is mostly undocumented and very complex. By undocumented I mean no comments, no Java doc, no documentation guide, nothing. It's a website Java project developed in Eclipse and built using Ant. My question is what tools are available to help me map out the project to better understand it. Or is there any advice on the best set of steps to follow.
Thank you for your time.
Look into reverse engineering tools that can create UML diagrams for java, like omondo. If the ant build script is complex aswell - I once visualized some complex ant build script using yEd, that helped a lot.
I personally found that UML-based tools do not scale well in such cases, except for some very specific cases, where sequence diagrams might help a lot.
Instead, I would refer to the following book (available online) for a general approach to the problem:
http://scg.unibe.ch/download/oorp/
And try out some research tools for code visualization to get an overview, for example:
http://www.inf.usi.ch/faculty/lanza/codecrawler.html
(would love to post more links, but can't due to stackoverflow's spam prevention mechanism)

Categories