Commit 27c0217d authored by Peter Harrison's avatar Peter Harrison

#38 Cache List Invalidation issue resolved - invalidation of lists had a

bug,found while getting unit tests working again.
parent 26d299fc
...@@ -32,6 +32,7 @@ import nz.net.orcon.kanban.automation.CacheInvalidationInterface; ...@@ -32,6 +32,7 @@ import nz.net.orcon.kanban.automation.CacheInvalidationInterface;
import nz.net.orcon.kanban.model.Card; import nz.net.orcon.kanban.model.Card;
import nz.net.orcon.kanban.model.Condition; import nz.net.orcon.kanban.model.Condition;
import nz.net.orcon.kanban.model.Filter; import nz.net.orcon.kanban.model.Filter;
import nz.net.orcon.kanban.tools.CardTools;
import nz.net.orcon.kanban.tools.IdentifierTools; import nz.net.orcon.kanban.tools.IdentifierTools;
import nz.net.orcon.kanban.tools.ListTools; import nz.net.orcon.kanban.tools.ListTools;
import nz.net.orcon.kanban.tools.OcmMapperFactory; import nz.net.orcon.kanban.tools.OcmMapperFactory;
...@@ -66,6 +67,9 @@ public class FilterController { ...@@ -66,6 +67,9 @@ public class FilterController {
@Autowired @Autowired
private ListTools listTools; private ListTools listTools;
@Autowired
CardTools cardTools;
@PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')") @PreAuthorize("hasPermission(#boardId, 'BOARD', 'ADMIN')")
@RequestMapping(value = "", method=RequestMethod.POST) @RequestMapping(value = "", method=RequestMethod.POST)
...@@ -191,6 +195,10 @@ public class FilterController { ...@@ -191,6 +195,10 @@ public class FilterController {
try { try {
cards = listTools.query(boardId, null, filterId, ocm); cards = listTools.query(boardId, null, filterId, ocm);
for(Card card : cards){
card.setFields(this.cardTools.getFieldsForCard(card,"full",ocm));
}
} finally { } finally {
ocm.logout(); ocm.logout();
} }
......
...@@ -150,6 +150,6 @@ ...@@ -150,6 +150,6 @@
<bean id="awsAutomationAction" class="nz.net.orcon.kanban.automation.actions.AwsAutomationAction"/> <bean id="awsAutomationAction" class="nz.net.orcon.kanban.automation.actions.AwsAutomationAction"/>
<!-- Cluster Management --> <!-- Cluster Management -->
<bean id="clusterManager" class="nz.net.orcon.kanban.automation.ClusterManager"/> <bean id="clusterManager" class="nz.net.orcon.kanban.automation.ClusterManagerImpl"/>
</beans> </beans>
...@@ -27,11 +27,7 @@ import static org.junit.Assert.assertNotNull; ...@@ -27,11 +27,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -41,10 +37,6 @@ import nz.net.orcon.kanban.model.Card; ...@@ -41,10 +37,6 @@ import nz.net.orcon.kanban.model.Card;
import nz.net.orcon.kanban.model.CardEvent; import nz.net.orcon.kanban.model.CardEvent;
import nz.net.orcon.kanban.model.CardTask; import nz.net.orcon.kanban.model.CardTask;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.ObjectWriter;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -144,6 +136,9 @@ public class CardControllerTest { ...@@ -144,6 +136,9 @@ public class CardControllerTest {
assertEquals("Create Test",foundCard.getFields().get("name")); assertEquals("Create Test",foundCard.getFields().get("name"));
Object balance = foundCard.getFields().get("balance"); Object balance = foundCard.getFields().get("balance");
System.out.println( "Balance Class:" + balance.getClass().getName());
assertEquals("300.0", balance.toString()); assertEquals("300.0", balance.toString());
controller.deleteCard(TestBoardTool.BOARD_ID, controller.deleteCard(TestBoardTool.BOARD_ID,
...@@ -160,6 +155,8 @@ public class CardControllerTest { ...@@ -160,6 +155,8 @@ public class CardControllerTest {
} }
} }
@Test @Test
public void testUpdateField() throws Exception { public void testUpdateField() throws Exception {
...@@ -191,7 +188,7 @@ public class CardControllerTest { ...@@ -191,7 +188,7 @@ public class CardControllerTest {
String cardId = cardList.keySet().iterator().next(); String cardId = cardList.keySet().iterator().next();
Card card = controller.getCard(TestBoardTool.BOARD_ID, TestBoardTool.PHASE_ID, cardId, null); Card card = controller.getCard(TestBoardTool.BOARD_ID, TestBoardTool.PHASE_ID, cardId, null);
return card; return card;
} }
@Test @Test
public void testGetHistoryList() throws Exception { public void testGetHistoryList() throws Exception {
......
...@@ -64,7 +64,6 @@ public class FilterControllerTest { ...@@ -64,7 +64,6 @@ public class FilterControllerTest {
@Test @Test
public void testCreateUpdateAndDeleteFilter() throws Exception { public void testCreateUpdateAndDeleteFilter() throws Exception {
Filter filter = getTestFilter("Test Filter "+ BoardControllerTest.RND.nextInt(9999999), "name", Operation.EQUALTO, "Smith"); Filter filter = getTestFilter("Test Filter "+ BoardControllerTest.RND.nextInt(9999999), "name", Operation.EQUALTO, "Smith");
Filter newFilter = controller.createFilter(TestBoardTool.BOARD_ID, filter); Filter newFilter = controller.createFilter(TestBoardTool.BOARD_ID, filter);
String filterId = TestBoardTool.getIdFromPath(newFilter.getPath()); String filterId = TestBoardTool.getIdFromPath(newFilter.getPath());
...@@ -88,7 +87,6 @@ public class FilterControllerTest { ...@@ -88,7 +87,6 @@ public class FilterControllerTest {
@Test @Test
public void testEquals() throws Exception { public void testEquals() throws Exception {
Collection<Card> cards = controller.executeFilter(TestBoardTool.BOARD_ID, "equalsfilter"); Collection<Card> cards = controller.executeFilter(TestBoardTool.BOARD_ID, "equalsfilter");
assertNotNull(cards); assertNotNull(cards);
assertEquals(1,cards.size()); assertEquals(1,cards.size());
...@@ -176,9 +174,7 @@ public class FilterControllerTest { ...@@ -176,9 +174,7 @@ public class FilterControllerTest {
} }
private void checkTestFilters() throws Exception{ private void checkTestFilters() throws Exception{
Map<String, String> listFilters = controller.listFilters(TestBoardTool.BOARD_ID); Map<String, String> listFilters = controller.listFilters(TestBoardTool.BOARD_ID);
Collection<Filter> f = new ArrayList<Filter>(); Collection<Filter> f = new ArrayList<Filter>();
f.add(getTestFilter( "containsfilter", "name", Operation.CONTAINS, "Smi" )); f.add(getTestFilter( "containsfilter", "name", Operation.CONTAINS, "Smi" ));
f.add(getTestFilter( "equalsfilter", "name", Operation.EQUALTO, "Smith" )); f.add(getTestFilter( "equalsfilter", "name", Operation.EQUALTO, "Smith" ));
......
...@@ -33,7 +33,7 @@ import org.springframework.test.context.ContextConfiguration; ...@@ -33,7 +33,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring/test-automation.xml"}) @ContextConfiguration(locations = { "/spring/test-automation.xml"})
public class DateInterpreterTest { public class DateInterpreterTest {
@Autowired @Autowired
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:jms="http://www.springframework.org/schema/jms" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jms="http://www.springframework.org/schema/jms"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx
...@@ -16,7 +19,7 @@ ...@@ -16,7 +19,7 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"> http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="kanbanConfiguration" <!-- <bean id="kanbanConfiguration"
class="org.springframework.beans.factory.config.PropertiesFactoryBean"> class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="file:///etc/kanban.conf" /> <property name="location" value="file:///etc/kanban.conf" />
</bean> </bean>
...@@ -24,6 +27,7 @@ ...@@ -24,6 +27,7 @@
<tx:annotation-driven /> <tx:annotation-driven />
<context:property-placeholder properties-ref="kanbanConfiguration"/> <context:property-placeholder properties-ref="kanbanConfiguration"/>
-->
<bean id="variableInterpreter" class="nz.net.orcon.kanban.automation.VariableInterpreter"/> <bean id="variableInterpreter" class="nz.net.orcon.kanban.automation.VariableInterpreter"/>
...@@ -41,8 +45,9 @@ ...@@ -41,8 +45,9 @@
</property> </property>
</bean> </bean>
<!--
<bean id="emailSenderAction" class="nz.net.orcon.kanban.automation.actions.EmailSenderAction" /> <bean id="emailSenderAction" class="nz.net.orcon.kanban.automation.actions.EmailSenderAction" />
<bean id="emailReceiverAction" class="nz.net.orcon.kanban.automation.actions.EmailReceiverAction" /> <bean id="emailReceiverAction" class="nz.net.orcon.kanban.automation.actions.EmailReceiverAction" />
-->
</beans> </beans>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment