1
1
package org .openmrs .module .atomfeed ;
2
2
3
+ import static org .hamcrest .core .Is .is ;
4
+ import static org .junit .Assert .assertThat ;
3
5
import static org .mockito .Mockito .mock ;
4
6
import static org .mockito .Mockito .when ;
5
7
30
32
import liquibase .exception .LiquibaseException ;
31
33
import liquibase .resource .ClassLoaderResourceAccessor ;
32
34
33
- public class SpikeTest extends BaseModuleWebContextSensitiveTest {
35
+ public class IntegrationTest extends BaseModuleWebContextSensitiveTest {
34
36
35
37
@ Autowired
36
38
EncounterService encounterService ;
@@ -41,21 +43,6 @@ public class SpikeTest extends BaseModuleWebContextSensitiveTest {
41
43
@ Autowired
42
44
AtomFeedController atomFeedController ;
43
45
44
- // @Before
45
- // public void setUp() throws Exception {
46
- // Connection connection = getConnection();
47
- // Database liqubaseConnection = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(
48
- // new JdbcConnection(connection));
49
- // liqubaseConnection.setDatabaseChangeLogTableName("LIQUIBASECHANGELOG");
50
- // liqubaseConnection.setDatabaseChangeLogLockTableName("LIQUIBASECHANGELOGLOCK");
51
- //
52
- // Liquibase liquibase = new Liquibase("liquibase.xml", new ClassLoaderResourceAccessor(getClass()
53
- // .getClassLoader()), liqubaseConnection);
54
- // liquibase.update(null);
55
- //
56
- // connection.commit();
57
- // }
58
-
59
46
@ Before
60
47
public void setUp () throws Exception {
61
48
Context .getAdministrationService ().executeSQL ("CREATE TABLE event_records_offset_marker (\n "
@@ -108,6 +95,9 @@ public void setUp() throws Exception {
108
95
109
96
@ Test
110
97
public void testEverything () throws Exception {
98
+ List <List <Object >> rows = Context .getAdministrationService ().executeSQL ("select * from event_records_queue" , true );
99
+ assertThat (rows .size (), is (0 ));
100
+
111
101
Encounter encounter = encounterService .getEncounter (5 );
112
102
encounter .setEncounterDatetime (new Date ());
113
103
encounterService .saveEncounter (encounter );
@@ -121,19 +111,8 @@ public void testEverything() throws Exception {
121
111
HttpServletRequest request = mock (HttpServletRequest .class );
122
112
when (request .getRequestURL ()).thenReturn (url );
123
113
124
- List <List <Object >> rows = Context .getAdministrationService ().executeSQL ("select * from event_records_queue" , true );
125
- for (List <Object > row : rows ) {
126
- for (Object o : row ) {
127
- System .out .print (o );
128
- System .out .print ("\t " );
129
- }
130
-
131
- System .out .println ("" );
132
- }
133
-
134
- // String feed = atomFeedController.getRecentEventFeedForCategory(request, "Patient");
135
- // System.out.println("Feed:");
136
- // System.out.println(feed);
114
+ rows = Context .getAdministrationService ().executeSQL ("select * from event_records_queue" , true );
115
+ assertThat (rows .size (), is (2 ));
137
116
}
138
117
139
118
}
0 commit comments