WIP: Improve test data creation #112

Draft
ansv7779 wants to merge 4 commits from test-data-improvements into develop
3 changed files with 23 additions and 0 deletions
Showing only changes of commit c17af42dc9 - Show all commits

View File

@ -1,10 +1,12 @@
package se.su.dsv.scipro.testdata; package se.su.dsv.scipro.testdata;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import se.su.dsv.scipro.war.PluginConfiguration; import se.su.dsv.scipro.war.PluginConfiguration;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ComponentScan(basePackages = "se.su.dsv.scipro.testdata.populators")
public class TestDataConfiguration implements PluginConfiguration { public class TestDataConfiguration implements PluginConfiguration {
@Bean @Bean

View File

@ -0,0 +1,8 @@
/**
* This package contains the infrastructure that is used when generating test data for the application. To add new test
* data to the system, add a new class to the {@link se.su.dsv.scipro.testdata.populators} package that implements the
* {@link se.su.dsv.scipro.testdata.TestDataPopulator} interface and annotate it with
* {@link org.springframework.stereotype.Service @Service}. Inject dependencies as needed using
* {@link jakarta.inject.Inject @Inject}.
*/
package se.su.dsv.scipro.testdata;

View File

@ -0,0 +1,13 @@
/**
* Contains classes that populate the database with test data.
* <p>
* Prefer to use methods on the various services to create data, rather than directly interacting with the database
* using an {@link jakarta.persistence.EntityManager}. This is to make sure all business rules are enforced and that
* any additional logic is executed such as sending notifications or calculating statistics.
*
* @see se.su.dsv.scipro.testdata how to add new populators
* @see se.su.dsv.scipro.testdata.TestDataPopulator
* @see se.su.dsv.scipro.testdata.BaseData
* @see se.su.dsv.scipro.testdata.Factory
*/
package se.su.dsv.scipro.testdata.populators;