// Path: src/main/java/net/canadensys/dataportal/occurrence/model/OccurrenceExtensionModel.java
// @Entity
// @Table(name = "occurrence_extension")
// @TypeDefs( {@TypeDef( name= "KeyValueType", typeClass = KeyValueType.class)})
// public class OccurrenceExtensionModel {
// 	
// 	@Id
// 	private long auto_id;
// 	
// 	@NaturalId
// 	private String dwcaid;
// 	@NaturalId
// 	private String sourcefileid;
// 	@NaturalId
// 	private String resource_uuid;
// 	
// 	private String ext_type;
// 	private String ext_version;
// 	
// 	@Type(type="KeyValueType")
// 	private Map<String,String> ext_data;
// 		
// 	public long getAuto_id() {
// 		return auto_id;
// 	}
// 	public void setAuto_id(long auto_id) {
// 		this.auto_id = auto_id;
// 	}
// 	
// 	public String getDwcaid() {
// 		return dwcaid;
// 	}
// 	public void setDwcaid(String dwcaid) {
// 		this.dwcaid = dwcaid;
// 	}
// 	
// 	public String getSourcefileid() {
// 		return sourcefileid;
// 	}
// 	public void setSourcefileid(String sourcefileid) {
// 		this.sourcefileid = sourcefileid;
// 	}
// 	
// 	public String getResource_uuid() {
// 		return resource_uuid;
// 	}
// 	public void setResource_uuid(String resource_uuid) {
// 		this.resource_uuid = resource_uuid;
// 	}
// 	
// 	public String getExt_type() {
// 		return ext_type;
// 	}
// 	public void setExt_type(String ext_type) {
// 		this.ext_type = ext_type;
// 	}
// 	
// 	public String getExt_version() {
// 		return ext_version;
// 	}
// 	public void setExt_version(String ext_version) {
// 		this.ext_version = ext_version;
// 	}
// 	
// 	public Map<String,String> getExt_data() {
// 		return ext_data;
// 	}
// 	public void setExt_data(Map<String,String> ext_data) {
// 		this.ext_data = ext_data;
// 	}
// 
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.canadensys.dataportal.occurrence.model.OccurrenceExtensionModel;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
package net.canadensys.dataportal.occurrence.dao;





/**
 * This test is using a 'stub' hstore since hstore is PostgreSQL specific.
 * The trick to use it with h2 is available in src/test/resources/h2/h2setup.sql
 * Test Coverage : 
 * -Insert extension data using jdbcTemplate
 * -Save OccurrenceExtensionModel
 * -Load OccurrenceExtensionModel from id
 * -Load OccurrenceExtensionModel list from extensionType, resourceUUID, dwcaID
 * @author canadensys
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/test-spring.xml" })
@TransactionConfiguration(transactionManager = "hibernateTransactionManager")
public class OccurrenceExtensionDAOTest extends AbstractTransactionalJUnit4SpringContextTests {

	@Autowired
	private OccurrenceExtensionDAO occurrenceExtDAO;

	@Before
	public void setup() {
		// make sure the table is empty
		jdbcTemplate.update("DELETE FROM occurrence_extension");
		jdbcTemplate
				.update("INSERT INTO occurrence_extension (auto_id,dwcaid,sourcefileid,resource_uuid,ext_type,ext_data) VALUES (1,'1','source','1111-1111','image', toKeyValue('image_type=>png','author=>darwin','licence=>cc0'))");
	}

	@Test
	public void testSaveAndLoad() {

// Path: src/main/java/net/canadensys/dataportal/occurrence/model/OccurrenceExtensionModel.java
// @Entity
// @Table(name = "occurrence_extension")
// @TypeDefs( {@TypeDef( name= "KeyValueType", typeClass = KeyValueType.class)})
// public class OccurrenceExtensionModel {
// 	
// 	@Id
// 	private long auto_id;
// 	
// 	@NaturalId
// 	private String dwcaid;
// 	@NaturalId
// 	private String sourcefileid;
// 	@NaturalId
// 	private String resource_uuid;
// 	
// 	private String ext_type;
// 	private String ext_version;
// 	
// 	@Type(type="KeyValueType")
// 	private Map<String,String> ext_data;
// 		
// 	public long getAuto_id() {
// 		return auto_id;
// 	}
// 	public void setAuto_id(long auto_id) {
// 		this.auto_id = auto_id;
// 	}
// 	
// 	public String getDwcaid() {
// 		return dwcaid;
// 	}
// 	public void setDwcaid(String dwcaid) {
// 		this.dwcaid = dwcaid;
// 	}
// 	
// 	public String getSourcefileid() {
// 		return sourcefileid;
// 	}
// 	public void setSourcefileid(String sourcefileid) {
// 		this.sourcefileid = sourcefileid;
// 	}
// 	
// 	public String getResource_uuid() {
// 		return resource_uuid;
// 	}
// 	public void setResource_uuid(String resource_uuid) {
// 		this.resource_uuid = resource_uuid;
// 	}
// 	
// 	public String getExt_type() {
// 		return ext_type;
// 	}
// 	public void setExt_type(String ext_type) {
// 		this.ext_type = ext_type;
// 	}
// 	
// 	public String getExt_version() {
// 		return ext_version;
// 	}
// 	public void setExt_version(String ext_version) {
// 		this.ext_version = ext_version;
// 	}
// 	
// 	public Map<String,String> getExt_data() {
// 		return ext_data;
// 	}
// 	public void setExt_data(Map<String,String> ext_data) {
// 		this.ext_data = ext_data;
// 	}
// 
// }


// Path: src/test/java/net/canadensys/dataportal/occurrence/dao/OccurrenceExtensionDAOTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.canadensys.dataportal.occurrence.model.OccurrenceExtensionModel;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;

package net.canadensys.dataportal.occurrence.dao;





/**
 * This test is using a 'stub' hstore since hstore is PostgreSQL specific.
 * The trick to use it with h2 is available in src/test/resources/h2/h2setup.sql
 * Test Coverage : 
 * -Insert extension data using jdbcTemplate
 * -Save OccurrenceExtensionModel
 * -Load OccurrenceExtensionModel from id
 * -Load OccurrenceExtensionModel list from extensionType, resourceUUID, dwcaID
 * @author canadensys
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/test-spring.xml" })
@TransactionConfiguration(transactionManager = "hibernateTransactionManager")
public class OccurrenceExtensionDAOTest extends AbstractTransactionalJUnit4SpringContextTests {

	@Autowired
	private OccurrenceExtensionDAO occurrenceExtDAO;

	@Before
	public void setup() {
		// make sure the table is empty
		jdbcTemplate.update("DELETE FROM occurrence_extension");
		jdbcTemplate
				.update("INSERT INTO occurrence_extension (auto_id,dwcaid,sourcefileid,resource_uuid,ext_type,ext_data) VALUES (1,'1','source','1111-1111','image', toKeyValue('image_type=>png','author=>darwin','licence=>cc0'))");
	}

	@Test
	public void testSaveAndLoad() {

		OccurrenceExtensionModel occExtModel = new OccurrenceExtensionModel();