// Path: spring-data-plain-demo/src/main/java/org/springframework/data/demo/data/DeviceInfo.java
// @Entity
// @org.springframework.data.mongodb.core.mapping.Document
// @Data
// public class DeviceInfo {
//     @NotNull
//     @Indexed(unique = true)
//     @Column(unique = true)
//     private String deviceId;
//     private String deviceName;
//     @Id
//     @com.couchbase.client.java.repository.annotation.Id
//     @GeneratedValue(generator = "system-uuid")
//     @GenericGenerator(name = "system-uuid", strategy = "uuid2")
//     private String id;
// }
// 
// Path: spring-data-couchbase-demo/src/main/java/org/springframework/data/demo/data/LocationUpdate.java
// @Document
// @Data
// @EqualsAndHashCode(of = {"locTime", "device"})
// public class LocationUpdate {
// 	@Id
// 	@GeneratedValue(strategy = GenerationStrategy.UNIQUE)
// 	private String id;
// 
// 	@Field
// 	@NotNull
// 	private DeviceInfo device;
// 
// 	@Field
// 	private double latX;
// 
// 	@Field
// 	private double latY;
// 
// 	@Field
// 	private String locDetail;
// 
// 	@NotNull
// 	@Field
// 	private Date locTime;
// }
// 
// Path: spring-data-plain-demo/src/main/java/org/springframework/data/demo/service/LocationAndDeviceService.java
// public interface LocationAndDeviceService {
//     void deleteAllData();
// 
//     DeviceInfo findDevice(String deviceId);
// 
//     List<LocationUpdate> findLocations(String deviceId, Date startDate, Date endDate);
// 
//     void saveDevice(@Valid DeviceInfo device);
// 
//     void saveLocation(@Valid LocationUpdate locationUpdate);
// }
// 
// Path: spring-data-plain-demo/src/test/java/org/springframework/data/demo/test/config/TestConfiguration.java
// @Configuration
// @Import({AppConfig.class, JpaHibernateConfig.class, MongoTestConfig.class})
// @ImportResource({"classpath:META-INF/spring/repo-populate.xml"})
// public class TestConfiguration {
//     @Autowired
//     protected Environment env;
// 
//     @PostConstruct
//     public void reportSpringProfile() {
//         for (String profile : env.getActiveProfiles()) {
//             System.out.println("==== Active Profile:" + profile + " ====");
//         }
//     }
// }


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.data.demo.data.DeviceInfo;
import org.springframework.data.demo.data.LocationUpdate;
import org.springframework.data.demo.service.LocationAndDeviceService;
import org.springframework.data.demo.test.config.TestConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
import java.util.Random;
import static org.junit.Assert.*;
import static org.springframework.data.mongodb.core.query.Criteria.where;
import static org.springframework.data.mongodb.core.query.Query.query;
package org.springframework.data.demo.test;




/**
 * @author Corneil du Plessis
 */
@Configurable
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestConfiguration.class})
public class LocationUpdateTest {
    private static Logger logger = LoggerFactory.getLogger("tests");
    @Autowired
    protected ApplicationContext applicationContext;
    @Autowired
    protected Environment environment;
    @Autowired
    protected LocationAndDeviceService locationAndDeviceService;

    @Before
    public void setup() {
        locationAndDeviceService.deleteAllData();
    }

// Path: spring-data-plain-demo/src/main/java/org/springframework/data/demo/data/DeviceInfo.java
// @Entity
// @org.springframework.data.mongodb.core.mapping.Document
// @Data
// public class DeviceInfo {
//     @NotNull
//     @Indexed(unique = true)
//     @Column(unique = true)
//     private String deviceId;
//     private String deviceName;
//     @Id
//     @com.couchbase.client.java.repository.annotation.Id
//     @GeneratedValue(generator = "system-uuid")
//     @GenericGenerator(name = "system-uuid", strategy = "uuid2")
//     private String id;
// }
// 
// Path: spring-data-couchbase-demo/src/main/java/org/springframework/data/demo/data/LocationUpdate.java
// @Document
// @Data
// @EqualsAndHashCode(of = {"locTime", "device"})
// public class LocationUpdate {
// 	@Id
// 	@GeneratedValue(strategy = GenerationStrategy.UNIQUE)
// 	private String id;
// 
// 	@Field
// 	@NotNull
// 	private DeviceInfo device;
// 
// 	@Field
// 	private double latX;
// 
// 	@Field
// 	private double latY;
// 
// 	@Field
// 	private String locDetail;
// 
// 	@NotNull
// 	@Field
// 	private Date locTime;
// }
// 
// Path: spring-data-plain-demo/src/main/java/org/springframework/data/demo/service/LocationAndDeviceService.java
// public interface LocationAndDeviceService {
//     void deleteAllData();
// 
//     DeviceInfo findDevice(String deviceId);
// 
//     List<LocationUpdate> findLocations(String deviceId, Date startDate, Date endDate);
// 
//     void saveDevice(@Valid DeviceInfo device);
// 
//     void saveLocation(@Valid LocationUpdate locationUpdate);
// }
// 
// Path: spring-data-plain-demo/src/test/java/org/springframework/data/demo/test/config/TestConfiguration.java
// @Configuration
// @Import({AppConfig.class, JpaHibernateConfig.class, MongoTestConfig.class})
// @ImportResource({"classpath:META-INF/spring/repo-populate.xml"})
// public class TestConfiguration {
//     @Autowired
//     protected Environment env;
// 
//     @PostConstruct
//     public void reportSpringProfile() {
//         for (String profile : env.getActiveProfiles()) {
//             System.out.println("==== Active Profile:" + profile + " ====");
//         }
//     }
// }


// Path: spring-data-plain-demo/src/test/java/org/springframework/data/demo/test/LocationUpdateTest.java
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.data.demo.data.DeviceInfo;
import org.springframework.data.demo.data.LocationUpdate;
import org.springframework.data.demo.service.LocationAndDeviceService;
import org.springframework.data.demo.test.config.TestConfiguration;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.Date;
import java.util.List;
import java.util.Random;
import static org.junit.Assert.*;
import static org.springframework.data.mongodb.core.query.Criteria.where;
import static org.springframework.data.mongodb.core.query.Query.query;

package org.springframework.data.demo.test;




/**
 * @author Corneil du Plessis
 */
@Configurable
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {TestConfiguration.class})
public class LocationUpdateTest {
    private static Logger logger = LoggerFactory.getLogger("tests");
    @Autowired
    protected ApplicationContext applicationContext;
    @Autowired
    protected Environment environment;
    @Autowired
    protected LocationAndDeviceService locationAndDeviceService;

    @Before
    public void setup() {
        locationAndDeviceService.deleteAllData();
    }

    @Test