Author: solomax
Date: Thu Mar 15 17:32:24 2012
New Revision: 1301108

URL: http://svn.apache.org/viewvc?rev=1301108&view=rev
Log:
Errors in tests and configuration are fixed

Modified:
    incubator/openmeetings/trunk/singlewebapp/.classpath
    incubator/openmeetings/trunk/singlewebapp/build.xml
    
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
    
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/calendar/TestAppointmentAddAppointment.java
    
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/navi/TestNavi.java
    
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/sip/TestDebugConnection.java
    
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/userdata/TestLogin.java

Modified: incubator/openmeetings/trunk/singlewebapp/.classpath
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/.classpath?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/.classpath (original)
+++ incubator/openmeetings/trunk/singlewebapp/.classpath Thu Mar 15 17:32:24 
2012
@@ -82,7 +82,6 @@
        <classpathentry kind="lib" 
path="build/red5/dist/lib/spring-core-3.0.6.RELEASE.jar"/>
        <classpathentry kind="lib" 
path="build/red5/dist/lib/spring-expression-3.0.6.RELEASE.jar"/>
        <classpathentry kind="lib" 
path="build/red5/dist/lib/spring-web-3.0.6.RELEASE.jar"/>
-       <classpathentry kind="lib" path="build/red5/dist/lib/xmlrpc-2.0.1.jar"/>
        <classpathentry kind="lib" path="build/lib/om/batik-anim-jar-1.7.jar"/>
        <classpathentry kind="lib" 
path="build/lib/om/batik-awt-util-jar-1.7.jar"/>
        <classpathentry kind="lib" 
path="build/lib/om/batik-bridge-jar-1.7.jar"/>

Modified: incubator/openmeetings/trunk/singlewebapp/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/build.xml?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/build.xml (original)
+++ incubator/openmeetings/trunk/singlewebapp/build.xml Thu Mar 15 17:32:24 2012
@@ -662,17 +662,20 @@
 
        <path id="junit.classpath">
                <fileset dir="${junit.lib.dir}" includes="*.jar" />
+               <fileset dir="${om.dist.webapp}/WEB-INF/lib">
+                       <include name="*.jar" />
+                       <exclude name="openmeetings*.jar" />
+               </fileset>
                <fileset dir="${red5.root}" includes="*.jar" />
-               <fileset dir="${red5.server.lib}" includes="*.jar" />
+               <fileset dir="${red5.root}/lib" includes="*.jar" />
                <pathelement path="${om.dist.webapp}/WEB-INF" />
-               <pathelement path="${main.out.dir}" />
                <pathelement path="${om.dist.webapp}/WEB-INF/classes" />
-               <fileset dir="${om.dist.webapp}/WEB-INF/lib" includes="*.jar" />
+               <pathelement path="${main.out.dir}" />
        </path>
        <target name="test" depends="-dist-test-no-clean" description="Will run 
all tests unless -Dtestcases=_file_name_pattern_ will be passed">
                <mkdir dir="${junit.report.dir}" />
-               <property name="myclsp" refid="junit.classpath" />
-               <!--            <echo message="${myclsp}" /> -->
+               <!-- property name="myclsp" refid="junit.classpath" />
+               <echo message="${myclsp}" /-->
                <junit printsummary="yes" dir="${junit.base.dir}" 
tempdir="${junit.base.dir}" fork="yes" forkmode="perBatch">
                        <classpath refid="junit.classpath" />
                        <jvmarg value="-Dred5.root=${red5.root}" />
@@ -681,7 +684,8 @@
                        <formatter type="${junit.test.formatter}" />
                        <batchtest todir="${junit.report.dir}">
                                <fileset dir="${main.out.dir}">
-                                       <include 
name="org/openmeetings/test/**/${junit.test.pattern}" />
+                                       <include 
name="org/openmeetings/test/**/${junit.test.pattern}.class" />
+                                       <exclude name="**/*$$*.class" />
                                </fileset>
                        </batchtest>
                </junit>

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
 Thu Mar 15 17:32:24 2012
@@ -84,8 +84,8 @@ public abstract class AbstractOpenmeetin
        private static final String sip_phonerange_start = "";
        private static final String sip_phonerange = "";
        private static final String jodPath = "./jod/lib";
-       private static final String username = "junit";
-       private static final String userpass = "test";
+       protected static final String username = "junit";
+       protected static final String userpass = "test";
        private static final String orgname = "smoketest";
        private static final String timeZone = "";
        private static final String useremail = "[email protected]";

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/calendar/TestAppointmentAddAppointment.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/calendar/TestAppointmentAddAppointment.java?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/calendar/TestAppointmentAddAppointment.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/calendar/TestAppointmentAddAppointment.java
 Thu Mar 15 17:32:24 2012
@@ -95,7 +95,7 @@ public class TestAppointmentAddAppointme
                        
                        Thread.sleep(3000);
                        
-                       assertTrue(id != null && id > 0);
+                       assertTrue("Saved appointment should have valid id: " + 
id, id != null && id > 0);
 
                } catch (Exception err) {
                        log.error("[saveAppointment]", err);

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/navi/TestNavi.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/navi/TestNavi.java?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/navi/TestNavi.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/navi/TestNavi.java
 Thu Mar 15 17:32:24 2012
@@ -18,7 +18,9 @@
  */
 package org.openmeetings.test.navi;
 
-import java.util.Iterator;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import org.junit.Test;
@@ -41,31 +43,26 @@ public class TestNavi extends AbstractOp
                
                Sessiondata sessionData = mService.getsessiondata();
                
-               Users us = (Users) 
mService.loginUser(sessionData.getSession_id(), "SebastianWagner", 
"test",false,null,-1L);
+               Users us = (Users) 
mService.loginUser(sessionData.getSession_id(), username, userpass, false, 
null, -1L);
                
-               System.out.println("us: "+us.getFirstname());
+               assertNotNull("User is unable to login", us);
+               System.out.println("us: "+ us.getFirstname());
                
-        for (Iterator<Organisation_Users> iter = us.getOrganisation_users()
-                .iterator(); iter.hasNext();) {
+        for (Organisation_Users ou : us.getOrganisation_users()) {
 
-            Long organization_id = iter.next().getOrganisation()
-                    .getOrganisation_id();
+            Long organization_id = ou.getOrganisation().getOrganisation_id();
             List<Naviglobal> ll = 
mService.getNavi(sessionData.getSession_id(), 1, organization_id);
 
+            assertTrue("GlobalNavi size should be greater than zero: " + 
ll.size(), ll.size() > 0);
             System.out.println("NaviGlobal size: " + ll.size());
 
-            for (Iterator<Naviglobal> it2 = ll.iterator(); it2.hasNext();) {
-                Naviglobal navigl = it2.next();
-                System.out.println(navigl.getLabel().getValue());
-                List<Navimain> s = navigl.getMainnavi();
+            for (Naviglobal navigl : ll) {
+                System.out.println("Naviglobal label: " + 
navigl.getLabel().getValue());
 
-                for (Iterator<Navimain> it3 = s.iterator(); it3.hasNext();) {
-                    Navimain navim = it3.next();
+                for (Navimain navim : navigl.getMainnavi()) {
                     System.out.println("-->" + navim.getLabel().getValue());
 
-                    for (Iterator<Navisub> it4 = 
navim.getSubnavi().iterator(); it4
-                            .hasNext();) {
-                        Navisub navis = it4.next();
+                    for (Navisub navis : navim.getSubnavi()) {
                         System.out.println("---->"
                                 + navis.getLabel().getValue());
                     }

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/sip/TestDebugConnection.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/sip/TestDebugConnection.java?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/sip/TestDebugConnection.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/sip/TestDebugConnection.java
 Thu Mar 15 17:32:24 2012
@@ -36,6 +36,26 @@ import org.apache.xmlrpc.client.XmlRpcCl
 import org.junit.Test;
 import org.openmeetings.utils.crypt.MD5;
 
+class MyTrustManager implements X509TrustManager {
+       public X509Certificate[] getAcceptedIssuers() {
+               return null;
+       }
+       
+       public void checkClientTrusted(X509Certificate[] certs, String 
authType) {
+               // Trust always
+       }
+       
+       public void checkServerTrusted(X509Certificate[] certs, String 
authType) {
+               // Trust always
+       }
+}
+
+class MyHostnameVerifier implements HostnameVerifier {
+    public boolean verify(String arg0, SSLSession arg1) {
+            return true;
+    }
+}
+
 public class TestDebugConnection {
        
        private static Logger log = Logger.getLogger(TestDebugConnection.class);
@@ -47,30 +67,12 @@ public class TestDebugConnection {
                        log.debug("Test Connection");
                        
                    // Create a trust manager that does not validate 
certificate chains
-                   TrustManager[] trustAllCerts = new TrustManager[] {
-                       new X509TrustManager() {
-                           public X509Certificate[] getAcceptedIssuers() {
-                               return null;
-                           }
-                
-                           public void checkClientTrusted(X509Certificate[] 
certs, String authType) {
-                               // Trust always
-                           }
-                
-                           public void checkServerTrusted(X509Certificate[] 
certs, String authType) {
-                               // Trust always
-                           }
-                       }
-                   };
+                   TrustManager[] trustAllCerts = new TrustManager[] {new 
MyTrustManager()};
                 
                    // Install the all-trusting trust manager
                    SSLContext sc = SSLContext.getInstance("SSL");
                    // Create empty HostnameVerifier
-                   HostnameVerifier hv = new HostnameVerifier() {
-                               public boolean verify(String arg0, SSLSession 
arg1) {
-                                       return true;
-                               }
-                   };
+                   HostnameVerifier hv = new MyHostnameVerifier();
        
                    sc.init(null, trustAllCerts, new 
java.security.SecureRandom());
                    
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
@@ -146,117 +148,8 @@ public class TestDebugConnection {
                        log.error("[testConnection]",err);
                }
        }
-       
-       /**
-        * @param args
-        */
-       public static void main(String[] args) {
-               // TODO Auto-generated method stub
-               try {
-                       log.debug("Test Connection");
-                       
-                   // Create a trust manager that does not validate 
certificate chains
-                   TrustManager[] trustAllCerts = new TrustManager[] {
-                       new X509TrustManager() {
-                           public X509Certificate[] getAcceptedIssuers() {
-                               return null;
-                           }
-                
-                           public void checkClientTrusted(X509Certificate[] 
certs, String authType) {
-                               // Trust always
-                           }
-                
-                           public void checkServerTrusted(X509Certificate[] 
certs, String authType) {
-                               // Trust always
-                           }
-                       }
-                   };
-                
-                   // Install the all-trusting trust manager
-                   SSLContext sc = SSLContext.getInstance("SSL");
-                   // Create empty HostnameVerifier
-                   HostnameVerifier hv = new HostnameVerifier() {
-                               public boolean verify(String arg0, SSLSession 
arg1) {
-                                       return true;
-                               }
-                   };
-       
-                   sc.init(null, trustAllCerts, new 
java.security.SecureRandom());
-                   
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
-                   HttpsURLConnection.setDefaultHostnameVerifier(hv);
-                       
-                       XmlRpcClientConfigImpl config = new 
XmlRpcClientConfigImpl();
-                       
-                       log.debug("config User Agent "+config.getUserAgent());
-                       
-                   config.setServerURL(new 
URL("https://85.134.48.179/manager/xml_rpc_server.php";));
-                   XmlRpcClient client = new XmlRpcClient();
-                   
-                   client.setConfig(config);
-                   
-                   String client_id = "user_admin";
-                   String client_secret = "fMXCHeeS6JM9";
-                   
-                   
-                   String userid = "067201101";
-                   String domain = "voipt3.multi.fi";
-                   String first_name = "Matti";
-                   String middle_i = "X";
-                   String last_name = "Virtanen";
-                   String password = "password";
-                   String community_code = "999";
-                   String language_code = "fi";
-                   String email = "[email protected]";
-                   String adminid = "matti";
-                   
-                   String digest = digest_calculate(new Object[]{client_id, 
userid, domain,
-                                        first_name, middle_i, last_name,
-                                        password, community_code,
-                                        language_code, email, adminid,
-                                        client_secret});
-                   
-       //          $digest = digest_calculate($client_id, $userid, $domain,
-       //              $adminid, $client_secret);
-       //              $params = array(client_id=>$client_id, digest=>$digest, 
userid=>$userid,
-       //              domain=>$domain, adminid=>$adminid);
-                   
-                   
-                   log.debug(digest);
-                   
-                   //function user_info($userid, $domain, $adminid, &$error)
-                   Object[] params = new Object[]{client_id, digest, userid,
-                                         domain, first_name,
-                                         middle_i, last_name,
-                                         password, community_code,
-                                         language_code, email,
-                                         adminid};
-                   
-                   
-                   Object result = client.execute("OpenSIPg.UserCreate", 
params);
-                   
-                   if (result != null) {
-                       log.debug(result.getClass().getName());
-                       
-                       if (result instanceof Map) {
-                               
-                               Map<?, ?> mapResults = (Map<?, ?>) result;
-                               
-                               for (Iterator<?> iter = 
mapResults.keySet().iterator();iter.hasNext();) {
-                                       
-                                       Object key = iter.next();
-                                       log.debug("-- key "+key+" value 
"+mapResults.get(key));
-                                       
-                               }
-                               
-                       }
-                   }
-                   
-               } catch (Exception err) {
-                       log.error("[testConnection]",err);
-               }
-       }
 
-       public static String digest_calculate(Object[] params) throws Exception 
{
+       public String digest_calculate(Object[] params) throws Exception {
                String stringToMd5 = "";
                
                for (int i=0;i<params.length;i++) {

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/userdata/TestLogin.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/userdata/TestLogin.java?rev=1301108&r1=1301107&r2=1301108&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/userdata/TestLogin.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/test/org/openmeetings/test/userdata/TestLogin.java
 Thu Mar 15 17:32:24 2012
@@ -35,9 +35,9 @@ public class TestLogin extends AbstractO
        public void testTestLogin(){
                Sessiondata sessionData = mService.getsessiondata();
                
-               Users us = (Users) 
mService.loginUser(sessionData.getSession_id(), "swagner", 
"test",false,null,-1L);
+               Users us = (Users) 
mService.loginUser(sessionData.getSession_id(), username, userpass, false, 
null, -1L);
                
-               assertNotNull(us);
+               assertNotNull("User is unable to login", us);
                
                //mService.getLanguageById(1);
                


Reply via email to