From 4f67edd9db4e9b45b6babf3ee05b33458ef2867e Mon Sep 17 00:00:00 2001 From: Justin Robbins Date: Sun, 24 Jan 2016 10:11:47 -0700 Subject: [PATCH] closes #214 --- .../FlashCards_Repository_Commons/pom.xml | 14 ++ .../jackson/CustomObjectMapper.java | 6 + .../FlashCards_Repository_Jpa/pom.xml | 5 + .../model/util/EntityAuditingUtil.java | 12 +- .../AbstractCrudRepositoryFacadeImpl.java | 20 ++- .../DefaultFlashCardRepositoryFacade.java | 4 +- .../impl/DefaultUserRepositoryFacade.java | 9 +- .../PopulatingFlashCardRepositoryFacade.java | 16 ++ .../PopulatingTagRepositoryFacade.java | 16 ++ .../PopulatingUserRepositoryFacade.java | 18 +++ .../populator/RepositoryPopulator.java | 6 + .../RepositoryPopulatorListener.java | 38 +++++ .../ResourceReaderRepositoryPopulator.java | 99 ++++++++++++ ...licationContext-repository-jpa-commons.xml | 15 +- .../resources/META-INF/infrastructure.xml | 29 ++-- .../main/resources/init-data/flashcards.json | 147 ++++++++++++++++++ .../src/main/resources/init-data/tag.json | 64 +++++--- .../src/main/resources/init-data/user.json | 35 +++++ .../src/main/resources/sql/flashcard.sql | 14 -- .../src/main/resources/sql/flashcard_link.sql | 11 -- .../src/main/resources/sql/flashcard_tag.sql | 16 -- .../src/main/resources/sql/tag.sql | 10 -- .../src/main/resources/sql/user.sql | 3 - .../test/resources/test-infrastructure.xml | 42 ++--- FlashCards_WebServices/pom.xml | 9 +- .../applicationContext-webServices.xml | 2 - pom.xml | 10 +- 27 files changed, 527 insertions(+), 143 deletions(-) rename {FlashCards_WebServices => FlashCards_Repository/FlashCards_Repository_Commons}/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java (74%) create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingFlashCardRepositoryFacade.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingTagRepositoryFacade.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingUserRepositoryFacade.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulator.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulatorListener.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/ResourceReaderRepositoryPopulator.java create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/flashcards.json create mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/user.json delete mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard.sql delete mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_link.sql delete mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_tag.sql delete mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/tag.sql delete mode 100644 FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/user.sql diff --git a/FlashCards_Repository/FlashCards_Repository_Commons/pom.xml b/FlashCards_Repository/FlashCards_Repository_Commons/pom.xml index d11295f63..57fbc5cb1 100644 --- a/FlashCards_Repository/FlashCards_Repository_Commons/pom.xml +++ b/FlashCards_Repository/FlashCards_Repository_Commons/pom.xml @@ -38,6 +38,20 @@ javax.inject + + + com.fasterxml.jackson.datatype + jackson-datatype-hibernate4 + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + FlashCards_Repository_Commons diff --git a/FlashCards_WebServices/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java b/FlashCards_Repository/FlashCards_Repository_Commons/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java similarity index 74% rename from FlashCards_WebServices/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java rename to FlashCards_Repository/FlashCards_Repository_Commons/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java index 07b250473..758d536b2 100644 --- a/FlashCards_WebServices/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java +++ b/FlashCards_Repository/FlashCards_Repository_Commons/src/main/java/org/robbins/flashcards/jackson/CustomObjectMapper.java @@ -1,11 +1,13 @@ package org.robbins.flashcards.jackson; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module; import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module.Feature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; public class CustomObjectMapper extends ObjectMapper { @@ -15,10 +17,14 @@ public CustomObjectMapper() { this.registerModule(hm); this.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + this.registerModule(new JavaTimeModule()); SimpleFilterProvider filterProvider = new SimpleFilterProvider(); filterProvider.setFailOnUnknownId(false); this.setFilters(filterProvider); + + this.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + this.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } public void setPrettyPrint(final boolean prettyPrint) { diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa/pom.xml b/FlashCards_Repository/FlashCards_Repository_Jpa/pom.xml index 05ca980e6..6aac9183d 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa/pom.xml +++ b/FlashCards_Repository/FlashCards_Repository_Jpa/pom.xml @@ -26,6 +26,11 @@ FlashCards_Repository_Jpa_Commons ${project.version} + + org.robbins.flashcards + FlashCards_Repository_Commons + ${project.version} + org.springframework diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/model/util/EntityAuditingUtil.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/model/util/EntityAuditingUtil.java index 01350f9ce..c01020fdd 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/model/util/EntityAuditingUtil.java +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/model/util/EntityAuditingUtil.java @@ -1,16 +1,16 @@ package org.robbins.flashcards.model.util; -import java.time.LocalDateTime; - import org.robbins.flashcards.model.common.AbstractAuditable; +import java.time.LocalDateTime; + public class EntityAuditingUtil { - public static void configureCreatedByAndTime(final AbstractAuditable entity, final Long auditingUserId) { - entity.setCreatedBy(auditingUserId); - entity.setCreatedDate(LocalDateTime.now()); + if (entity.isNew()) { + entity.setCreatedBy(auditingUserId); + entity.setCreatedDate(LocalDateTime.now()); + } } - } diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/base/AbstractCrudRepositoryFacadeImpl.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/base/AbstractCrudRepositoryFacadeImpl.java index 120117f97..62a034b8a 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/base/AbstractCrudRepositoryFacadeImpl.java +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/base/AbstractCrudRepositoryFacadeImpl.java @@ -1,13 +1,6 @@ package org.robbins.flashcards.repository.facade.base; -import java.io.Serializable; -import java.util.List; -import java.util.Optional; -import java.util.Set; - -import javax.inject.Inject; - import org.apache.commons.collections.CollectionUtils; import org.robbins.flashcards.dto.BatchLoadingReceiptDto; import org.robbins.flashcards.exceptions.FlashCardsException; @@ -24,6 +17,12 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import javax.inject.Inject; +import java.io.Serializable; +import java.util.List; +import java.util.Optional; +import java.util.Set; + @Transactional public abstract class AbstractCrudRepositoryFacadeImpl implements GenericCrudFacade, RepositoryFacade { @@ -43,11 +42,16 @@ public Long getAuditingUserId() { @Override public D save(final D dto) throws RepositoryException { final E entity = getConverter().getEntity(dto); - EntityAuditingUtil.configureCreatedByAndTime(entity, getAuditingUserId()); + configureCreatedByAndTime(entity); final E result = getRepository().save(entity); return convertAndInitializeEntity(result); } + public void configureCreatedByAndTime(final E entity) + { + EntityAuditingUtil.configureCreatedByAndTime(entity, getAuditingUserId()); + } + @Transactional(propagation= Propagation.NEVER) @Override public BatchLoadingReceiptDto save(final List dtos) throws FlashCardsException diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultFlashCardRepositoryFacade.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultFlashCardRepositoryFacade.java index f1d636793..a226b9519 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultFlashCardRepositoryFacade.java +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultFlashCardRepositoryFacade.java @@ -3,7 +3,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; - import org.robbins.flashcards.conversion.DtoConverter; import org.robbins.flashcards.dto.FlashCardDto; import org.robbins.flashcards.dto.TagDto; @@ -22,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.inject.Inject; - import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -61,7 +59,7 @@ public FlashCardRepository getRepository() { @Override public FlashCardDto save(final FlashCardDto dto) throws RepositoryException { final FlashCard entity = getConverter().getEntity(dto); - EntityAuditingUtil.configureCreatedByAndTime(entity, getAuditingUserId()); + configureCreatedByAndTime(entity); entity.setTags(configureTags(dto.getTags())); final FlashCard result = repository.save(entity); return convertAndInitializeEntity(result); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultUserRepositoryFacade.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultUserRepositoryFacade.java index dbc42d5f9..aa4842bb5 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultUserRepositoryFacade.java +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/facade/impl/DefaultUserRepositoryFacade.java @@ -1,12 +1,12 @@ package org.robbins.flashcards.repository.facade.impl; +import org.robbins.flashcards.conversion.DtoConverter; import org.robbins.flashcards.dto.UserDto; import org.robbins.flashcards.exceptions.RepositoryException; import org.robbins.flashcards.facade.UserFacade; import org.robbins.flashcards.model.User; import org.robbins.flashcards.repository.UserRepository; -import org.robbins.flashcards.conversion.DtoConverter; import org.robbins.flashcards.repository.facade.base.AbstractCrudRepositoryFacadeImpl; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -49,14 +49,15 @@ public UserDto findUserByOpenid(final String openid) throws RepositoryException @Override public UserDto save(final UserDto dto) throws RepositoryException { - User entity = getConverter().getEntity(dto); + final User entity = getConverter().getEntity(dto); if (!dto.isNew()) { User orig = repository.findOne(dto.getId()); entity.setCreatedBy(orig.getCreatedBy()); entity.setCreatedDate(orig.getCreatedDate()); } - - return super.save(dto); + configureCreatedByAndTime(entity); + final User result = getRepository().save(entity); + return convertAndInitializeEntity(result); } } diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingFlashCardRepositoryFacade.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingFlashCardRepositoryFacade.java new file mode 100644 index 000000000..4b56b7b1c --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingFlashCardRepositoryFacade.java @@ -0,0 +1,16 @@ + +package org.robbins.flashcards.repository.populator; + +import org.robbins.flashcards.model.FlashCard; +import org.robbins.flashcards.model.util.EntityAuditingUtil; +import org.robbins.flashcards.repository.facade.impl.DefaultFlashCardRepositoryFacade; +import org.springframework.stereotype.Component; + +@Component("populatingFlashcardRepositoryFacade") +public class PopulatingFlashCardRepositoryFacade extends DefaultFlashCardRepositoryFacade +{ + @Override + public void configureCreatedByAndTime(FlashCard entity) { + EntityAuditingUtil.configureCreatedByAndTime(entity, 1L); + } +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingTagRepositoryFacade.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingTagRepositoryFacade.java new file mode 100644 index 000000000..b17987167 --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingTagRepositoryFacade.java @@ -0,0 +1,16 @@ + +package org.robbins.flashcards.repository.populator; + +import org.robbins.flashcards.model.Tag; +import org.robbins.flashcards.model.util.EntityAuditingUtil; +import org.robbins.flashcards.repository.facade.impl.DefaultTagRepositoryFacade; +import org.springframework.stereotype.Component; + +@Component("populatingTagRepositoryFacade") +public class PopulatingTagRepositoryFacade extends DefaultTagRepositoryFacade { + + @Override + public void configureCreatedByAndTime(Tag entity) { + EntityAuditingUtil.configureCreatedByAndTime(entity, 1L); + } +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingUserRepositoryFacade.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingUserRepositoryFacade.java new file mode 100644 index 000000000..2db03859e --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/PopulatingUserRepositoryFacade.java @@ -0,0 +1,18 @@ + +package org.robbins.flashcards.repository.populator; + +import org.robbins.flashcards.model.User; +import org.robbins.flashcards.model.util.EntityAuditingUtil; +import org.robbins.flashcards.repository.facade.impl.DefaultUserRepositoryFacade; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; + +@Component("populatingUserRepositoryFacade") +public class PopulatingUserRepositoryFacade extends DefaultUserRepositoryFacade { + + @Override + public void configureCreatedByAndTime(User entity) { + EntityAuditingUtil.configureCreatedByAndTime(entity, 1L); + } +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulator.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulator.java new file mode 100644 index 000000000..53f40621a --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulator.java @@ -0,0 +1,6 @@ +package org.robbins.flashcards.repository.populator; + + +public interface RepositoryPopulator { + void populate(); +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulatorListener.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulatorListener.java new file mode 100644 index 000000000..164aa2b68 --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/RepositoryPopulatorListener.java @@ -0,0 +1,38 @@ +package org.robbins.flashcards.repository.populator; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; +import org.springframework.stereotype.Component; + +@Component +public class RepositoryPopulatorListener implements ApplicationListener, + ApplicationContextAware { + + @Autowired + private RepositoryPopulator populator; + + private ApplicationContext context; + + /* + * (non-Javadoc) + * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) + */ + public void setApplicationContext(ApplicationContext applicationContext) { + this.context = applicationContext; + } + + /* + * (non-Javadoc) + * @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent) + */ + public void onApplicationEvent(ContextRefreshedEvent event) { + + if (event.getApplicationContext().equals(context)) { + populator.populate(); + } + } +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/ResourceReaderRepositoryPopulator.java b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/ResourceReaderRepositoryPopulator.java new file mode 100644 index 000000000..82d9a1d40 --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/java/org/robbins/flashcards/repository/populator/ResourceReaderRepositoryPopulator.java @@ -0,0 +1,99 @@ +package org.robbins.flashcards.repository.populator; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.robbins.flashcards.facade.base.GenericCrudFacade; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.data.repository.init.Jackson2ResourceReader; +import org.springframework.data.repository.init.ResourceReader; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Component +public class ResourceReaderRepositoryPopulator implements RepositoryPopulator, InitializingBean { + + private static final Logger LOGGER = LoggerFactory.getLogger(ResourceReaderRepositoryPopulator.class); + + @Autowired + private ObjectMapper mapper; + + @javax.annotation.Resource(name = "dtoToFacadeMap") + private Map dtoToFacadeMap; + + @javax.annotation.Resource(name = "initResourceNames") + @Autowired + private List initResourceNames; + + private ResourceReader reader; + private List resources; + + @Override + public void afterPropertiesSet() throws Exception { + reader = new Jackson2ResourceReader(mapper); + resources = getResources(); + } + + public void populate() { + resources.forEach(this::populateResource); + } + + private void populateResource(final Resource resource) { + LOGGER.info(String.format("Reading resource: %s", resource)); + + final Object result = readObjectFrom(resource); + + if (result instanceof Collection) { + ((Collection) result).forEach(this::populateElement); + } else { + persist(result); + } + } + + private void populateElement(final Object element) { + if (element != null) { + persist(element); + } else { + LOGGER.info("Skipping null element found in unmarshal result!"); + } + } + + private Object readObjectFrom(Resource resource) { + try { + return getResourceReader().readFrom(resource, null); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void persist(Object object) { + + final String dtoName = object.getClass().getSimpleName(); + final GenericCrudFacade facade = dtoToFacadeMap.get(dtoName); + LOGGER.debug(String.format("Persisting %s using repository %s", object, facade)); + facade.save(object); + } + + private List getResources() { + if (initResourceNames == null) return new ArrayList<>(); + + return initResourceNames + .stream() + .map(ClassPathResource::new) + .collect(Collectors.toList()); + } + + private ResourceReader getResourceReader() { + return reader; + } + +} diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/applicationContext-repository-jpa-commons.xml b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/applicationContext-repository-jpa-commons.xml index 807d1c167..e1c83b91e 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/applicationContext-repository-jpa-commons.xml +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/applicationContext-repository-jpa-commons.xml @@ -2,8 +2,10 @@ + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> @@ -21,10 +23,19 @@ + + + + + + + + + org.robbins.flashcards.repository.batch, + org.robbins.flashcards.repository.populator" /> diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/infrastructure.xml b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/infrastructure.xml index be6dcfc55..4bd4651b9 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/infrastructure.xml +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/META-INF/infrastructure.xml @@ -1,12 +1,12 @@ + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> @@ -56,20 +56,17 @@ - - - + + init-data/user.json + - - - - - - - - + + init-data/tag.json + init-data/user.json + init-data/flashcards.json + diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/flashcards.json b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/flashcards.json new file mode 100644 index 000000000..81cca824b --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/flashcards.json @@ -0,0 +1,147 @@ +[ + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "Which Maven plugin executes tests?", + "answer": "
    \n
  • maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately.

  • \n
  • maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.
  • \n
" + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are the build phases of the default Maven lifecycle?", + "answer": "
    \n
  1. validate - validate the project is correct and all necessary information is available
  2. compile - compile the source code of the project
  3. test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  4. package - take the compiled code and package it in its distributable format, such as a JAR.
  5. integration-test - process and deploy the package if necessary into an environment where integration tests can be run
  6. verify - run any checks to verify the package is valid and meets quality criteria
  7. install - install the package into the local repository, for use as a dependency in other projects locally
  8. deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
    \n
", + "tags": [ + { + "name": "Maven" + } + ], + "links": [ + "http://maven.apache.org/surefire/maven-surefire-plugin/", + "http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html" + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are some new language features introduced in Java 5,6 and 7?", + "answer": "
  • Java 5
    • Generics
    • Annotations
    • Varargs
  • Java 6
  • Java 7
", + "tags": [ + { + "name": "Java" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What is the standard Maven directory layout?", + "answer": "src/main/java
src/main/resources
src/main/webapp
src/test/java
src/test/resources
target
", + "tags": [ + { + "name": "Maven" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "How can you protect against SQL Injection?", + "answer": "
  • Parameterized statements can be used that work with parameters (sometimes called placeholders or bind variables).  A placeholder can only store a value of the given type and not an arbitrary SQL fragment. Hence the SQL injection would simply be treated as a strange (and probably invalid) parameter value.
  • JPA/ORM libraries - SQL and QL injection can be effectively prevented with the use of JPA Named Queries.
", + "tags": [ + { + "name": "Java" + }, + { + "name": "SQL" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are the Maven dependency scopes?", + "answer": "There are 6 available scopes:
  1. compile - This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
  2. provided - This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime.
  3. runtime - This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
  4. test - This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
  5. system - This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
  6. import
", + "tags": [ + { + "name": "Maven" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What is the difference between Maven lifecycles, phases and goals?", + "answer": "
    \r\n
  • Lifecycle - A lifecycle is comprised of a list of phases which are executed sequentially.
  • \r\n
  • Phase - A build phase represents a stage in the lifecycle.  A build phase can also have zero or more goals bound to it.
  • \r\n
  • Goal - A goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project.
  • \r\n
", + "tags": [ + { + "name": "Maven" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are the meanings and items of the Agile Manifesto?", + "answer": "
  1. Individuals and interactions – in agile development, self-organization and motivation are important, as are interactions like co-location and pair programming.
  2. Working software – working software will be more useful and welcome than just presenting documents to clients in meetings.
  3. Customer collaboration – requirements cannot be fully collected at the beginning of the software development cycle, therefore continuous customer or stakeholder involvement is very important.
  4. Responding to change – agile development is focused on quick responses to change and continuous development.
", + "tags": [ + { + "name": "Agile" + }, + { + "name": "Git" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What is the difference between Fetch and Pull in Git?", + "answer": "
  • Pull will merge any pulled commits into the branch you are currently working in
  • Fetch retrieves any commits from the target remote that you do not have and stores them in your local repository but it does not merge them with your current branch.
", + "tags": [ + { + "name": "Git" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What is the difference between the terms ''origin'' and ''master'' in Git?", + "answer": "Origin refers to the the original remote repository, by convention it is the primary centralized repository as well.

Master refers to the branch.  There is nothing special about the name - you don''t actually have to have a ''master'' branch but since it''s the default that is created, most projects do.

Usually most projects work with an origin remote, and the master branch by default
", + "tags": [ + { + "name": "JPA" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are three ways to wire Spring beans?", + "answer": "
  1. XML Configuration
  2. Annotations
  3. Java-based configuration
", + "tags": [ + { + "name": "Spring" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are some implementations for JAX-RS?", + "answer": "Jersey
Apache CXF

Note: Although Spring MVC can be used to build RESTful web services, it does not implement the JAX-RS spec
", + "tags": [ + { + "name": "JAX-RS" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are the available ''scopes'' for Spring beans?", + "answer": "
  1. singleton - Single instance per Spring container
  2. prototype - bean can be instantiated per use
  3. request (requires web-capable context)
  4. session (requires web-capable context)
", + "tags": [ + { + "name": "Spring" + } + ] + }, + { + "_class": "org.robbins.flashcards.dto.FlashCardDto", + "question": "What are the purpose of Maven build profiles?", + "answer": "Profiles modify the POM at build time, and are meant to be used in complementary sets to give equivalent-but-different parameters for a set of target environments (providing, for example, the path of the appserver root in the development, testing, and production environments). As such, profiles can easily lead to differing build results from different members of your team.
", + "tags": [ + { + "name": "Maven" + } + ] + } +] diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/tag.json b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/tag.json index 795c0e6f7..e2caa8e74 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/tag.json +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/tag.json @@ -1,22 +1,42 @@ -[ { "_class" : "org.robbins.flashcards.model.Tag", - "id" : "2", - "name" : "JPA", - "lastModifiedDate" : "2013-03-29 19:10:19", - "createdDate" : "2011-10-17 22:28:22", - "lastModifiedBy" : "4", - "createdBy" : "1"}, - { "_class" : "org.robbins.flashcards.model.Tag", - "id" : "12", - "name" : "JAX-RS", - "lastModifiedDate" : "2012-09-01 19:07:56", - "createdDate" : "2012-09-01 19:07:56", - "lastModifiedBy" : "4", - "createdBy" : "4"}, - { "_class" : "org.robbins.flashcards.model.Tag", - "id" : "14", - "name" : "Maven", - "lastModifiedDate" : "2013-04-07 19:58:04", - "createdDate" : "2013-04-07 19:58:04", - "lastModifiedBy" : "1", - "createdBy" : "1"} -] \ No newline at end of file +[ + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Hibernate" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "JPA" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "JAX-RS" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Maven" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Java" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "SQL" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Spring" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "AOP" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Agile" + }, + { + "_class": "org.robbins.flashcards.dto.TagDto", + "name": "Git" + } +] diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/user.json b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/user.json new file mode 100644 index 000000000..7e080ec10 --- /dev/null +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/init-data/user.json @@ -0,0 +1,35 @@ +[ + { + "_class": "org.robbins.flashcards.dto.UserDto", + "openid" : "https://www.google.com/accounts/o8/id?id=AItOawllJAsRUc_lQK9cK8vk0E7CJGqEFUAC5oE", + "firstName": "Justin", + "lastName": "Robbins", + "fullName": "Justin Robbins", + "email": "justinhrobbins@gmail.com", + "nickname": "", + "country": "", + "language": "" + }, + { + "_class": "org.robbins.flashcards.dto.UserDto", + "openid" : "apiuser", + "firstName": "apiuser", + "lastName": "", + "fullName": "apiuser", + "email": "", + "nickname": "", + "country": "", + "language": "" + }, + { + "_class": "org.robbins.flashcards.dto.UserDto", + "openid" : "rest-api-client", + "firstName": "rest-api-client", + "lastName": "", + "fullName": "", + "email": "", + "nickname": "", + "country": "", + "language": "" + } +] \ No newline at end of file diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard.sql b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard.sql deleted file mode 100644 index 0df370850..000000000 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard.sql +++ /dev/null @@ -1,14 +0,0 @@ -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (124,'
    \n
  • maven-surefire-plugin is designed for running unit tests and if any of the tests fail then it will fail the build immediately.

  • \n
  • maven-failsafe-plugin is designed for running integration tests, and decouples failing the build if there are test failures from actually running the tests.
  • \n
','2013-04-07 19:56:45','Which Maven plugin executes tests?','2013-04-08 17:33:52',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (125,'
    \n
  1. validate - validate the project is correct and all necessary information is available
  2. compile - compile the source code of the project
  3. test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  4. package - take the compiled code and package it in its distributable format, such as a JAR.
  5. integration-test - process and deploy the package if necessary into an environment where integration tests can be run
  6. verify - run any checks to verify the package is valid and meets quality criteria
  7. install - install the package into the local repository, for use as a dependency in other projects locally
  8. deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
    \n
','2013-04-07 20:05:35','What are the build phases of the default Maven lifecycle?','2013-04-08 21:47:16',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (126,'
  • Java 5
    • Generics
    • Annotations
    • Varargs
  • Java 6
  • Java 7
','2013-04-07 20:31:14','What are some new language features introduced in Java 5,6 and 7?','2013-04-07 20:31:14',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (127,'src/main/java
src/main/resources
src/main/webapp
src/test/java
src/test/resources
target
','2013-04-08 17:18:32','What is the standard Maven directory layout?','2013-04-08 17:18:32',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (128,'
  • Parameterized statements can be used that work with parameters (sometimes called placeholders or bind variables).  A placeholder can only store a value of the given type and not an arbitrary SQL fragment. Hence the SQL injection would simply be treated as a strange (and probably invalid) parameter value.
  • JPA/ORM libraries - SQL and QL injection can be effectively prevented with the use of JPA Named Queries.
','2013-04-08 17:47:39','How can you protect against SQL Injection?','2013-04-08 17:47:39',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (129,'There are 6 available scopes:
  1. compile - This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.
  2. provided - This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime.
  3. runtime - This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.
  4. test - This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases.
  5. system - This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.
  6. import
','2013-04-08 21:38:39','What are the Maven dependency scopes?','2013-04-08 21:47:32',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (130,'
    \r\n
  • Lifecycle - A lifecycle is comprised of a list of phases which are executed sequentially.
  • \r\n
  • Phase - A build phase represents a stage in the lifecycle.  A build phase can also have zero or more goals bound to it.
  • \r\n
  • Goal - A goal represents a specific task (finer than a build phase) which contributes to the building and managing of a project.
  • \r\n
','2013-04-08 22:01:29','What is the difference between Maven lifecycles, phases and goals?','2013-04-08 22:14:39',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (131,'
  1. Individuals and interactions – in agile development, self-organization and motivation are important, as are interactions like co-location and pair programming.
  2. Working software – working software will be more useful and welcome than just presenting documents to clients in meetings.
  3. Customer collaboration – requirements cannot be fully collected at the beginning of the software development cycle, therefore continuous customer or stakeholder involvement is very important.
  4. Responding to change – agile development is focused on quick responses to change and continuous development.
','2013-04-12 20:01:08','What are the meanings and items of the Agile Manifesto?','2013-04-12 20:01:08',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (132,'
  • Pull will merge any pulled commits into the branch you are currently working in
  • Fetch retrieves any commits from the target remote that you do not have and stores them in your local repository but it does not merge them with your current branch.
','2013-04-12 22:08:19','What is the difference between Fetch and Pull in Git?','2013-04-12 22:08:19',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (133,'Origin refers to the the original remote repository, by convention it is the primary centralized repository as well.

Master refers to the branch.  There is nothing special about the name - you don''t actually have to have a ''master'' branch but since it''s the default that is created, most projects do.

Usually most projects work with an origin remote, and the master branch by default
','2013-04-12 22:18:41','What is the difference between the terms ''origin'' and ''master'' in Git?','2013-04-12 22:20:52',1,1); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (134,'
  1. XML Configuration
  2. Annotations
  3. Java-based configuration
','2013-04-12 22:36:39','What are three ways to wire Spring beans?','2013-04-12 22:36:39',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (135,'Jersey
Apache CXF

Note: Although Spring MVC can be used to build RESTful web services, it does not implement the JAX-RS spec
','2013-04-12 22:43:53','What are some implementations for JAX-RS?','2013-04-12 22:43:53',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (136,'
  1. singleton - Single instance per Spring container
  2. prototype - bean can be instantiated per use
  3. request (requires web-capable context)
  4. session (requires web-capable context)
','2013-04-12 22:47:40','What are the available ''scopes'' for Spring beans?','2013-04-12 22:47:40',4,4); -INSERT INTO flashcard (FlashCardId, Answer, CreatedDate, Question, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (137,'Profiles modify the POM at build time, and are meant to be used in complementary sets to give equivalent-but-different parameters for a set of target environments (providing, for example, the path of the appserver root in the development, testing, and production environments). As such, profiles can easily lead to differing build results from different members of your team.
','2013-04-13 13:29:19','What are the purpose of Maven build profiles?','2013-04-13 13:29:19',4,4); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_link.sql b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_link.sql deleted file mode 100644 index 809de10cc..000000000 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_link.sql +++ /dev/null @@ -1,11 +0,0 @@ -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (124,'http://maven.apache.org/surefire/maven-surefire-plugin/',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (125,'http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (126,'http://en.wikipedia.org/wiki/Java_version_history',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (127,'http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (129,'http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (130,'http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (130,'http://stackoverflow.com/questions/8038536/maven-relationship-between-lifecycle-phase-goal',1); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (132,'https://help.github.com/articles/fork-a-repo',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (133,'http://stackoverflow.com/questions/9529497/what-is-origin-in-git',0); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (133,'http://gitref.org/branching/',1); -INSERT INTO flashcard_link (FlashCardId, Link, link_idx) VALUES (137,'http://maven.apache.org/guides/introduction/introduction-to-profiles.html',0); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_tag.sql b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_tag.sql deleted file mode 100644 index 4b379007f..000000000 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/flashcard_tag.sql +++ /dev/null @@ -1,16 +0,0 @@ -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (135,12); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (124,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (125,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (127,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (129,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (130,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (137,14); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (126,15); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (128,15); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (128,16); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (134,17); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (136,17); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (131,19); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (132,20); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (133,20); -INSERT INTO flashcard_tag (FlashCardId, TagId) VALUES (133,2); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/tag.sql b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/tag.sql deleted file mode 100644 index 60ee0707e..000000000 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/tag.sql +++ /dev/null @@ -1,10 +0,0 @@ -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (1,'2011-10-17 22:28:15','Hibernate','2011-10-17 22:28:15',1,1); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (2,'2011-10-17 22:28:22','JPA','2013-03-29 19:10:19',1,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (12,'2012-09-01 19:07:56','JAX-RS','2012-09-01 19:07:56',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (14,'2013-04-07 19:58:04','Maven','2013-04-07 19:58:04',1,1); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (15,'2013-04-07 20:26:02','Java','2013-04-07 20:26:02',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (16,'2013-04-08 17:40:59','SQL','2013-04-08 17:40:59',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (17,'2013-04-09 13:06:28','Spring','2013-04-09 13:06:28',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (18,'2013-04-09 15:46:19','AOP','2013-04-09 15:46:19',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (19,'2013-04-12 19:55:28','Agile','2013-04-12 19:55:28',4,4); -INSERT INTO tag (TagId, CreatedDate, TagName, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (20,'2013-04-12 22:06:14','Git','2013-04-12 22:06:14',4,4); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/user.sql b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/user.sql deleted file mode 100644 index a82d8c98e..000000000 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/main/resources/sql/user.sql +++ /dev/null @@ -1,3 +0,0 @@ -INSERT INTO user (UserId, Country, CreatedDate, Email, FirstName, FullName, Language, LastLoginDate, LastName, Nickname, OpenId, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (1,NULL,'2011-10-17 21:23:59','justinhrobbins@gmail.com','Justin',NULL,'en-US','2012-01-29 11:47:13','Robbins',NULL,'https://www.google.com/accounts/o8/id?id=AItOawllJAsRUc_lQK9cK8vk0E7CJGqEFUAC5oE','2012-01-29 11:47:13',1,NULL); -INSERT INTO user (UserId, Country, CreatedDate, Email, FirstName, FullName, Language, LastLoginDate, LastName, Nickname, OpenId, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (4,NULL,'2012-08-18 00:00:00','','apiuser',NULL,NULL,'2012-08-18 00:00:00','apiuser',NULL,'apiuser','2012-08-18 00:00:00',1,NULL); -INSERT INTO user (UserId, Country, CreatedDate, Email, FirstName, FullName, Language, LastLoginDate, LastName, Nickname, OpenId, UpdatedDate, CreatedUserId, ModifiedUserId) VALUES (5,NULL,'2015-02-20 00:00:00','','rest-api-client',NULL,NULL,'2012-08-18 00:00:00','rest-api-client',NULL,'rest-api-client','2012-08-18 00:00:00',1,NULL); diff --git a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/test/resources/test-infrastructure.xml b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/test/resources/test-infrastructure.xml index cef279ad2..6509bf339 100644 --- a/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/test/resources/test-infrastructure.xml +++ b/FlashCards_Repository/FlashCards_Repository_Jpa_Commons/src/test/resources/test-infrastructure.xml @@ -1,36 +1,42 @@ + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> - - + destroy-method="close"> + + - - - - + class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"> + + + + - - + class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> + + - + - + + + + + + diff --git a/FlashCards_WebServices/pom.xml b/FlashCards_WebServices/pom.xml index 3ad78693a..4e15e22ff 100644 --- a/FlashCards_WebServices/pom.xml +++ b/FlashCards_WebServices/pom.xml @@ -33,11 +33,6 @@ FlashCards_Service ${project.version}
- - org.robbins.flashcards - FlashCards_Client - ${project.version} - javax.ws.rs @@ -93,6 +88,10 @@ com.fasterxml.jackson.core jackson-databind + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + diff --git a/FlashCards_WebServices/src/main/resources/META-INF/applicationContext-webServices.xml b/FlashCards_WebServices/src/main/resources/META-INF/applicationContext-webServices.xml index 9ab522711..0a21e5b07 100644 --- a/FlashCards_WebServices/src/main/resources/META-INF/applicationContext-webServices.xml +++ b/FlashCards_WebServices/src/main/resources/META-INF/applicationContext-webServices.xml @@ -16,6 +16,4 @@ org.robbins.flashcards.jersey.filters; org.robbins.flashcards.providers" /> - - diff --git a/pom.xml b/pom.xml index 2c9c8801c..ddc73f519 100644 --- a/pom.xml +++ b/pom.xml @@ -44,8 +44,7 @@ 2.4.1 4.2.4 1.3.171 - 2.1.4 - 2.1.1 + 2.6.4 3.18.1-GA 1 3.0.1 @@ -369,7 +368,12 @@ com.fasterxml.jackson.datatype jackson-datatype-hibernate4 - ${jackson.hibernate.version} + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version}