You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by vd...@apache.org on 2014/06/23 04:48:52 UTC

svn commit: r1604686 - in /openmeetings/branches/3.0.x/src: db/java/org/apache/openmeetings/db/dao/user/UserDao.java test/java/org/apache/openmeetings/test/user/TestUserCount.java

Author: vdegtyarev
Date: Mon Jun 23 02:48:51 2014
New Revision: 1604686

URL: http://svn.apache.org/r1604686
Log:
OPENMEETINGS-1027 is fixed. Search works as expected.

Added:
    openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/user/TestUserCount.java
Modified:
    openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/user/UserDao.java

Modified: openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/user/UserDao.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/user/UserDao.java?rev=1604686&r1=1604685&r2=1604686&view=diff
==============================================================================
--- openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/user/UserDao.java (original)
+++ openmeetings/branches/3.0.x/src/db/java/org/apache/openmeetings/db/dao/user/UserDao.java Mon Jun 23 02:48:51 2014
@@ -166,7 +166,7 @@ public class UserDao implements IDataPro
 	}
 
 	public long count(String search) {
-		return count(search, true, -1);
+		return count(search, false, -1);
 	}
 	
 	public long count(String search, long currentUserId) {

Added: openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/user/TestUserCount.java
URL: http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/user/TestUserCount.java?rev=1604686&view=auto
==============================================================================
--- openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/user/TestUserCount.java (added)
+++ openmeetings/branches/3.0.x/src/test/java/org/apache/openmeetings/test/user/TestUserCount.java Mon Jun 23 02:48:51 2014
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.test.user;
+
+import static org.apache.openmeetings.web.app.WebSession.getUserId;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Random;
+
+import org.apache.openmeetings.db.dao.user.UserDao;
+import org.apache.openmeetings.db.entity.user.User;
+import org.apache.openmeetings.test.AbstractWicketTester;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class TestUserCount extends AbstractWicketTester {
+	@Autowired
+	private UserDao userDao;
+	Random random = new Random();
+
+	@Test
+	public void testCountSearchUsres() throws Exception {
+		User u = createUser(random.nextInt());
+		assertTrue("Account of search users should be one", userDao.count(u.getFirstname()) == 1);
+	}
+
+	@Test
+	public void testCountFilteredUsres() throws Exception {
+		User u = createUser(random.nextInt());
+		User contact = createUserContact(random.nextInt(), u.getUser_id());
+		assertTrue("Account of filtered user should be one", userDao.count(contact.getFirstname(), true, u.getUser_id()) == 1);
+	}
+
+	@Test
+	public void testCountUnfilteredUsres() throws Exception {
+		User u = createUser(random.nextInt());
+		createUserContact(random.nextInt(), u.getUser_id());
+		assertTrue("Account of unfiltered should be more then one", userDao.count("firstname", false, getUserId()) > 1);
+	}
+		
+	@Test
+	public void testCountAllUsres() throws Exception {
+		assertTrue("Account of users should be positive", userDao.count() > 0);
+	}
+}