Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: e967d2ca05
...
compare: 4d89fcdac6
  • 2 commits
  • 20 files changed
  • 0 commit comments
  • 1 contributor
Showing with 191 additions and 151 deletions.
  1. +0 −46 src/main/java/com/thistech/spotlink/engine/AbstractCachingTrackingEngine.java
  2. +7 −6 src/main/java/com/thistech/spotlink/engine/AbstractPlacementDecisionEngine.java
  3. +7 −3 src/main/java/com/thistech/spotlink/engine/HttpTrackingEngine.java
  4. +0 −6 src/main/java/com/thistech/spotlink/engine/TrackingEngine.java
  5. +1 −1  src/main/java/com/thistech/spotlink/model/Ad.java
  6. +57 −0 src/main/java/com/thistech/spotlink/model/BasicTrackingEvents.java
  7. +5 −5 src/main/java/com/thistech/spotlink/model/RequestContext.java
  8. +15 −28 src/main/java/com/thistech/spotlink/model/TrackingEvents.java
  9. +16 −18 src/main/java/com/thistech/spotlink/persistence/{ITrackingEventsDao.java → CachingTrackingEventsDao.java}
  10. +18 −15 src/main/java/com/thistech/spotlink/persistence/TrackingEventsDao.java
  11. +44 −0 src/main/java/com/thistech/spotlink/persistence/TrackingEventsDaoFactory.java
  12. +1 −0  src/main/resources/spotlink-defaults.properties
  13. +5 −1 src/main/resources/spotlink/spotlink.xml
  14. +0 −5 src/test/java/com/thistech/spotlink/AbstractSpotlinkTest.java
  15. +3 −2 src/test/java/com/thistech/spotlink/TestHelper.java
  16. +2 −6 src/test/java/com/thistech/spotlink/engine/PlacementDecisionEngineTest.java
  17. +4 −4 src/test/java/com/thistech/spotlink/engine/TrackingEngineTest.java
  18. +4 −3 ...ava/com/thistech/spotlink/persistence/{TrackingEventsDaoTest.java → CachingTrackingEventsDaoTest.java}
  19. +1 −1  ...ch/spotlink/persistence/{TrackingEventsDaoTest-context.xml → CachingTrackingEventsDaoTest-context.xml}
  20. +1 −1  src/test/resources/ehcache.xml
View
46 src/main/java/com/thistech/spotlink/engine/AbstractCachingTrackingEngine.java
@@ -1,46 +0,0 @@
-/*
- * The contents of this file are subject to the SpotLink Public License,
- * version 1.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.thistech.com/spotlink/spl.
- *
- * Software distributed under the License is distributed on an “AS IS”
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is SpotLink Server Code, release date February 14, 2011
- * The Initial Developer of the Original Code is This Technology, LLC.
- * Copyright (C) 2010-2011, This Technology, LLC
- * All Rights Reserved.
- */
-
-package com.thistech.spotlink.engine;
-
-import com.thistech.spotlink.model.TrackingEvents;
-import com.thistech.spotlink.persistence.ITrackingEventsDao;
-import org.apache.commons.lang.StringUtils;
-
-import javax.annotation.Resource;
-import java.io.Serializable;
-import java.util.Properties;
-
-public abstract class AbstractCachingTrackingEngine implements TrackingEngine {
- @Resource(name = "com.thistech.spotlink.TrackingEventsDao")
- protected ITrackingEventsDao trackingEventsDao;
- protected Properties properties = null;
-
- public AbstractCachingTrackingEngine(Properties properties) {
- this.properties = properties;
- }
-
- @Override
- public void saveTrackingEvents(Serializable trackingEvents) {
- trackingEventsDao.save((TrackingEvents) trackingEvents);
- }
-
- @Override
- public TrackingEvents getTrackingEvents(String trackingId) {
- return this.trackingEventsDao.get(StringUtils.upperCase(trackingId));
- }
-}
View
13 src/main/java/com/thistech/spotlink/engine/AbstractPlacementDecisionEngine.java
@@ -22,8 +22,9 @@
import com.thistech.schemasupport.scte130.builder.core.ContentBuilder;
import com.thistech.spotlink.SpotLinkException;
import com.thistech.spotlink.model.Ad;
-import com.thistech.spotlink.model.MediaFile;
import com.thistech.spotlink.model.TrackingEvents;
+import com.thistech.spotlink.model.MediaFile;
+import com.thistech.spotlink.persistence.TrackingEventsDao;
import com.thistech.spotlink.util.ListUtil;
import com.thistech.spotlink.util.XmlUtil;
import org.apache.commons.lang.StringUtils;
@@ -50,8 +51,8 @@
public abstract class AbstractPlacementDecisionEngine implements PlacementDecisionEngine {
private static final Logger log = LoggerFactory.getLogger(AbstractPlacementDecisionEngine.class);
- @Resource(name = "trackingEngine")
- protected TrackingEngine trackingEngine = null;
+ @Resource(name = "trackingEventsDao")
+ protected TrackingEventsDao trackingEventsDao = null;
@Resource(name = "com.thistech.spotlink.JAXBContext")
private JAXBContext jaxbContext;
protected Properties properties;
@@ -193,11 +194,11 @@ protected PlacementDecisionType fillPlacementOpportunity(PlacementRequestType pl
}
/**
- * Save a TrackingEvents
- * @param trackingEvents The TrackingEvents
+ * Save a BasicTrackingEvents
+ * @param trackingEvents The BasicTrackingEvents
*/
protected void saveTrackingEvents(TrackingEvents trackingEvents) {
- this.trackingEngine.saveTrackingEvents(trackingEvents);
+ this.trackingEventsDao.save(trackingEvents);
}
protected JAXBContext getJaxbContext() {
View
10 src/main/java/com/thistech/spotlink/engine/HttpTrackingEngine.java
@@ -18,6 +18,7 @@
package com.thistech.spotlink.engine;
import com.thistech.spotlink.model.TrackingEvents;
+import com.thistech.spotlink.persistence.TrackingEventsDao;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -34,14 +35,17 @@
import java.util.Properties;
import java.util.UUID;
-public final class HttpTrackingEngine extends AbstractCachingTrackingEngine implements TrackingEngine {
+public class HttpTrackingEngine implements TrackingEngine {
private static final Logger log = LoggerFactory.getLogger(HttpTrackingEngine.class);
+ @Resource(name = "trackingEventsDao")
+ protected TrackingEventsDao trackingEventsDao = null;
@Resource(name = "com.thistech.spotlink.HttpClient")
protected HttpClient httpClient = null;
+ protected Properties properties = null;
public HttpTrackingEngine(Properties properties) {
- super(properties);
+ this.properties = properties;
}
@Override
@@ -64,7 +68,7 @@ private void trackEvent(PlacementStatusEventType event) {
String trackingId = event.getSpot().getContent().getTracking().getValue();
String eventType = event.getType();
- TrackingEvents tracking = this.getTrackingEvents(trackingId);
+ TrackingEvents tracking = this.trackingEventsDao.get(trackingId);
if (tracking == null) {
log.error(String.format("No Tracking data for %s", trackingId));
return;
View
6 src/main/java/com/thistech/spotlink/engine/TrackingEngine.java
@@ -19,13 +19,7 @@
import org.scte.schemas._130_3._2008a.adm.PlacementStatusNotificationType;
-import java.io.Serializable;
-
public interface TrackingEngine {
String track(PlacementStatusNotificationType psn);
-
- void saveTrackingEvents(Serializable trackingEvents);
-
- Serializable getTrackingEvents(String trackingId);
}
View
2  src/main/java/com/thistech/spotlink/model/Ad.java
@@ -33,7 +33,7 @@
public Ad setMediaFiles(List<MediaFile> value) { this.mediaFiles = value; return this; }
public TrackingEvents getTrackingEvents() {
- if (trackingEvents == null) { trackingEvents = new TrackingEvents(); }
+ if (trackingEvents == null) { trackingEvents = new BasicTrackingEvents(); }
return trackingEvents;
}
public Ad setTrackingEvents(TrackingEvents value) { this.trackingEvents = value; return this; }
View
57 src/main/java/com/thistech/spotlink/model/BasicTrackingEvents.java
@@ -0,0 +1,57 @@
+package com.thistech.spotlink.model;
+
+/*
+ * “The contents of this file are subject to the SpotLink Public License,
+ * version 1.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.thistech.com/spotlink/spl.
+ *
+ * Software distributed under the License is distributed on an “AS IS”
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is SpotLink Server Code, release date February 14, 2011
+ * The Initial Developer of the Original Code is This Technology, LLC.
+ * Copyright (C) 2010-2011, This Technology, LLC
+ * All Rights Reserved.
+ */
+
+import java.util.*;
+import org.apache.commons.lang.StringUtils;
+
+public class BasicTrackingEvents implements TrackingEvents {
+
+ private String id;
+ private Map<String, String> eventUrls;
+
+ public BasicTrackingEvents() {
+ setId(UUID.randomUUID().toString());
+ }
+
+ @Override
+ public String getId() { return id; }
+ @Override
+ public TrackingEvents setId(String value) { this.id = value; return this; }
+
+ @Override
+ public Map<String, String> getEventUrls() {
+ if (eventUrls == null) { eventUrls = new HashMap<String, String>(); }
+ return eventUrls;
+ }
+ @Override
+ public TrackingEvents setEventUrls(Map<String, String> value) { this.eventUrls = value; return this; }
+
+ @Override
+ public TrackingEvents addEventUrl(String event, String url) {
+ if (StringUtils.isNotBlank(event) && StringUtils.isNotBlank(url)) {
+ getEventUrls().put(StringUtils.lowerCase(event), StringUtils.trim(url));
+ }
+ return this;
+ }
+
+ @Override
+ public String getEventUrl(String event) {
+ return getEventUrls().get(StringUtils.lowerCase(event));
+ }
+}
View
10 src/main/java/com/thistech/spotlink/model/RequestContext.java
@@ -64,15 +64,15 @@
Map<String, Object> getAttributes();
/**
- * Adds a populated {@link TrackingEvents} object to the {@code RequestContext} implementation.
+ * Adds a populated {@link BasicTrackingEvents} object to the {@code RequestContext} implementation.
*
- * @param trackingEvents - The populated {@link TrackingEvents}
+ * @param trackingEvents - The populated {@link BasicTrackingEvents}
* @return - This {@code RequestContext} implementation.
*/
RequestContext addTrackingData(TrackingEvents trackingEvents);
/**
- * @return - The assigned {@link List} of {@link TrackingEvents}.
+ * @return - The assigned {@link List} of {@link BasicTrackingEvents}.
*/
List<TrackingEvents> getTrackingData();
@@ -85,9 +85,9 @@
RequestContext setAttributes(Map<String, Object> attributes);
/**
- * Allows for overriding of the entire {@link TrackingEvents} List.
+ * Allows for overriding of the entire {@link BasicTrackingEvents} List.
*
- * @param trackingData - List of {@link TrackingEvents} to replace.
+ * @param trackingData - List of {@link BasicTrackingEvents} to replace.
* @return - This {@code RequestContext} implementation.
*/
RequestContext setTrackingData(List<TrackingEvents> trackingData);
View
43 src/main/java/com/thistech/spotlink/model/TrackingEvents.java
@@ -1,7 +1,5 @@
-package com.thistech.spotlink.model;
-
/*
- * The contents of this file are subject to the SpotLink Public License,
+ * The contents of this file are subject to the SpotLink Public License,
* version 1.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.thistech.com/spotlink/spl.
@@ -17,36 +15,25 @@
* All Rights Reserved.
*/
-import java.io.Serializable;
-import java.util.*;
-import org.apache.commons.lang.StringUtils;
+package com.thistech.spotlink.model;
-public class TrackingEvents implements Serializable {
+import java.io.Serializable;
+import java.util.Map;
- private String id;
- private Map<String, String> eventUrls;
+/**
+ * @author <a href="mailto:matt@thistech.com">Matt Narrell</a>
+ * Created on: 5/12/11
+ */
+public interface TrackingEvents extends Serializable {
+ String getId();
- public TrackingEvents() {
- setId(UUID.randomUUID().toString());
- }
+ TrackingEvents setId(String value);
- public String getId() { return id; }
- public TrackingEvents setId(String value) { this.id = value; return this; }
+ Map<String, String> getEventUrls();
- public Map<String, String> getEventUrls() {
- if (eventUrls == null) { eventUrls = new HashMap<String, String>(); }
- return eventUrls;
- }
- public TrackingEvents setEventUrls(Map<String, String> value) { this.eventUrls = value; return this; }
+ TrackingEvents setEventUrls(Map<String, String> value);
- public TrackingEvents addEventUrl(String event, String url) {
- if (StringUtils.isNotBlank(event) && StringUtils.isNotBlank(url)) {
- getEventUrls().put(StringUtils.lowerCase(event), StringUtils.trim(url));
- }
- return this;
- }
+ TrackingEvents addEventUrl(String event, String url);
- public String getEventUrl(String event) {
- return getEventUrls().get(StringUtils.lowerCase(event));
- }
+ String getEventUrl(String event);
}
View
34 ...tlink/persistence/ITrackingEventsDao.java → ...persistence/CachingTrackingEventsDao.java
@@ -17,27 +17,25 @@
* All Rights Reserved.
*/
-import com.thistech.spotlink.model.TrackingEvents;
+import java.io.Serializable;
-public interface ITrackingEventsDao {
+import com.thistech.spotlink.model.TrackingEvents;
+import net.sf.ehcache.Element;
+import org.apache.commons.lang.StringUtils;
- /**
- * Delete a tracking event
- * @param tracking The TrackingEvent to delete
- */
- void delete(TrackingEvents tracking);
+public class CachingTrackingEventsDao extends AbstractCacheDao<TrackingEvents> implements TrackingEventsDao {
- /**
- * Get a TrackingEvent by id and type
- * @param id The id
- * @return the Tracking
- */
- TrackingEvents get(String id);
+ public CachingTrackingEventsDao() {
+ super("TrackingEvents");
+ }
- /**
- * Store a TrackingEvent.
- * @param tracking The TrackingEvent to store
- */
- void save(TrackingEvents tracking);
+ public TrackingEvents get(String id) {
+ Element element = getCache().get(id);
+ return element == null ? null : (TrackingEvents) element.getValue();
+ }
+ @Override
+ protected Serializable getKey(TrackingEvents object) {
+ return StringUtils.upperCase(object.getId());
+ }
}
View
33 src/main/java/com/thistech/spotlink/persistence/TrackingEventsDao.java
@@ -17,24 +17,27 @@
* All Rights Reserved.
*/
-import java.io.Serializable;
import com.thistech.spotlink.model.TrackingEvents;
-import net.sf.ehcache.Element;
-import org.apache.commons.lang.StringUtils;
-public class TrackingEventsDao extends AbstractCacheDao<TrackingEvents> implements ITrackingEventsDao {
+public interface TrackingEventsDao {
- public TrackingEventsDao() {
- super("TrackingEvents");
- }
+ /**
+ * Delete a tracking event
+ * @param tracking The TrackingEvent to delete
+ */
+ void delete(TrackingEvents tracking);
- public TrackingEvents get(String id) {
- Element element = getCache().get(id);
- return element == null ? null : (TrackingEvents) element.getValue();
- }
+ /**
+ * Get a TrackingEvent by id and type
+ * @param id The id
+ * @return the Tracking
+ */
+ TrackingEvents get(String id);
+
+ /**
+ * Store a TrackingEvent.
+ * @param tracking The TrackingEvent to store
+ */
+ void save(TrackingEvents tracking);
- @Override
- protected Serializable getKey(TrackingEvents object) {
- return StringUtils.upperCase(object.getId());
- }
}
View
44 src/main/java/com/thistech/spotlink/persistence/TrackingEventsDaoFactory.java
@@ -0,0 +1,44 @@
+/*
+ * The contents of this file are subject to the SpotLink Public License,
+ * version 1.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.thistech.com/spotlink/spl.
+ *
+ * Software distributed under the License is distributed on an “AS IS”
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is SpotLink Server Code, release date February 14, 2011
+ * The Initial Developer of the Original Code is This Technology, LLC.
+ * Copyright (C) 2010-2011, This Technology, LLC
+ * All Rights Reserved.
+ */
+
+package com.thistech.spotlink.persistence;
+
+import com.thistech.spotlink.SpotLinkException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="mailto:matt@thistech.com">Matt Narrell</a>
+ * Created on: 5/12/11
+ */
+public class TrackingEventsDaoFactory {
+ private static final Logger log = LoggerFactory.getLogger(TrackingEventsDaoFactory.class);
+ public TrackingEventsDao newInstance(Properties properties) {
+ String className = properties.getProperty("trackingEventsDao");
+ try {
+ @SuppressWarnings("unchecked")
+ Class<TrackingEventsDao> clazz = (Class<TrackingEventsDao>) Class.forName(className);
+ return clazz.newInstance();
+ }
+ catch (Exception e) {
+ log.error(String.format("Could not construct instance of %s", className));
+ throw new SpotLinkException(e);
+ }
+ }
+}
View
1  src/main/resources/spotlink-defaults.properties
@@ -43,6 +43,7 @@ ehcacheConfig=ehcache.xml
placementDecisionEngine=com.thistech.spotlink.engine.FreewheelPlacementDecisionEngine
placementDecisionEngineEndpoint=http://localhost/fw
trackingEngine=com.thistech.spotlink.engine.HttpTrackingEngine
+trackingEventsDao=com.thistech.spotlink.persistence.CachingTrackingEventsDao
# CXF service general configuration
cxf.service.timeout=1000
View
6 src/main/resources/spotlink/spotlink.xml
@@ -95,7 +95,11 @@
</property>
</bean>
- <bean id="com.thistech.spotlink.TrackingEventsDao" class="com.thistech.spotlink.persistence.TrackingEventsDao" lazy-init="true"/>
+ <bean id="trackingEventsDaoFactory" class="com.thistech.spotlink.persistence.TrackingEventsDaoFactory"/>
+
+ <bean id="trackingEventsDao" factory-bean="trackingEventsDaoFactory" factory-method="newInstance">
+ <constructor-arg type="java.util.Properties" ref="com.thistech.spotlink.Properties"/>
+ </bean>
<bean id="trackingEngineFactory" class="com.thistech.spotlink.engine.TrackingEngineFactory"/>
View
5 src/test/java/com/thistech/spotlink/AbstractSpotlinkTest.java
@@ -17,9 +17,6 @@
* All Rights Reserved.
*/
-import com.thistech.spotlink.model.Ad;
-import com.thistech.spotlink.model.MediaFile;
-import com.thistech.spotlink.model.TrackingEvents;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.entity.StringEntity;
@@ -36,8 +33,6 @@
import javax.xml.transform.stream.StreamSource;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
@ContextConfiguration
public class AbstractSpotlinkTest extends AbstractTestNGSpringContextTests {
View
5 src/test/java/com/thistech/spotlink/TestHelper.java
@@ -19,8 +19,9 @@
import com.thistech.schemasupport.scte130.builder.core.AssetRefBuilder;
import com.thistech.spotlink.model.Ad;
-import com.thistech.spotlink.model.MediaFile;
+import com.thistech.spotlink.model.BasicTrackingEvents;
import com.thistech.spotlink.model.TrackingEvents;
+import com.thistech.spotlink.model.MediaFile;
import org.scte.schemas._130_2._2008a.core.AssetRefType;
import org.scte.schemas._130_2._2008a.core.ContentType;
import org.scte.schemas._130_2._2008a.core.TrackingType;
@@ -47,7 +48,7 @@
}
public static TrackingEvents buildTrackingEvents() {
- TrackingEvents events = new TrackingEvents();
+ TrackingEvents events = new BasicTrackingEvents();
events.setId("be1bcf17-cc88-42fe-87d0-915edbec8b7d");
events.addEventUrl("endPlacement", "http://www.url.com/");
View
8 src/test/java/com/thistech/spotlink/engine/PlacementDecisionEngineTest.java
@@ -20,9 +20,9 @@
import com.thistech.schemasupport.scte130.util.ObjectFactoryProxy;
import com.thistech.spotlink.AbstractSpotlinkTest;
import com.thistech.spotlink.SpotLinkException;
-import com.thistech.spotlink.TestHelper;
import com.thistech.spotlink.model.BasicRequestContext;
import com.thistech.spotlink.model.RequestContext;
+import com.thistech.spotlink.persistence.TrackingEventsDao;
import org.apache.http.client.methods.HttpPost;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -48,7 +48,7 @@
@InjectMocks
private TestableDecisionEngine placementDecisionEngine = null;
@Mock
- private TrackingEngine mockTrackingService = null;
+ private TrackingEventsDao trackingEventsDao = null;
@Mock
private JAXBContext mockJaxbContext = null;
@Mock
@@ -64,10 +64,6 @@ public void setup() throws Exception {
@Test()
public void testGetPlacementDecisions() {
- for (int i = 0; i < TestHelper.COLLECTION_SIZE; i++) {
- this.mockTrackingService.saveTrackingEvents(null);
- }
-
PlacementRequestType placementRequest =
(PlacementRequestType) this.unmarshal(this.getClass(), "/sample_placement_request.xml");
RequestContext requestContext = new BasicRequestContext()
View
8 src/test/java/com/thistech/spotlink/engine/TrackingEngineTest.java
@@ -19,8 +19,8 @@
import com.thistech.spotlink.AbstractSpotlinkTest;
import com.thistech.spotlink.TestHelper;
-import com.thistech.spotlink.model.TrackingEvents;
-import com.thistech.spotlink.persistence.ITrackingEventsDao;
+import com.thistech.spotlink.model.BasicTrackingEvents;
+import com.thistech.spotlink.persistence.TrackingEventsDao;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpUriRequest;
@@ -41,7 +41,7 @@
@InjectMocks
private TrackingEngine trackingEngine = null;
@Mock
- private ITrackingEventsDao mockTrackingEventsDao = null;
+ private TrackingEventsDao mockTrackingEventsDao = null;
@Mock
private HttpClient mockHttpClient = mock(DefaultHttpClient.class, RETURNS_DEEP_STUBS);
@Mock
@@ -93,7 +93,7 @@ public void testTrackingUrlNotFound() throws Exception {
this.trackingEngine = new HttpTrackingEngine(this.properties);
initMocks(this);
- when(this.mockTrackingEventsDao.get(anyString())).thenReturn(new TrackingEvents());
+ when(this.mockTrackingEventsDao.get(anyString())).thenReturn(new BasicTrackingEvents());
when(this.mockHttpClient.execute(any(HttpUriRequest.class)))
.thenReturn(this.prepareResponse(HttpStatus.SC_BAD_REQUEST, "BadRequest"));
View
7 ...nk/persistence/TrackingEventsDaoTest.java → ...istence/CachingTrackingEventsDaoTest.java
@@ -18,6 +18,7 @@
*/
import com.thistech.spotlink.model.TrackingEvents;
+import com.thistech.spotlink.model.BasicTrackingEvents;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
@@ -26,10 +27,10 @@
import org.testng.annotations.Test;
@ContextConfiguration
-public class TrackingEventsDaoTest extends AbstractTestNGSpringContextTests {
+public class CachingTrackingEventsDaoTest extends AbstractTestNGSpringContextTests {
@Autowired @Qualifier("com.thistech.spotlink.TrackingEventsDao")
- private TrackingEventsDao trackingEventsDao = null;
+ private CachingTrackingEventsDao trackingEventsDao = null;
@Test
public void testSave() {
@@ -69,7 +70,7 @@ public void testDelete() {
}
private TrackingEvents getTrackingEvents() {
- TrackingEvents events = new TrackingEvents();
+ TrackingEvents events = new BasicTrackingEvents();
events.setId(String.format("RandomTrackingEvents_%s", System.currentTimeMillis()));
for (int i = 0; i < 2; i++) {
View
2  ...istence/TrackingEventsDaoTest-context.xml → .../CachingTrackingEventsDaoTest-context.xml
@@ -24,6 +24,6 @@
<property name="configLocation" value="classpath:ehcache.xml"/>
</bean>
- <bean id="com.thistech.spotlink.TrackingEventsDao" class="com.thistech.spotlink.persistence.TrackingEventsDao"/>
+ <bean id="com.thistech.spotlink.TrackingEventsDao" class="com.thistech.spotlink.persistence.CachingTrackingEventsDao"/>
</beans>
View
2  src/test/resources/ehcache.xml
@@ -25,7 +25,7 @@
overflowToDisk="true">
</defaultCache>
- <!-- TrackingEvents expire after 48 hours -->
+ <!-- BasicTrackingEvents expire after 48 hours -->
<cache name="TrackingEvents"
maxElementsInMemory="1000000"
eternal="false"

No commit comments for this range

Something went wrong with that request. Please try again.