mework.roo.org.springframework.roo.project.2.0.0.M3.source-code.multimodule-basic-test.roo Maven / Gradle / Ivy
#====================================================================
# TEST 1: Create multimodule project
#--------------------------------------------------------------------
# Goal: Test if multimodule basic structure is generated
#
project setup --topLevelPackage org.example --multimodule BASIC
#
# Output: Created ROOT/pom.xml
# Created ROOT/application
# Created ROOT/application/pom.xml
# Created application:SRC_MAIN_JAVA/org/example
# Updated ROOT/pom.xml [added module application]
# Updated application:ROOT/pom.xml [added dependencies org.apache.commons:commons-lang3:, org.springframework.boot:spring-boot-starter:, org.springframework.boot:spring-boot-starter-test:, org.aspectj:aspectjrt:${aspectj.version}, org.aspectj:aspectjweaver:${aspectj.version}, org.aspectj:aspectjtools:${aspectj.version}; skipped dependency org.springframework.roo:org.springframework.roo.annotations:${roo.version}; added plugin org.springframework.boot:spring-boot-maven-plugin:-; added plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1; added plugin org.codehaus.mojo:aspectj-maven-plugin:${aspectj.plugin.version}]
# Created application:SRC_MAIN_JAVA/org/example/ExampleApplication.java
# Created application:SRC_TEST_JAVA/org/example
# Created application:SRC_TEST_JAVA/org/example/ExampleApplicationTests.java
#
# Result: Creates the next structure:
# .
# ├── application
# │ ├── pom.xml
# │ └── src
# │ ├── main/java/org/example/ExampleApplication.java
# │ └── test/java/org/example/ExampleApplicationTests.java
# ├── log.roo
# └── pom.xml
#
# where pom.xml contains the modules:
#
# application
#
#
# and application module points towards its parent:
#
# org.example
# example
# 0.1.0.BUILD-SNAPSHOT
#
# application
# war
# application
#====================================================================
#====================================================================
# TEST 2: Create a module inside parent pom
#--------------------------------------------------------------------
# Goal: Create a module inside parent pom using parent parameter
#
module create --moduleName model --parent ~
#
# Output: Created ROOT/model
# Created ROOT/model/pom.xml
# Created model/org/example/model
# Updated ROOT/pom.xml [added module model]
# model roo>
# Result: Creates the next module structure:
# .
# ├── ...
# ├── model
# │ ├── pom.xml
# │ └── src/main/java/org/example/model
# ├── log.roo
# └── pom.xml
#
# and adds the new module inside parent pom:
#
# ...
# model
#
#====================================================================
#====================================================================
# TEST 3: Create a module inside focused module
#--------------------------------------------------------------------
# Goal: Create a new module inside parent pom without using parent
# parameter
#
module focus --moduleName ~
module create --moduleName repository
#
# Output: module create --moduleName repository
# Created ROOT/repository
# Created ROOT/repository/pom.xml
# Created repository:SRC_MAIN_JAVA/org/example/repository
# Updated ROOT/pom.xml [added module repository]
# repository roo>
# Result: Creates the next module structure:
# .
# ├── ...
# ├── repository
# │ ├── pom.xml
# │ └── src/main/java/org/example/repository
# ├── log.roo
# └── pom.xml
#
# and adds the new module inside parent pom:
#
# ...
# repository
#
#====================================================================
#====================================================================
# TEST 4: Create a POM module inside parent module
#--------------------------------------------------------------------
# Goal: Add a POM module inside parent module
#
module create --moduleName service --parent ~ --packaging POM
#
# Output: Created ROOT/service
# Created ROOT/service/pom.xml
# Created pomparent:ROOT/src/main/java/org/example/service
# Updated ROOT/pom.xml [added module service]
#
# Result: Creates the next module structure:
# .
# ├── ...
# ├── service
# │ ├── pom.xml
# │ └── src/main/java/org/example/service
# ├── log.roo
# └── pom.xml
#
# and adds the new module inside parent pom:
#
# ...
# service
#
#====================================================================
#====================================================================
# TEST 5: Create a module inside focused POM module
#--------------------------------------------------------------------
# Goal: Add a module inside the focused POM module
#
module create --moduleName api
#
# Output: Created service:ROOT/api
# Created service:ROOT/api/pom.xml
# Created api:SRC_MAIN_JAVA/org/example/api
# Updated service:ROOT/pom.xml [added module api]
# api roo>
#
# Result: Creates the next module structure:
# .
# ├── ...
# ├── service
# │ ├── api
# │ │ ├── pom.xml
# │ │ └── src/main/java/org/example/api
# │ ├── pom.xml
# │ └── src/main/java/org/example/service
# ├── log.roo
# └── pom.xml
#
# and adds the new module inside pomparent pom:
#
# api
#
#====================================================================
#====================================================================
# TEST 6: Create a module inside a POM module
#--------------------------------------------------------------------
# Goal: Add a module into a POM module using parent option
#
module create --moduleName impl --parent service
#
# Output: Created service:ROOT/impl
# Created service:ROOT/impl/pom.xml
# Created impl:SRC_MAIN_JAVA/org/example/impl
# Updated service:ROOT/pom.xml [added module impl]
# impl roo>
#
# Result: Creates the next module structure:
# .
# ├── ...
# ├── service
# │ ├── api
# │ │ ├── ...
# │ ├── impl
# │ │ ├── pom.xml
# │ │ └── src/main/java/org/example/impl
# │ ├── pom.xml
# │ └── src/main/java/org/example/service
# ├── log.roo
# └── pom.xml
#
# and adds the new module inside service pom:
#
# api
# impl
#
#====================================================================
#====================================================================
# TEST 7: Create a WAR module with an artefactId inside parent POM
#--------------------------------------------------------------------
# Goal: Add a WAR module inside parent module with an artefactId
#
module focus --moduleName ~
module create --moduleName integration-impl --packaging WAR --artifactId integration.impl
#
# Output: Created ROOT/integration-impl
# Created ROOT/integration-impl/pom.xml
# Created someparent:SRC_MAIN_JAVA/org/example/some/integration/impl
# Updated ROOT/pom.xml [added module integration-impl]
# integration-impl roo>
#
# Result: Creates the next module structure:
# .
# ├── ...
# ├── integration-impl
# │ ├── pom.xml
# │ └── src/main/java/org/example/some/integration/impl
# ├── log.roo
# └── pom.xml
#
# which pom.xml is defined as:
#
# org.example
# example
# 0.1.0.BUILD-SNAPSHOT
#
# integration.impl
# war
# integration.impl
#
# and adds the new module inside parent pom:
#
# ...
# integration-impl
#
#====================================================================
#====================================================================
# TEST 8: Focus on a module
#--------------------------------------------------------------------
# Goal: Set the focus on a module
#
module focus --moduleName application
#
# Output: application roo>
#
# Result: Shell prompt changes with the focused module name
#====================================================================
#====================================================================
# TEST 9: Focus on parent project
#--------------------------------------------------------------------
# Goal: Set the focus on parent pom
#
module focus --moduleName ~
#
# Output: roo>
#
# Result: Shell prompt removes any module name
#====================================================================
#====================================================================
# TEST 10: Generate a repository
#--------------------------------------------------------------------
# Goal: Test if model dependency is added to repository module pom
#
jpa setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
entity jpa --class model:~.Owner
repository jpa --entity model:~.Owner --interface repository:org.example.repository.OwnerRep
#
# Output: ...
# Updated repository:ROOT/pom.xml [added dependency org.example:model:0.1.0.BUILD-SNAPSHOT; added dependency com.querydsl:querydsl-jpa:; added plugin com.querydsl:querydsl-maven-plugin:${querydsl.version}]
# ...
#
# Result: Adds model module as a dependency in repository pom.xml
#====================================================================
#====================================================================
# TEST 11: Generate all repositories
#--------------------------------------------------------------------
# Goal: Validate that model dependency is not added again to
# repository module pom
#
entity jpa --class model:~.Pet
repository jpa --all --package repository:org.example.repository
#
# Output: INFO: Already exists a repository associated to the entity 'Owner'. Only one repository per entity is allowed.
# Created repository:SRC_MAIN_JAVA/org/example/repository/PetRepository.java
# Created repository:SRC_MAIN_JAVA/org/example/repository/PetRepositoryCustom.java
# Created repository:SRC_MAIN_JAVA/org/example/repository/PetRepositoryImpl.java
# Created repository:SRC_MAIN_JAVA/org/example/repository/PetRepository_Roo_Jpa_Repository.aj
# Created repository:SRC_MAIN_JAVA/org/example/repository/PetRepositoryImpl_Roo_Jpa_Repository_Impl.aj
#
# Result: Since model dependency is already in repository, it is
# not included again
#====================================================================
#====================================================================
# TEST 12: Create a service
#--------------------------------------------------------------------
# Goal: Test if module dependencies are added to service interface
# and implementation modules
#
service --entity model:~.Owner --repository repository:org.example.repository.OwnerRep --interface api:~.OwnerService --class impl:~.OwnerServiceImpl
#
# Output: Created api:SRC_MAIN_JAVA/org/example/api/OwnerService.java
# Created impl:SRC_MAIN_JAVA/org/example/impl/OwnerServiceImpl.java
# Updated api:ROOT/pom.xml [added dependency org.example:model:0.1.0.BUILD-SNAPSHOT]
# Updated impl:ROOT/pom.xml [added dependency org.example:api:0.1.0.BUILD-SNAPSHOT; added dependency org.example:repository:0.1.0.BUILD-SNAPSHOT; added dependency org.example:model:0.1.0.BUILD-SNAPSHOT]
# Created impl:SRC_MAIN_JAVA/org/example/impl/OwnerServiceImpl_Roo_Service_Impl.aj
# Created api:SRC_MAIN_JAVA/org/example/api/OwnerService_Roo_Service.aj
#
# Result: Model dependency is added to service-api and service-impl
# modules. Repository and service-api are included as
# dependencies into service-impl module
#====================================================================
#====================================================================
# TEST 13: Generate service in the same module
#--------------------------------------------------------------------
# Goal: Test if module dependencies are added to service module
#
module create --moduleName otherservice --parent ~
service --all --apiPackage otherservice:~ --implPackage otherservice:~
#
# Output: ...
# Updated otherservice:ROOT/pom.xml [added dependency org.example:model:0.1.0.BUILD-SNAPSHOT; added dependency org.example:repository:0.1.0.BUILD-SNAPSHOT;]
# ...
#
# Result: Model and repository dependencies are added to otherservice
# module. Since api and implementation are in the same
# module a dependency between them is not added
#====================================================================
####################################################################
# MANUAL TEST
####################################################################
#====================================================================
# TEST 14: Create a repository in model module
#--------------------------------------------------------------------
# Goal: Validates that a module cannot have a dependency with itself
#
#entity jpa --class model:~.City
#repository jpa --entity ~.City --interface ~.repository.CityRep
#
# Output: Created model:SRC_MAIN_JAVA/org/example/model/repository
# Created model:SRC_MAIN_JAVA/org/example/model/repository/CityRep.java
# Created model:SRC_MAIN_JAVA/org/example/model/repository/CityRepCustom.java
# Created model:SRC_MAIN_JAVA/org/example/model/repository/CityRepImpl.java
# Updated model:ROOT/pom.xml [added dependency com.querydsl:querydsl-jpa:; added plugin com.querydsl:querydsl-maven-plugin:${querydsl.version}]
# Created model:SRC_MAIN_JAVA/org/example/model/repository/CityRepImpl_Roo_Jpa_Repository_Impl.aj
# Created model:SRC_MAIN_JAVA/org/example/model/repository/CityRep_Roo_Jpa_Repository.aj
#
# Result: Since the dependency would be with itself, it is not added
#====================================================================
#====================================================================
# TEST 15: Create a module that is already defined
#--------------------------------------------------------------------
# Goal: Avoid to create a module with a name that already is used
# to refer other module
#
# module focus --moduleName ~
# module create --moduleName model
#
# Output: Module model already exists
#
# Result: Informs us that this module already exists
#====================================================================
#====================================================================
# TEST 16: Focus on an incorrect module
#--------------------------------------------------------------------
# Goal: Fails if module does not exist
#
# module focus --moduleName other
#
# Output: java.lang.NullPointerException: Failed to convert 'other' to type Pom for option 'moduleName'
# Module other not found
#
# Result: Informs us that module pom does not exist
#====================================================================
#====================================================================
# TEST 17: Create a module inside a JAR/WAR module without using
# parent option
#--------------------------------------------------------------------
# Goal: Fails to create a module inside a JAR/WAR module if parent
# option is not specified
#
# module focus --moduleName application
# module create --moduleName other
#
# Output: You must specify option 'parent' for this command
#
# Result: Informs us that parent option is necessary since focused
# module is not a POM module
#====================================================================
#====================================================================
# TEST 18: Create a module inside a JAR module
#--------------------------------------------------------------------
# Goal: Fails to create a module inside a JAR module
#
# module create --moduleName other --parent model
#
# Output: --parent parameter must be a POM module
#
# Result: Informs us that parent option must be a POM module
#====================================================================
#====================================================================
# TEST 19: Create a module inside a WAR module
#--------------------------------------------------------------------
# Goal: Fails to create a module inside a WAR module
#
# module create --moduleName other --parent application
#
# Output: --parent parameter must be a POM module
#
# Result: Informs us that parent option must be a POM module
#====================================================================
#====================================================================
# TEST 20: Create a module with incorrect parent
#--------------------------------------------------------------------
# Goal: Fails to create a module if parent does not exist
#
# module create --moduleName other --parent other
#
# Output: --parent parameter must be a POM module
#
# Result: Informs us that parent option must be a POM module
#====================================================================
#====================================================================
# TEST 21: Create a service in the same module as its entity
#--------------------------------------------------------------------
# Goal: Validate that a circular dependency between modules is
# not allowed
#
# service --entity model:~.Pet --repository repository:org.example.repository.PetRepository --interface model:~.api.PetService --class model:~.impl.PetServiceImpl
#
# Output: Created model:SRC_MAIN_JAVA/org/example/model/api
# Created model:SRC_MAIN_JAVA/org/example/model/api/PetService.java
# Created model:SRC_MAIN_JAVA/org/example/model/impl
# Created model:SRC_MAIN_JAVA/org/example/model/impl/PetServiceImpl.java
# Undo create model:SRC_MAIN_JAVA/org/example/model/impl/PetServiceImpl.java
# Undo create model:SRC_MAIN_JAVA/org/example/model/impl
# Undo create model:SRC_MAIN_JAVA/org/example/model/api/PetService.java
# Undo create model:SRC_MAIN_JAVA/org/example/model/api
# Undo manage ROOT/.roo/config/project.properties
# ERROR: Circular dependency detected, 'repository' already depends on 'model'.
#
# Result: Informs that since repository has a dependency with
# module, module can not have a dependency with repository
#====================================================================