You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/09/15 17:47:38 UTC

openmeetings git commit: [OPENMEETINGS-1705] get appointment by title api method is fixed

Repository: openmeetings
Updated Branches:
  refs/heads/OPENMEETINGS-1671-room-files 6eec97dce -> 6f81604bb


[OPENMEETINGS-1705] get appointment by title api method is fixed


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/6f81604b
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/6f81604b
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/6f81604b

Branch: refs/heads/OPENMEETINGS-1671-room-files
Commit: 6f81604bb0caae32a0d6163f8942e6182fd815a4
Parents: 6eec97d
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sat Sep 16 00:47:30 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sat Sep 16 00:47:30 2017 +0700

----------------------------------------------------------------------
 .../db/dao/calendar/AppointmentDao.java         |  2 +-
 .../test/webservice/TestCalendarService.java    | 42 ++++++++++++++++----
 2 files changed, 36 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/6f81604b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
index 694784d..2d9709c 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/calendar/AppointmentDao.java
@@ -204,7 +204,7 @@ public class AppointmentDao {
 	}
 
 	public List<Appointment> searchAppointmentsByTitle(Long userId, String title) {
-		return em.createNamedQuery("getNextAppointment", Appointment.class)
+		return em.createNamedQuery("getAppointmentsByTitle", Appointment.class)
 				.setParameter("title", title).setParameter("userId", userId).getResultList();
 	}
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/6f81604b/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java b/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
index 8af988b..6ceec81 100644
--- a/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
+++ b/openmeetings-web/src/test/java/org/apache/openmeetings/test/webservice/TestCalendarService.java
@@ -90,9 +90,9 @@ public class TestCalendarService extends AbstractWebServiceTest {
 		actualTest(roomDao.get(5L)); //default public restricted room
 	}
 
-	private static JSONObject createAppointment() {
+	private static JSONObject createAppointment(String title) {
 		return new JSONObject()
-			.put("title", "test")
+			.put("title", title)
 			.put("start", "2025-01-20T20:30:03+0300")
 			.put("end", "2025-01-20T21:30:03+0300")
 			.put("description", "Русский Тест")
@@ -136,9 +136,8 @@ public class TestCalendarService extends AbstractWebServiceTest {
 		return sr.getMessage();
 	}
 
-	@Test
-	public void testCreate() throws Exception {
-		JSONObject o = createAppointment();
+	private String createApp(String title) throws Exception {
+		JSONObject o = createAppointment(title);
 
 		String sid = loginNewUser();
 
@@ -152,6 +151,13 @@ public class TestCalendarService extends AbstractWebServiceTest {
 		AppointmentDTO dto = resp.readEntity(AppointmentDTO.class);
 		assertNotNull("Valid DTO should be returned", dto);
 		assertNotNull("DTO id should be valid", dto.getId());
+
+		return sid;
+	}
+
+	@Test
+	public void testCreate() throws Exception {
+		createApp("test");
 	}
 
 	@Test
@@ -167,7 +173,7 @@ public class TestCalendarService extends AbstractWebServiceTest {
 
 	@Test
 	public void testCreateWithOmMm() throws Exception {
-		JSONObject o = createAppointment()
+		JSONObject o = createAppointment("test")
 				.put("meetingMembers", new JSONArray()
 						.put(new JSONObject().put("user", new JSONObject()
 								.put("id", 1))));
@@ -191,7 +197,7 @@ public class TestCalendarService extends AbstractWebServiceTest {
 	}
 
 	private static AppointmentDTO createEventWithGuests(String sid) throws Exception {
-		JSONObject o = createAppointment()
+		JSONObject o = createAppointment("test")
 				.put("meetingMembers", new JSONArray()
 						.put(new JSONObject().put("user", new JSONObject()
 								.put("firstname", "John 1")
@@ -277,4 +283,26 @@ public class TestCalendarService extends AbstractWebServiceTest {
 		assertNotNull("Meeting member user should not be deleted", uc);
 		assertFalse("Meeting member user should not be deleted", uc.isDeleted());
 	}
+
+	@Test
+	public void testGetByTitle() throws Exception {
+		String title = "title" + UUID.randomUUID().toString();
+		String sid = createApp(title);
+		@SuppressWarnings("unchecked")
+		List<AppointmentDTO> list = (List<AppointmentDTO>)getClient(CALENDAR_SERVICE_URL)
+			.path(String.format("/title/%s", title))
+			.query("sid", sid)
+			.getCollection(AppointmentDTO.class);
+
+		assertEquals("List of one item should be returned", 1, list.size());
+		assertEquals("Title should match", title, list.get(0).getTitle());
+
+		title = UUID.randomUUID().toString();
+		@SuppressWarnings("unchecked")
+		List<AppointmentDTO> list1 = (List<AppointmentDTO>)getClient(CALENDAR_SERVICE_URL)
+			.path(String.format("/title/%s", title))
+			.query("sid", sid)
+			.getCollection(AppointmentDTO.class);
+		assertEquals("None items should be returned", 0, list1.size());
+	}
 }