This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Submission Jar: test case + Ant build script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Submission Jar: test case + Ant build script" Watch "Submission Jar: test case + Ant build script" New topic
Author

Submission Jar: test case + Ant build script

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi all,

This is the test case (JUnit 4) I used to check if the submission jar is valid and contains all necessary files (in the appropriate directories). It checks also some source requirements:
- are interfaces DBMain (= Sun's interface) and Data in the correct package?
- are the exceptions (mentioned in Sun's interface) in the correct package?
- does Data implement DBMain?
- do the exceptions (mentioned in Sun's interface) have 2 constructors: one with zero-argument constructor and one with String argument?

My assignment was URLyBird 1.3.1, so if you have another assignment, make sure you make the necessary changes to the test case before using it. I decided also to have a simple plain text userguide. So if you have a HTML one, you will need to make changes too.



And this is the Ant build script. I put this script in the root of my sources and defined all directories (in the build script) with a relative path. After building the submission jar I executed all tests I had (including the test case above). And of course the build script just copies the necessary files, no moving or deleting (except for the generated files of course). So you don't have to worry that suddenly your source files disappeared for example
The build script creates:
- the runme.jar
- the javadoc (for all members/classes except private ones, and creates also links for every class from the Java API)
- the RMI stubs (if you don't want it, just comment/delete the line <rmic ... />)
- the submission jar

Just complete the properties and then you can run the build script with the target of your choice (javadoc, create-executable-jar, create-submission-jar or the default one buildAndTest).



This build script was for me a real life-saver, because I submitted my assignment just 15 minutes before I had to leave to take the essay exam (making my choices.txt took a whole lot longer than I thought) and thanks to this build script I was 100% sure that I wasn't forgetting anything and my submission jar was

If you should have any questions about use or modifications, just let me know by replying to this thread (and I'll try answering them).

Good luck with your assignments!
Kind regards,
Roel

[edit] changed the javadoc target and increase readibility (according to Andrew's remark)


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2265
    
    3

Howdy, Roel!!!

This is great! Thank you so much for sharing this valuable tool. I'm sure this will be of great value to everyone still working on the assignment, and certainly will help people to submit the final project with everything in the right place.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi all,

Everybody knows Roberto Perillo 's famous data locking test (you can find it here). It is easy to add this test to the build script:
- first modify the test so it 's adapted to your Data class
- be sure to put the test in the test directory (property "dir.test")
- then just add the following line to the target "buildAndTest" (after the comment "execute tests")



That's it! And likewise you can add every test you want to the build script. If the test is a JUnit test case then you have to add it like the TestJarSubmission test is added. If it is just a Java program then you can add just as Roberto's data locking test.

Kind regards,
Roel
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11437
    
  85

Hi Roel,

This is great - thanks for sharing. Do you feel like adding a link to this in the JavaRanch SCJD FAQ? (The FAQ is just a wiki page - you can edit it yourself).

Roel De Nijs wrote:to have a bit a readible thread I changed the javadoc call a bit: if you want to use the build file you just have to delete ...> and <...

To get around that particular problem, I tend to split my lines - even in the production code. I personally feel the following is a little easier to read (and a little easier to remove a single line if I need to):


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Andrew Monkhouse wrote:To get around that particular problem, I tend to split my lines - even in the production code.

Normally I also split my lines (because indeed it is easier to read/maintain), I have no idea why I didn't do it here

Andrew Monkhouse wrote:Do you feel like adding a link to this in the JavaRanch SCJD FAQ?

I added the link.

Kind regards,
Roel
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
There is also a similar test and ant script - http://www.coderanch.com/t/189448/Developer-Certification-SCJD/certification/Assignment-submission-file-structure-verification - these are the ones I used (slightly modified) for my assignment verification test and build script.

What is useful in that ant build and you could also add to yours is the javadoccheck target.


SCJP 1.4 100%
SCJD 99.5%
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi Alecsandru,

I never used the doc check utility, so i don't have any idea what it does and what's the added value. I think if you add verbose="true" you will see what javadoc is doing and when a problem occurs (like a parameter that is not defined in the parameter list,...) an error message is shown to the console (cfr. the "Generate Javadoc" menu-item from Eclipse).

Kind regards,
Roel
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
DocCheck generates HTML reports about how well your code is documented. You should try it
Vasya Pupkin
Ranch Hand

Joined: Dec 06, 2006
Posts: 39
Roel, thanks again for your shared code.
I was debating with myself for a while about writing build.xml
I was postponing it till the very last minute, and here you are with your build script.
I finally had some time to run your code. It did not take long to modify everything for my needs (B&S).

Alecsandru Cocarla, thanks for the reference too. PMD and javadoccheck appear to be very helpful.


SCJP, SCJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Alecsandru Cocarla wrote:DocCheck generates HTML reports about how well your code is documented. You should try it

I tried the docCheck on my source code and I don't think it has any added value (but of course that is just my opinion). If i take a look at the generated reports it tells me that I have missing comments for 10 methods and I have 4 minor errors of category 4 (Text/Link Error). If i have a closer look I see the following:
- 8 methods don't have comments in DBMain interface (that's normal, because I decided not to change a thing about sun's given interface and have javadoc in my own created interface)
- the other 2 methods without having a comment are the methods values() and valueOf(String) of an enum (probably a normal issue because docCheck should be used with jdk 1.2, 1.3 and 1.4, no specific mention of jdk 1.5 or higher)
- the 4 minor errors are the same: "Html Error in First Sentence --Missing a period" (these errors can be solved by adding a period after {@inheritDoc})

Then of course I added some real javadoc errors to see how docCheck handles these ones: an empty return-tag and a non-existing parameter name after the param-tag. DocCheck shows in the report I have also 3 minor errors of category 3 (Tag Error) and that is as expected. But like I said in a previous post the javadoc tool will show you the same errors:

...
MyInterface.java:72: warning - @return tag has no arguments.
MyInterface.java:59: warning - @param argument "parameter2" is not a parameter name.
...
2 warnings

So no added value at all in my humble opinion.

Vasya Pupkin wrote:PMD and javadoccheck appear to be very helpful.

I also did a test with PMD and I have to say that is really useful. I let PMD check the sources that I submitted and it found approximately 250 violations. But i didn't agree with all the violations (like the one that says you should only have 1 return statement in a method). But it is certainly worth your while. And it has also various plugins for IDE, so if you use it through an IDE you can indicate which rules must be checked and about which you don't care.
I think you should certainly run PMD once to see how you can improve your source code (but of course this is again my humble opinion, because I didn't do it myself but in my defense: I didn't know the existence of this plugin/tool )

Vasya Pupkin wrote:Roel, thanks again for your shared code. I finally had some time to run your code. It did not take long to modify everything for my needs (B&S).

I'm glad it was useful for you.

Kind regards,
Roel
Nilesh Thali
Greenhorn

Joined: Jan 13, 2009
Posts: 16
Adding Roel's answer from my question about "javadoc -overview" in a separate post:

Roel De Nijs wrote:Hi Nilesh,

This certainly is the first topic having my name in the title

Nilesh Thali wrote:Addressing this to you, Roel, since you created this extremely handy ant build file

Glad I could help and share with the community

It would have been better if you asked your question in the thread where I posted my Ant-file, so everybody using that build file, could also read your question (and my answer). So someone else with the same question, wouldn't have to post it again, because you already did.

More info about the overview comment file, you can read here. This section of the javadoc tool documentation covers all your questions, so I would suggest just reading it and it will (hopefully) clear all your doubts.

Kind regards,
Roel
Pieter Jacobs
Ranch Hand

Joined: May 20, 2009
Posts: 87
Hi Roel,

Awesome bud!! Thanks.

I ran this an all ok.
I have the "Bodgitt & Scarper 2.1.2" assignment; and even though is says that my DB class is assignable; I'm still worried because I did not implement DB, but implemented an interface that extends DB; is that really OK?

Sorry I'm just fricken nervous too, because I'm doing the essay exam tomorrow

Thanks again,
Pieter
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi Pieter,

From my assignment:
If this doesn't have a calming effect, nothing will

Kind regards,
Roel
Pieter Jacobs
Ranch Hand

Joined: May 20, 2009
Posts: 87
Hi Roel,

Thanks!!!

Enjoy the evening - or what's left of it

Pieter
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Roel,

I am trying to generate everything and my submission jar using
your Ant build script as is without any changes in Solaris 10 on SPARC, latest Java 6 JDK
and latest Ant binaries.

I have not used Ant much and I have no clue why is generating that error
generating javadoc but the file is complaining about doesn't exist.
Not sure if that's the issue.

Did I miss anything or any other steps I should have done before?

javadoc:
[javadoc] Generating Javadoc
[javadoc] Javadoc execution
[javadoc] Loading source files for package suncertify.db...
[javadoc] Loading source files for package suncertify.direct...
[javadoc] Loading source files for package suncertify.domain...
[javadoc] Loading source files for package suncertify.gui...
[javadoc] Loading source files for package suncertify.remote...
[javadoc] Loading source files for package suncertify.test...
[javadoc] Constructing Javadoc information...
[javadoc] Standard Doclet version 1.6.0_18
[javadoc] Building tree for all the packages and classes...
[javadoc] Building index for all the packages and classes...
[javadoc] Building index for all classes...
[javadoc] javadoc: error - Error while reading file /home/morillo/src/java/scjd/submission/src/overview.html
[javadoc] Generating /home/morillo/src/java/scjd/submission/output/submission/docs/javadoc/stylesheet.css...
[javadoc] 1 error

BUILD FAILED
/home/morillo/src/java/scjd/submission/build.xml:92: Javadoc returned 1

Total time: 23 seconds
[auyantepui]</home/morillo/src/java/scjd/submission>% java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server VM (build 16.0-b13, mixed mode)
[auyantepui]</home/morillo/src/java/scjd/submission>% cat /etc/release
Solaris 10 5/09 s10s_u7wos_08 SPARC
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 30 March 2009
[auyantepui]</home/morillo/src/java/scjd/submission>% file /home/morillo/src/java/scjd/submission/src/overview.html
/home/morillo/src/java/scjd/submission/src/overview.html: cannot open: No such file or directory
[auyantepui]</home/morillo/src/java/scjd/submission>%



Thanks in advance,


Carlos.


SCSA, OCA, SCJP 5.0, SCJD http://www.linkedin.com/in/carlosamorillo
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Carlos,

Do you have an overview.html file in your src directory? Everyhting you need to know about javadoc's overview option can be found in this post

Kind regards,
Roel
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Roel,

Yes, I was missing that file. I didn't know I had to create it.

I guess I have to create a similar file for every package like in the Denny's DVDs example
in the Monkhouse book.

Now I am getting this error and I have no clue.

create-submission-jar:
[unjar] Expanding: /home/morillo/src/java/scjd/submission/ASSIGNMENT.jar into /home/morillo/src/java/scjd/submission/output/temp/assignment

BUILD FAILED
/home/morillo/src/java/scjd/submission/build.xml:118: Error while expanding /home/morillo/src/java/scjd/submission/ASSIGNMENT.jar

Total time: 24 seconds
[auyantepui]</home/morillo/src/java/scjd/submission>%

Do I need to move or copy instructions.html, choices.txt and userguide.txt anywhere?
They are in the same directory that has build.xml and the src directory containing all my project
source code.

Apologies if this a too basic question.

Thanks,

Carlos.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi Carlos,

It's pretty easy : the ASSIGNMENT.jar should be placed at the same level as the ant script. The script uses this original jar to extract it and then copy the db file and the instructions.html to the appropriate location in the submission jar. Your userguide and choices.txt should also be place at this level.

Kind regards,
Roel
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Roel,

Oops!


Makes sense, very clever and pretty cool on your part.

Got that target to work.


Now I think the last target running ant with no parameters I get:

buildAndTest:
[unjar] Expanding: /home/morillo/src/java/scjd/submission/Carlos_Morillo.jar into /home/morillo/src/java/scjd/submission/output/temp/submission
[javac] Compiling 45 source files to /home/morillo/src/java/scjd/submission/output/temp/test
.
.The full path of every file in my source code with [javac] at the beginning of the line
.


BUILD FAILED
/home/morillo/src/java/scjd/submission/build.xml:151: /home/morillo/src/java/scjd/submission/src/resources not found.

Total time: 32 seconds
[auyantepui]</home/morillo/src/java/scjd/submission>%


I think I need to do something also with that Java Source Code at the beginning of your thread
that looks like it's using the reflection API. I guess at least modify it accordingly to my assignment specification.

I am running all of this and editing this by hand from a shell.

Was this supposed to be run from an IDE?

It looks also the class you have at the beginning has to be in the source code hierarchy of the assignment?

I apologize again if this is too basic and if I am supposed to know about this.


Thanks again,


Carlos.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi Carlos,

I used Eclipse as IDE, which has built-in support for Ant (and will make your life a lot easier when editing some build scripts).

If you just want to create the submission jar, you can change the default target of the ant build (default="create-submission-jar" instead of default="buildAndTest") or you can run the create-submission-jar target instead of the default one (for more info on how to do that, without using an IDE, check the ant pages on the internet). And you won't get this exception.

If you simply want to create the submission jar and afterwards run the test-case TestJarSubmission (which you adapted to your situation and instructions) and/or other tests, you will have to make sure that you define the source directory of the test files (property dir.test) (I used for example another java project for my test cases). If you only want to run the submission jar test, you can delete lines 150 until 153 (included) and you won't get the exception.
I had a lot of test-cases (other than the submission jar test and specific to my assignment and implementation, so I couldn't share them) and they require resources (read: database files, valid ones but also invalid ones: an empty one, one with a wrong cookie value,...). So these lines (150 - 153) just copy these files to another directory. So my test-cases always run from the same starting point, no matter how many times I invoked the build script. That's the purpose of these 4 lines and that's why you got that exception (you don't have a resources directory and you don't need one if you just want to create submission jar and run the test-case TestJarSubmission).

Kind regards,
Roel
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Roel,

I am using Eclipse too in Windows XP and NetBeans on Solaris 10 and Ubuntu Linux,
but I am afraid of touching the build.xml file that the IDE uses. I don't want to mess up with it.

I thought since you called it script that perhaps it was possible to run it
from the command line. I feel more comfortable doing things from the command line
using Solaris and Linux than using Windows.

Anyway, just to wrap things up and conclude my comments, I did what you suggested
in Solaris and now I get:

BUILD FAILED
/home/morillo/src/java/scjd/submission/build.xml:155: The <classpath> for <junit> must include junit.jar if not in Ant's own classpath

Total time: 32 seconds
[auyantepui]</home/morillo/src/java/scjd/submission>%


which could be solved I guess by adding the JUnit4.jar from NetBeans in Solaris or perhaps
downloading it and adding it to the Classpath.

Anyway, a bit of additional work for me, what I did was the Carlos_Morillo.jar (submission jar) file
created with your build.xml in Solaris, I ftped it to my Windows XP laptop, unjared it and under Eclipse
I created a Junit 4 Test case with your Java code above and the wizard obviously asked me to add
junit.jar to the classpath of my project, did some minor changes like my database file name, interface
name, etc. and ran the TestJarSubmission inside Eclipse and it shows a green bar and green checkmark
4/4 Runs, 0 Errors, 0 Failures, so I think I should be good to go.


Thanks once again for all your help and assistance!


Best Regards,


Carlos.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Carlos Morillo wrote:I thought since you called it script that perhaps it was possible to run it from the command line.

You can run it from the command line if you have ant installed, but I don't have any experience with it at all because I use Windows all the time (and now and then use command line to perform basic tasks like ping another ip, retrieve ip address of my pc,...)

Carlos Morillo wrote:which could be solved I guess by adding the JUnit4.jar from NetBeans in Solaris or perhaps downloading it and adding it to the Classpath.

Exactly

Carlos Morillo wrote:it shows a green bar and green checkmark 4/4 Runs, 0 Errors, 0 Failures, so I think I should be good to go.

Finally it's submission time, so you can start your weeks and weeks of waiting for the result
Roberto Demestri
Greenhorn

Joined: Mar 28, 2011
Posts: 10

After a few tweaks i finally got the script to run; but when the test starts i got
[junit] Running suncertify.tests.TestJarSubmission
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,016 sec
[junit] Test suncertify.tests.TestJarSubmission FAILED
BUILD SUCCESSFUL
Total time: 15 seconds

how can i know what was wrong ???
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Run the test on itself (using junit support from your IDE) or add some properties to the junit ant task to provide more output (more info can be found here).
Michael Enudi
Greenhorn

Joined: Apr 24, 2011
Posts: 20
Hey Roel,

I had done all the submission process and concluded before my eyes fell on this thread. I had to start again, editted the script to suite my cases, struggle through some configuration and at last, I can say the feeling is worth it.
I don't know if I previously did anything wrong but now I just feel more confident.

Thanks for sharing.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Michael Enudi wrote:I don't know if I previously did anything wrong but now I just feel more confident.

Thanks for sharing.

Glad to hear it was helpful to you. When I had finished this build script I felt a lot more confident too
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Just taking a look over this ANT script and wondering about the line below from the "create-submission-jar" target - what is the idea behind unjaring to a temp directory? This temp directory is not used again in the target. Is it to simply prove you can unjar the file?

EDIT: Ooops, silly question! The JAR referenced by jar.assignment contains the actual files you received from Oracle as part of your assignment. You unjar this JAR file so that the other properties like file.db are valid, as other properties like file.db have been set up to reference the files from this temp directory i.e.

A small bit confusing! But I get it now

SCJP (1.4 | 5.0), OCJP (6.0), OCMJD
Sean Keane
Ranch Hand

Joined: Nov 03, 2010
Posts: 581

Many thanks to Roel for providing this handy script. I got it working pretty quickly.

The only changes that I needed to make were:

1. Create the ASSIGNMENT.zip containing the DB file and instructions I received from Oracle.
2. Comment out the copying of the resources directory in the buildAndTest target.
3. I added includeantruntime="false" to any javac calls in the build script (see this post here for further info).

One small change I would suggest is to the testSourceRequirements method in the TestJarSubmission class - just add a message string to the first Assert.assertTrue. See line 5 below:



I also modified the buildAndTest target to print me out a report (hacked together quickly without structuring nicely - but it works!)
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Sean Keane wrote:One small change I would suggest is to the testSourceRequirements method in the TestJarSubmission class - just add a message string to the first Assert.assertTrue.

Suggested change applied
Colin Duggan
Ranch Hand

Joined: Feb 23, 2008
Posts: 41
Hi Roel, thanks for the test and build script. I'm trying to send off my submission and running your build script creates the jars however when i try and run the submission jar i get this;
failed to load main-class manifest attribute from


when i look in my manifest file no main class has been specified. In the build script i see that only the name value is set in the manifest.



How does the submission jar write the main class to the manifest if its not mentioned here?Thanks

Colin Duggan
Ranch Hand

Joined: Feb 23, 2008
Posts: 41
Just re read the submission instructions and see that the submission jar contains the executable jar as does the one your script creates. Thanks
Daniel Kohl
Greenhorn

Joined: Mar 22, 2012
Posts: 3
Hmmm...in my assignment the layout of the .jar is described as a "must", and finally the description doesn't contain a META-INF at root.
Unfortunately the script builds a META-INF-Folder automatically so i ended up in calling the jar-Tool itself (with option M).

Greetings


OCJP 6, OCMJD (on its way :-))
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

Hi Daniel,

Welcome to the JavaRanch!

Daniel Kohl wrote:Unfortunately the script builds a META-INF-Folder automatically so i ended up in calling the jar-Tool itself (with option M).

I used the ant-script myself and my submission jar also contains a META-INF folder. No need to worry about it, because I passed without any problem.

Kind regards,
Roel
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1505
    
    5

Daniel Kohl wrote:Hmmm...in my assignment the layout of the .jar is described as a "must", and finally the description doesn't contain a META-INF at root.
Unfortunately the script builds a META-INF-Folder automatically so i ended up in calling the jar-Tool itself (with option M).

Greetings

Welcome to CodeRanch!

I'm not sure, but I guess in the requirement document, there is a command given - which will be used to run your jar (e.g. java -jar runme.jar). At that time, there has to be someone to tell Java that which is the main class (i.e. entry point). That is the purpose of META-INF/manifest.mf file.

Just like Roel De Nijs, even my jar also did contain that dir - rather I myself put that entry in jar (I did not use this ant script though), so you should not worry about that.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Daniel Kohl
Greenhorn

Joined: Mar 22, 2012
Posts: 3
Anayonkar Shivalkar wrote:
I'm not sure, but I guess in the requirement document, there is a command given - which will be used to run your jar (e.g. java -jar runme.jar). At that time, there has to be someone to tell Java that which is the main class (i.e. entry point). That is the purpose of META-INF/manifest.mf file.


Yes, indeed, the runme.jar needs a META-INF, but that's not the point here.

The packaging-jar AROUND ALL FILES (the submission-package), will also have a useless META-INF using this ant-script.
That's not mentionend in the requirement and the described layout is a must-requirement.


Greetings
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1505
    
    5

Daniel Kohl wrote:The packaging-jar AROUND ALL FILES (the submission-package), will also have a useless META-INF using this ant-script.
That's not mentionend in the requirement and the described layout is a must-requirement.

Ah... now I got it. Well, as mentioned, I did not use that ant script, so there was no such MET-INF directory in main jar.

But of course, if Roel is saying that there's no problem, then you gotta trust that
Daniel Kohl
Greenhorn

Joined: Mar 22, 2012
Posts: 3
Yes, of course! I trust him! But finally the decision is made by the examiner(s).
Marcin Mroczkowski
Greenhorn

Joined: Apr 15, 2013
Posts: 17

I think line length checks for all .java files could be really useful. It's one of most controversial rules in Java code conventions, but it's still there and it's really easy to miss this flaw during code review.

My suggestion: do some recurrent directory scan, get all .java files, scan all lines:
- if line is longer than 80, output warning
- if line is longer than 100, fail test


True example, eclipse formatter can be been killed by this line:
Eclipse on "Java Code Conventions" formatter preset, will not wrap things like this and it creates room for possible point loss.


OCJP 6, OCMJD 6
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5230
    
  12

In my opinion this particular code convention is outdated. During development we use a line length of 120-125 characters without any length.

The reason why such a check isn't added, is that I believed (and still believe) that consistency is more important than strictly following the code conventions. And you can get this consistency by using a code formatter in your IDE. Enabling this formatter for every save action (and/or applying formatter just before submitting) will result in consistent code formatting. No test case needed.
Joel Mata
Greenhorn

Joined: Oct 31, 2009
Posts: 25

Just a note.

Is was receiving these multiple errors...


in order to solve this i had to:
1) create a lib folder
2) download and save in 1) the junit4 jar
3) edit the ant build properties (right click, "Ant Debug Build…", and edit the class path in order to add the file 2)

Hope it helps.


ITIL V3, SCJP, Spring Core v3 and Going for the OCJMD
 
Consider Paul's rocket mass heater.
 
subject: Submission Jar: test case + Ant build script