update tests to JUnit4, separate by class
parent
fb18ed875a
commit
fbd4266c35
|
@ -142,7 +142,7 @@
|
||||||
|
|
||||||
<batchtest fork="yes" todir="${reports.dir}">
|
<batchtest fork="yes" todir="${reports.dir}">
|
||||||
<fileset dir="${test.dir}">
|
<fileset dir="${test.dir}">
|
||||||
<include name="**/*Test*.java"/>
|
<include name="**/*TestSuite.java"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</batchtest>
|
</batchtest>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/* WolfSSLTest.java
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of CyaSSL.
|
||||||
|
*
|
||||||
|
* CyaSSL is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* CyaSSL is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.wolfssl;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import com.wolfssl.WolfSSL;
|
||||||
|
|
||||||
|
public class WolfSSLContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWolfSSLContext() throws WolfSSLException {
|
||||||
|
|
||||||
|
WolfSSL lib = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
lib = new WolfSSL();
|
||||||
|
} catch (WolfSSLException e) {
|
||||||
|
fail("failed to create WolfSSL object");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("WolfSSLContext Class");
|
||||||
|
|
||||||
|
test_WolfSSLContext_new(lib.SSLv23_ServerMethod());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test_WolfSSLContext_new(long method) {
|
||||||
|
|
||||||
|
if (method != 0)
|
||||||
|
{
|
||||||
|
System.out.print("\tWolfSSLContext()");
|
||||||
|
WolfSSLContext wc = null;
|
||||||
|
|
||||||
|
/* test failure case */
|
||||||
|
try {
|
||||||
|
|
||||||
|
wc = new WolfSSLContext(0);
|
||||||
|
|
||||||
|
} catch (WolfSSLException e) {
|
||||||
|
|
||||||
|
/* now test success case */
|
||||||
|
try {
|
||||||
|
wc = new WolfSSLContext(method);
|
||||||
|
} catch (WolfSSLException we) {
|
||||||
|
System.out.println("\t... failed");
|
||||||
|
fail("failed to create WolfSSLContext object");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\t... passed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\t... failed");
|
||||||
|
fail("failure case improperly succeeded, WolfSSLContext()");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* WolfSSLTest.java
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of CyaSSL.
|
||||||
|
*
|
||||||
|
* CyaSSL is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* CyaSSL is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.wolfssl;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import com.wolfssl.WolfSSL;
|
||||||
|
|
||||||
|
public class WolfSSLSessionTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWolfSSLSession() throws WolfSSLException {
|
||||||
|
|
||||||
|
WolfSSL lib = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
lib = new WolfSSL();
|
||||||
|
} catch (WolfSSLException e) {
|
||||||
|
fail("failed to create WolfSSL object");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("WolfSSLSession Class");
|
||||||
|
|
||||||
|
test_WolfSSL_new(lib);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test_WolfSSL_new(WolfSSL lib) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.print("\tWolfSSL()");
|
||||||
|
lib = new WolfSSL();
|
||||||
|
} catch (UnsatisfiedLinkError ule) {
|
||||||
|
System.out.println("\t\t... failed");
|
||||||
|
fail("failed to load native JNI library");
|
||||||
|
} catch (WolfSSLException we) {
|
||||||
|
System.out.println("\t\t... failed");
|
||||||
|
fail("failed to create WolfSSL object");
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("\t\t... passed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -22,25 +22,42 @@
|
||||||
package com.wolfssl;
|
package com.wolfssl;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import junit.framework.TestCase;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import com.wolfssl.WolfSSL;
|
import com.wolfssl.WolfSSL;
|
||||||
|
|
||||||
public class WolfSSLTest extends TestCase {
|
public class WolfSSLTest {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void loadLibrary() {
|
||||||
|
try {
|
||||||
|
WolfSSL.loadLibrary();
|
||||||
|
} catch (UnsatisfiedLinkError ule) {
|
||||||
|
fail("failed to load native JNI library");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testWolfSSL() throws WolfSSLException {
|
public void testWolfSSL() throws WolfSSLException {
|
||||||
|
|
||||||
WolfSSL lib = null;
|
WolfSSL lib = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WolfSSL.loadLibrary();
|
|
||||||
lib = new WolfSSL();
|
lib = new WolfSSL();
|
||||||
} catch (UnsatisfiedLinkError ule) {
|
|
||||||
fail("failed to load native JNI library");
|
|
||||||
} catch (WolfSSLException e) {
|
} catch (WolfSSLException e) {
|
||||||
fail("failed to create WolfSSL object");
|
fail("failed to create WolfSSL object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("WolfSSL Class");
|
||||||
|
|
||||||
|
test_WolfSSL_Method_Allocators(lib);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void test_WolfSSL_Method_Allocators(WolfSSL lib) {
|
||||||
tstMethod(lib.SSLv3_ServerMethod(), "SSLv3_ServerMethod()");
|
tstMethod(lib.SSLv3_ServerMethod(), "SSLv3_ServerMethod()");
|
||||||
tstMethod(lib.SSLv3_ClientMethod(), "SSLv3_ClientMethod()");
|
tstMethod(lib.SSLv3_ClientMethod(), "SSLv3_ClientMethod()");
|
||||||
tstMethod(lib.TLSv1_ServerMethod(), "TLSv1_ServerMethod()");
|
tstMethod(lib.TLSv1_ServerMethod(), "TLSv1_ServerMethod()");
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* WolfSSLTest.java
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||||
|
*
|
||||||
|
* This file is part of CyaSSL.
|
||||||
|
*
|
||||||
|
* CyaSSL is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* CyaSSL is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.wolfssl;
|
||||||
|
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Suite;
|
||||||
|
|
||||||
|
@RunWith(Suite.class)
|
||||||
|
@Suite.SuiteClasses({
|
||||||
|
WolfSSLTest.class,
|
||||||
|
WolfSSLSessionTest.class,
|
||||||
|
WolfSSLContextTest.class
|
||||||
|
})
|
||||||
|
|
||||||
|
public class WolfSSLTestSuite {
|
||||||
|
/* this class remains empty,
|
||||||
|
* only used as a holder for the above
|
||||||
|
* annotations */
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue