Skip to content

Commit

Permalink
Updated test mysql image to version 5.7.31, renamed WatcherContext to…
Browse files Browse the repository at this point in the history
… AppContext
  • Loading branch information
wluyima committed Nov 5, 2021
1 parent 6eaec94 commit 325d389
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.springframework.stereotype.Component;

@Component
public class WatcherContext implements ApplicationContextAware {
public class AppContext implements ApplicationContextAware {

private static ApplicationContext appContext;

Expand Down
2 changes: 1 addition & 1 deletion commons/src/main/java/org/openmrs/eip/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Utils {
* @return
*/
public static List<String> getWatchedTables() {
String watchedTables = WatcherContext.getBean(Environment.class).getProperty(Constants.PROP_WATCHED_TABLES);
String watchedTables = AppContext.getBean(Environment.class).getProperty(Constants.PROP_WATCHED_TABLES);
return Arrays.asList(watchedTables.split(","));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@Configuration
@EnableCaching
@org.springframework.context.annotation.PropertySource("application-common.properties")
@org.springframework.context.annotation.PropertySource("classpath:application-common.properties")
public class AppConfig {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Transactional
public abstract class BaseDbBackedCamelTest extends BaseCamelTest {

protected static MySQLContainer mysqlContainer = new MySQLContainer<>(parse("mysql:5.6"));
protected static MySQLContainer mysqlContainer = new MySQLContainer<>(parse("mysql:5.7.31"));

protected static Integer MYSQL_PORT;

Expand Down
6 changes: 3 additions & 3 deletions commons/src/test/java/org/openmrs/eip/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.core.env.Environment;

@RunWith(PowerMockRunner.class)
@PrepareForTest(WatcherContext.class)
@PrepareForTest(AppContext.class)
public class UtilsTest {

@Test
Expand Down Expand Up @@ -99,9 +99,9 @@ public void getTablesInHierarchy_shouldReturnCommaSeparatedListOfSubclassAndSupe

@Test
public void getWatchedTables_shouldReturnTheWatchedTableNames() {
PowerMockito.mockStatic(WatcherContext.class);
PowerMockito.mockStatic(AppContext.class);
Environment mockEnv = Mockito.mock(Environment.class);
Mockito.when(WatcherContext.getBean(Environment.class)).thenReturn(mockEnv);
Mockito.when(AppContext.getBean(Environment.class)).thenReturn(mockEnv);
Mockito.when(mockEnv.getProperty(Constants.PROP_WATCHED_TABLES)).thenReturn("person,patient,visit");
List<String> watchedTables = Utils.getWatchedTables();
assertEquals(3, watchedTables.size());
Expand Down

0 comments on commit 325d389

Please sign in to comment.