Re: What version of JUnit, again? - Mailing list pgsql-jdbc
From | David Ventimiglia |
---|---|
Subject | Re: What version of JUnit, again? |
Date | |
Msg-id | CALaE=t8=W97+59+SJ3gye-fLxn4EwRMjYkD9w3u8kpRjeDjgWg@mail.gmail.com Whole thread Raw |
In response to | Re: What version of JUnit, again? (Dave Cramer <pg@fastcrypt.com>) |
Responses |
Re: What version of JUnit, again?
|
List | pgsql-jdbc |
I have no CLASSPATH environment variable. As for the classpath that is used by Ant, it's my assumption that's handled by Ant and/or Maven. What I can tell you are these things.
- I'm on Ubuntu Linux, a Debian-based distro, where typically I install things using the package manager rather than by direct download.
- Therefore, I've both JUnit (3.8.2) and JUnit4 (4.0.0) "installed" courtesy of the apt-get package manager. But they're not on any CLASSPATH and Ant and Maven were unaware of them.
- Within the pgjdbc project, I ran `ant' as instructed. That failed, because the build.xml file has a dependency on JUnit 3.8.2.
- Helpfully, the Ant build error included instructions for how to satisfy the JUnit dependency (see below). I found the JUnit 3.8.2 JAR file that apt-get had installed on my system and fed that path into the Maven command.
- Ran `ant' again. This time, because the JUnit dependency had been satisfied, it successfully built the JDBC driver. But because it didn't run any tests, it didn't trigger any run-time error.
- Ran `ant test' and got the errors that I sent you.
- Noticed that the SingleCertValidatingFactoryTest class (if nothing else) imports from org.junit, which I understood to be a JUnit4 package (but maybe I'm wrong).
- I became confused.
The Maven command to install the JUnit jar was:
mvn install:install-file -DgroupId=junit -DartifactId=junit -Dversion=3.8.2 -Dpackaging=jar -Dfile=/usr/share/java/junit-3.8.2.jar
I assure you that the jar file is a bona fide JUnit 3.8.2 jar file.
On Sun, Aug 3, 2014 at 5:19 PM, Dave Cramer <pg@fastcrypt.com> wrote:
Is junit on the classpath ?On 3 August 2014 20:15, David Ventimiglia <dventimi@gmail.com> wrote:You bet. They're in the attached errors.txt file and also pasted in below.
Buildfile: /home/dventimi/work/pgjdbc/build.xml
prepare:
check_versions:
check_driver:
driver:
compile:
[javac] /home/dventimi/work/pgjdbc/build.xml:243: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
artifact-version:
[echo] Artifact version string: postgresql-9.4-1200.jdbc41
jar:
testjar:
[mkdir] Created dir: /home/dventimi/work/pgjdbc/build/tests
[javac] /home/dventimi/work/pgjdbc/build.xml:451: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 84 source files to /home/dventimi/work/pgjdbc/build/tests
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:3: error: package org.junit does not exist
[javac] import org.junit.Assert;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:4: error: package org.junit does not exist
[javac] import org.junit.Test;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:5: error: package org.junit does not exist
[javac] import org.junit.Before;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:6: error: package org.junit does not exist
[javac] import org.junit.BeforeClass;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:7: error: package org.junit.runners does not exist
[javac] import org.junit.runners.Parameterized;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:8: error: package org.junit.runners.Parameterized does not exist
[javac] import org.junit.runners.Parameterized.Parameters;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:9: error: package org.junit.runner does not exist
[javac] import org.junit.runner.RunWith;
[javac] ^
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:23: error: cannot find symbol
[javac] @RunWith(Parameterized.class)
[javac] ^
[javac] symbol: class RunWith
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:42: error: cannot find symbol
[javac] @Parameters
[javac] ^
[javac] symbol: class Parameters
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:181: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:203: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:213: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:223: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:240: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:257: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:274: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:307: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:327: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:351: error: cannot find symbol
[javac] @Test
[javac] ^
[javac] symbol: class Test
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:141: error: cannot find symbol
[javac] Assert.assertEquals(1, rs.getInt(1));
[javac] ^
[javac] symbol: variable Assert
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:147: error: cannot find symbol
[javac] Assert.assertEquals(sslExpected, sslActual);
[javac] ^
[javac] symbol: variable Assert
[javac] location: class SingleCertValidatingFactoryTest
[javac] /home/dventimi/work/pgjdbc/org/postgresql/test/ssl/SingleCertValidatingFactoryTest.java:172: error: cannot find symbol
[javac] Assert.fail("Expected exception " + expectedThrowable.getName() + " but it did not occur.");
[javac] ^
[javac] symbol: variable Assert
[javac] location: class SingleCertValidatingFactoryTest
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 22 errors
BUILD FAILED
/home/dventimi/work/pgjdbc/build.xml:451: Compile failed; see the compiler error output for details.
Total time: 12 secondsOn Sun, Aug 3, 2014 at 5:07 PM, Dave Cramer <pg@fastcrypt.com> wrote:Pretty sure I use 3.8.2Can you provide me with the errors you are getting ?On 3 August 2014 16:53, David Ventimiglia <dventimi@gmail.com> wrote:Presumably, this is why running `ant test' in pgjdbc fails for me with compilation errors. I confess, I'm not an expert with Ant and Maven, so maybe I've done something wrong. But, exactly waht version of JUnit should I be using? Thanks!On the other hand, the pgjdbc Ant build.xml file specifies JUnit 3.8.2.:An example of such a test is SingleCertValidatingFactoryTest.java in pgjdbc/org/postgresql/test/ssl directory (presumably other tests are like this).Hi,But, there's a big between JUnit 3.8 and earlier and JUnit 4. The former has components in packages junit.framework while the latter has components in org.junit and so test that directly import on or the other of those packages are sensitive to the version of JUnit you're using.
I'm a little confused as to what version of JUnit I'm supposed to be using in order to build/test the Postgresql JDBC driver. This page says that "JUnit at least 3.7 is needed."
http://jdbc.postgresql.org/development/development.html
<artifact:dependencies pathId="dependency.classpath" useScope="test">
<dependency groupId="junit" artifactId="junit" version="3.8.2" scope="test"/>
</artifact:dependencies>
Best,
David Ventimiglia
pgsql-jdbc by date: