-
Notifications
You must be signed in to change notification settings - Fork 0
Project Setup
Note: This is pretty out of date... 2/23/2014
JBrick is developed using Swing as well as the RText text editor library.
Developer's system requirements: The tools This is a small list of what you'll need:
Eclipse: Our favorite IDE. We also have it with the Ant plug-in. Git: Eclipse has integrated Git support, which is decent. eCobertura: Unit Test Coverage is never redundant. Lego Mindstorm NXT driver Java Communications API library
Checkout the project using eGit for easy set up. As stated above there are other methods available besides using this eclipse plug-in. All the dependencies and paths are included in the repository as relative path. OK, if you don't know where this is going, you can stop reading and head to the next section, otherwise don't point fingers at us for not using awesome tools such as Ivy or Maven. Maybe sometime, little grasshopper.
Meanwhile, look at the current project structure:
We have 3 source folders:
src: This is where the Java source files are located. resources: This is where the images and other resources are stored. tests: This is where the unit tests files are located. This folder's files should not be included in the packaged JAR file. There's also some files and folders that you might find useful:
docs: All the available artifacts created/updated while working on the project. help: The help contents. Remember to include this folder with your JAR file. Yeah, nobody remembers. icons: Icons copied from somewhere. The used icons are copied from this folder into the resources folder. build.xml: Ant script. jar-in-jar-loader.zip: Eclipse's JAR loader. Useful for including all the dependencies inside a single JAR file. JBConn.properties: Default connection to the brick: either USB or Bluetooth. This file shouldn't be committed to the repository, since it's created by JBrick and depends on the developer's preference. JBrickEditor.properties: JBrick settings file containing settings such as colors and workspace location. This file shouldn't be committed to the repository, since it's created by JBrick and depends on the developer's preferences. Some resources you may find useful for working with the NXT Brick communication are:
http://nxtpp.clustur.com/ http://epirsch.blogspot.com/2008/02/jna-love-nxt.html http://nxt-adventures.blogspot.com/2008/03/fantom-api-and-java.html
JUnit and Mockito: Because you're worth it As you might know, JUnit is the most famous unit testing framework for Java. Someone (the guy who wrote this wiki page) created a couple of unit tests to -- say -- test some of the classes.
That someone also wrote some tests with Mockito to create some fake objects and test tangible things -- without the tangible things. For example, the connection to the NXT Brick requires a Lego NXT brick, well that is, not if you can fake its existence. In this way, we're capable of "simulating" method calls to the classes responsible of dealing with the connection to the Brick.
If you've successfully set up the project with Git, then chances are that you've got under the jbrick project folder a source folder called tests, which is where the tests files are saved.
There's not really much UI testing as of now, especially since it's been converted to Swing.
Ant: Try automation You'll find a build.xml file under the jbrick project folder. This little file is responsible of building the executable JAR, the one you can find in the Downloads section. Also, we've included the automation of the unit tests before packaging the file. You may want to read the script file since it also provides some pointers on how everything works together.
Read a little bit more on the Ant script section.
Xbox360 Controller: Yeah, we've got that working Before starting JBrick, you have to plug an Xbox360 controller in, if you want to use it. Why? I don't know, somebody figured out that it would be cool to use Jinput.
Now, there's a caveat. Under the lib folder you'll see a bunch of dll files that somehow are used by Jinput. You might be thinking that it would only work on Windows, but we're not sure about it, we've only tested it on Windows 7.
To make it work on Eclipse, you have to add the following VM argument to the Running Configuration for the JBrickEditor class:
-Djava.library.path="lib" When packaging it to a zip file, you might want to copy the dlls in the same folder as the packaged JAR file. Why? No need to set VM arguments when running JBrick.
Wiimote: I'm not sure it works Somehow there's support for the Wiimote, but we haven't tested it.
Generating Comparison metrics All the comparison metrics have been generated using a javascript library jqplot.