Remove dependency net._01001111:jlorem (#1350)
* Remove dependency jlorem * Minor optimization * Minor optimization
This commit is contained in:
@@ -90,10 +90,6 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-tx</artifactId>
|
<artifactId>spring-tx</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net._01001111</groupId>
|
|
||||||
<artifactId>jlorem</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|||||||
@@ -78,13 +78,10 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net._01001111.text.LoremIpsum;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data generator utility for tests.
|
* Data generator utility for tests.
|
||||||
*/
|
*/
|
||||||
public class TestdataFactory {
|
public class TestdataFactory {
|
||||||
private static final LoremIpsum LOREM = new LoremIpsum();
|
|
||||||
|
|
||||||
public static final String VISIBLE_SM_MD_KEY = "visibleMetdataKey";
|
public static final String VISIBLE_SM_MD_KEY = "visibleMetdataKey";
|
||||||
public static final String VISIBLE_SM_MD_VALUE = "visibleMetdataValue";
|
public static final String VISIBLE_SM_MD_VALUE = "visibleMetdataValue";
|
||||||
@@ -109,7 +106,7 @@ public class TestdataFactory {
|
|||||||
/**
|
/**
|
||||||
* Default {@link NamedEntity#getDescription()}.
|
* Default {@link NamedEntity#getDescription()}.
|
||||||
*/
|
*/
|
||||||
public static final String DEFAULT_DESCRIPTION = "Desc: " + LOREM.words(10);
|
public static final String DEFAULT_DESCRIPTION = "Desc: " + randomDescriptionShort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key of test default {@link DistributionSetType}.
|
* Key of test default {@link DistributionSetType}.
|
||||||
@@ -129,8 +126,8 @@ public class TestdataFactory {
|
|||||||
public static final String SM_TYPE_RT = "runtime";
|
public static final String SM_TYPE_RT = "runtime";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key of test "application" {@link SoftwareModuleType} : optional software in
|
* Key of test "application" {@link SoftwareModuleType} : optional software
|
||||||
* {@link #DS_TYPE_DEFAULT}.
|
* in {@link #DS_TYPE_DEFAULT}.
|
||||||
*/
|
*/
|
||||||
public static final String SM_TYPE_APP = "application";
|
public static final String SM_TYPE_APP = "application";
|
||||||
|
|
||||||
@@ -186,8 +183,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
||||||
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
@@ -202,8 +199,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
||||||
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
||||||
*
|
*
|
||||||
* @return {@link DistributionSet} entity.
|
* @return {@link DistributionSet} entity.
|
||||||
@@ -214,8 +211,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
||||||
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param modules
|
* @param modules
|
||||||
@@ -229,8 +226,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
||||||
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param modules
|
* @param modules
|
||||||
@@ -247,8 +244,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION}.
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION}.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
||||||
@@ -264,8 +261,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} and
|
||||||
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
* {@link DistributionSet#isRequiredMigrationStep()} <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
@@ -282,15 +279,16 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP}.
|
* , {@link #SM_TYPE_APP}.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
||||||
* vendor and description.
|
* vendor and description.
|
||||||
* @param version
|
* @param version
|
||||||
* {@link DistributionSet#getVersion()} and
|
* {@link DistributionSet#getVersion()} and
|
||||||
* {@link SoftwareModule#getVersion()} extended by a random number.
|
* {@link SoftwareModule#getVersion()} extended by a random
|
||||||
|
* number.
|
||||||
* @param isRequiredMigrationStep
|
* @param isRequiredMigrationStep
|
||||||
* for {@link DistributionSet#isRequiredMigrationStep()}
|
* for {@link DistributionSet#isRequiredMigrationStep()}
|
||||||
*
|
*
|
||||||
@@ -301,20 +299,20 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
final SoftwareModule appMod = softwareModuleManagement.create(entityFactory.softwareModule().create()
|
final SoftwareModule appMod = softwareModuleManagement.create(entityFactory.softwareModule().create()
|
||||||
.type(findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE)).name(prefix + SM_TYPE_APP)
|
.type(findOrCreateSoftwareModuleType(SM_TYPE_APP, Integer.MAX_VALUE)).name(prefix + SM_TYPE_APP)
|
||||||
.version(version + "." + new SecureRandom().nextInt(100)).description(LOREM.words(20))
|
.version(version + "." + new SecureRandom().nextInt(100)).description(randomDescriptionLong())
|
||||||
.vendor(prefix + " vendor Limited, California"));
|
.vendor(prefix + " vendor Limited, California"));
|
||||||
final SoftwareModule runtimeMod = softwareModuleManagement
|
final SoftwareModule runtimeMod = softwareModuleManagement
|
||||||
.create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_RT))
|
.create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_RT))
|
||||||
.name(prefix + "app runtime").version(version + "." + new SecureRandom().nextInt(100))
|
.name(prefix + "app runtime").version(version + "." + new SecureRandom().nextInt(100))
|
||||||
.description(LOREM.words(20)).vendor(prefix + " vendor GmbH, Stuttgart, Germany"));
|
.description(randomDescriptionLong()).vendor(prefix + " vendor GmbH, Stuttgart, Germany"));
|
||||||
final SoftwareModule osMod = softwareModuleManagement
|
final SoftwareModule osMod = softwareModuleManagement
|
||||||
.create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_OS))
|
.create(entityFactory.softwareModule().create().type(findOrCreateSoftwareModuleType(SM_TYPE_OS))
|
||||||
.name(prefix + " Firmware").version(version + "." + new SecureRandom().nextInt(100))
|
.name(prefix + " Firmware").version(version + "." + new SecureRandom().nextInt(100))
|
||||||
.description(LOREM.words(20)).vendor(prefix + " vendor Limited Inc, California"));
|
.description(randomDescriptionLong()).vendor(prefix + " vendor Limited Inc, California"));
|
||||||
|
|
||||||
return distributionSetManagement.create(
|
return distributionSetManagement.create(
|
||||||
entityFactory.distributionSet().create().name(prefix != null && prefix.length() > 0 ? prefix : "DS")
|
entityFactory.distributionSet().create().name(prefix != null && prefix.length() > 0 ? prefix : "DS")
|
||||||
.version(version).description(LOREM.words(10)).type(findOrCreateDefaultTestDsType())
|
.version(version).description(randomDescriptionShort()).type(findOrCreateDefaultTestDsType())
|
||||||
.modules(Arrays.asList(osMod.getId(), runtimeMod.getId(), appMod.getId()))
|
.modules(Arrays.asList(osMod.getId(), runtimeMod.getId(), appMod.getId()))
|
||||||
.requiredMigrationStep(isRequiredMigrationStep));
|
.requiredMigrationStep(isRequiredMigrationStep));
|
||||||
}
|
}
|
||||||
@@ -351,7 +349,8 @@ public class TestdataFactory {
|
|||||||
* vendor and description.
|
* vendor and description.
|
||||||
* @param version
|
* @param version
|
||||||
* {@link DistributionSet#getVersion()} and
|
* {@link DistributionSet#getVersion()} and
|
||||||
* {@link SoftwareModule#getVersion()} extended by a random number.
|
* {@link SoftwareModule#getVersion()} extended by a random
|
||||||
|
* number.
|
||||||
* @param isRequiredMigrationStep
|
* @param isRequiredMigrationStep
|
||||||
* for {@link DistributionSet#isRequiredMigrationStep()}
|
* for {@link DistributionSet#isRequiredMigrationStep()}
|
||||||
* @param modules
|
* @param modules
|
||||||
@@ -364,15 +363,15 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
return distributionSetManagement.create(
|
return distributionSetManagement.create(
|
||||||
entityFactory.distributionSet().create().name(prefix != null && prefix.length() > 0 ? prefix : "DS")
|
entityFactory.distributionSet().create().name(prefix != null && prefix.length() > 0 ? prefix : "DS")
|
||||||
.version(version).description(LOREM.words(10)).type(findOrCreateDefaultTestDsType())
|
.version(version).description(randomDescriptionShort()).type(findOrCreateDefaultTestDsType())
|
||||||
.modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList()))
|
.modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList()))
|
||||||
.requiredMigrationStep(isRequiredMigrationStep));
|
.requiredMigrationStep(isRequiredMigrationStep));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet} in repository including three
|
* Creates {@link DistributionSet} in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP}.
|
* , {@link #SM_TYPE_APP}.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
* for {@link SoftwareModule}s and {@link DistributionSet}s name,
|
||||||
@@ -399,9 +398,9 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet}s in repository including three
|
* Creates {@link DistributionSet}s in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an iterative
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an
|
||||||
* number and {@link DistributionSet#isRequiredMigrationStep()}
|
* iterative number and {@link DistributionSet#isRequiredMigrationStep()}
|
||||||
* <code>false</code>.
|
* <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param number
|
* @param number
|
||||||
@@ -415,7 +414,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a list of {@link DistributionSet}s without modules, i.e. incomplete.
|
* Create a list of {@link DistributionSet}s without modules, i.e.
|
||||||
|
* incomplete.
|
||||||
*
|
*
|
||||||
* @param number
|
* @param number
|
||||||
* of {@link DistributionSet}s to create
|
* of {@link DistributionSet}s to create
|
||||||
@@ -427,7 +427,7 @@ public class TestdataFactory {
|
|||||||
for (int i = 0; i < number; i++) {
|
for (int i = 0; i < number; i++) {
|
||||||
sets.add(distributionSetManagement
|
sets.add(distributionSetManagement
|
||||||
.create(entityFactory.distributionSet().create().name("DS" + i).version(DEFAULT_VERSION + "." + i)
|
.create(entityFactory.distributionSet().create().name("DS" + i).version(DEFAULT_VERSION + "." + i)
|
||||||
.description(LOREM.words(10)).type(findOrCreateDefaultTestDsType())));
|
.description(randomDescriptionShort()).type(findOrCreateDefaultTestDsType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sets;
|
return sets;
|
||||||
@@ -435,9 +435,9 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet}s in repository including three
|
* Creates {@link DistributionSet}s in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an iterative
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an
|
||||||
* number and {@link DistributionSet#isRequiredMigrationStep()}
|
* iterative number and {@link DistributionSet#isRequiredMigrationStep()}
|
||||||
* <code>false</code>.
|
* <code>false</code>.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
@@ -477,8 +477,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link Artifact}s for given {@link SoftwareModule} with a small text
|
* Creates {@link Artifact}s for given {@link SoftwareModule} with a small
|
||||||
* payload.
|
* text payload.
|
||||||
*
|
*
|
||||||
* @param moduleId
|
* @param moduleId
|
||||||
* the {@link Artifact}s belong to.
|
* the {@link Artifact}s belong to.
|
||||||
@@ -496,8 +496,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link Artifact} for given {@link SoftwareModule} with a small text
|
* Create an {@link Artifact} for given {@link SoftwareModule} with a small
|
||||||
* payload.
|
* text payload.
|
||||||
*
|
*
|
||||||
* @param artifactData
|
* @param artifactData
|
||||||
* the {@link Artifact} Inputstream
|
* the {@link Artifact} Inputstream
|
||||||
@@ -517,8 +517,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link Artifact} for given {@link SoftwareModule} with a small text
|
* Create an {@link Artifact} for given {@link SoftwareModule} with a small
|
||||||
* payload.
|
* text payload.
|
||||||
*
|
*
|
||||||
* @param artifactData
|
* @param artifactData
|
||||||
* the {@link Artifact} Inputstream
|
* the {@link Artifact} Inputstream
|
||||||
@@ -542,8 +542,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
||||||
* {@link #DEFAULT_VERSION} and random generated {@link Target#getDescription()}
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
* in the repository.
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
* @param typeKey
|
* @param typeKey
|
||||||
* of the {@link SoftwareModuleType}
|
* of the {@link SoftwareModuleType}
|
||||||
@@ -555,9 +555,10 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} of type {@value Constants#SMT_DEFAULT_APP_KEY}
|
* Creates {@link SoftwareModule} of type
|
||||||
* with {@link #DEFAULT_VENDOR} and {@link #DEFAULT_VERSION} and random
|
* {@value Constants#SMT_DEFAULT_APP_KEY} with {@link #DEFAULT_VENDOR} and
|
||||||
* generated {@link Target#getDescription()} in the repository.
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return persisted {@link SoftwareModule}.
|
* @return persisted {@link SoftwareModule}.
|
||||||
@@ -567,9 +568,10 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} of type {@value Constants#SMT_DEFAULT_APP_KEY}
|
* Creates {@link SoftwareModule} of type
|
||||||
* with {@link #DEFAULT_VENDOR} and {@link #DEFAULT_VERSION} and random
|
* {@value Constants#SMT_DEFAULT_APP_KEY} with {@link #DEFAULT_VENDOR} and
|
||||||
* generated {@link Target#getDescription()} in the repository.
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* added to name and version
|
* added to name and version
|
||||||
@@ -582,9 +584,10 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} of type {@value Constants#SMT_DEFAULT_OS_KEY}
|
* Creates {@link SoftwareModule} of type
|
||||||
* with {@link #DEFAULT_VENDOR} and {@link #DEFAULT_VERSION} and random
|
* {@value Constants#SMT_DEFAULT_OS_KEY} with {@link #DEFAULT_VENDOR} and
|
||||||
* generated {@link Target#getDescription()} in the repository.
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return persisted {@link SoftwareModule}.
|
* @return persisted {@link SoftwareModule}.
|
||||||
@@ -594,9 +597,10 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} of type {@value Constants#SMT_DEFAULT_OS_KEY}
|
* Creates {@link SoftwareModule} of type
|
||||||
* with {@link #DEFAULT_VENDOR} and {@link #DEFAULT_VERSION} and random
|
* {@value Constants#SMT_DEFAULT_OS_KEY} with {@link #DEFAULT_VENDOR} and
|
||||||
* generated {@link Target#getDescription()} in the repository.
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* added to name and version
|
* added to name and version
|
||||||
@@ -610,8 +614,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
||||||
* {@link #DEFAULT_VERSION} and random generated {@link Target#getDescription()}
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
* in the repository.
|
* {@link Target#getDescription()} in the repository.
|
||||||
*
|
*
|
||||||
* @param typeKey
|
* @param typeKey
|
||||||
* of the {@link SoftwareModuleType}
|
* of the {@link SoftwareModuleType}
|
||||||
@@ -623,7 +627,7 @@ public class TestdataFactory {
|
|||||||
public SoftwareModule createSoftwareModule(final String typeKey, final String prefix, final boolean encrypted) {
|
public SoftwareModule createSoftwareModule(final String typeKey, final String prefix, final boolean encrypted) {
|
||||||
return softwareModuleManagement.create(entityFactory.softwareModule().create()
|
return softwareModuleManagement.create(entityFactory.softwareModule().create()
|
||||||
.type(findOrCreateSoftwareModuleType(typeKey)).name(prefix + typeKey).version(prefix + DEFAULT_VERSION)
|
.type(findOrCreateSoftwareModuleType(typeKey)).name(prefix + typeKey).version(prefix + DEFAULT_VERSION)
|
||||||
.description(LOREM.words(10)).vendor(DEFAULT_VENDOR).encrypted(encrypted));
|
.description(randomDescriptionShort()).vendor(DEFAULT_VENDOR).encrypted(encrypted));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -651,7 +655,7 @@ public class TestdataFactory {
|
|||||||
*/
|
*/
|
||||||
public Target createTarget(final String controllerId, final String targetName) {
|
public Target createTarget(final String controllerId, final String targetName) {
|
||||||
final Target target = targetManagement
|
final Target target = targetManagement
|
||||||
.create(entityFactory.target().create().controllerId(controllerId).name(targetName));
|
.create(entityFactory.target().create().controllerId(controllerId).name(targetName));
|
||||||
assertTargetProperlyCreated(target);
|
assertTargetProperlyCreated(target);
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
@@ -690,14 +694,15 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link DistributionSet}s in repository including three
|
* Creates {@link DistributionSet}s in repository including three
|
||||||
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT} ,
|
* {@link SoftwareModule}s of types {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
||||||
* {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an iterative
|
* , {@link #SM_TYPE_APP} with {@link #DEFAULT_VERSION} followed by an
|
||||||
* number and {@link DistributionSet#isRequiredMigrationStep()}
|
* iterative number and {@link DistributionSet#isRequiredMigrationStep()}
|
||||||
* <code>false</code>.
|
* <code>false</code>.
|
||||||
*
|
*
|
||||||
* In addition it updates the created {@link DistributionSet}s and
|
* In addition it updates the created {@link DistributionSet}s and
|
||||||
* {@link SoftwareModule}s to ensure that {@link BaseEntity#getLastModifiedAt()}
|
* {@link SoftwareModule}s to ensure that
|
||||||
* and {@link BaseEntity#getLastModifiedBy()} is filled.
|
* {@link BaseEntity#getLastModifiedAt()} and
|
||||||
|
* {@link BaseEntity#getLastModifiedBy()} is filled.
|
||||||
*
|
*
|
||||||
* @return persisted {@link DistributionSet}.
|
* @return persisted {@link DistributionSet}.
|
||||||
*/
|
*/
|
||||||
@@ -715,8 +720,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {@link DistributionSetType} with key {@link #DS_TYPE_DEFAULT} and
|
* @return {@link DistributionSetType} with key {@link #DS_TYPE_DEFAULT} and
|
||||||
* {@link SoftwareModuleType}s {@link #SM_TYPE_OS}, {@link #SM_TYPE_RT}
|
* {@link SoftwareModuleType}s {@link #SM_TYPE_OS},
|
||||||
* , {@link #SM_TYPE_APP}.
|
* {@link #SM_TYPE_RT} , {@link #SM_TYPE_APP}.
|
||||||
*/
|
*/
|
||||||
public DistributionSetType findOrCreateDefaultTestDsType() {
|
public DistributionSetType findOrCreateDefaultTestDsType() {
|
||||||
final List<SoftwareModuleType> mand = new ArrayList<>();
|
final List<SoftwareModuleType> mand = new ArrayList<>();
|
||||||
@@ -743,7 +748,7 @@ public class TestdataFactory {
|
|||||||
public DistributionSetType findOrCreateDistributionSetType(final String dsTypeKey, final String dsTypeName) {
|
public DistributionSetType findOrCreateDistributionSetType(final String dsTypeKey, final String dsTypeName) {
|
||||||
return distributionSetTypeManagement.getByKey(dsTypeKey)
|
return distributionSetTypeManagement.getByKey(dsTypeKey)
|
||||||
.orElseGet(() -> distributionSetTypeManagement.create(entityFactory.distributionSetType().create()
|
.orElseGet(() -> distributionSetTypeManagement.create(entityFactory.distributionSetType().create()
|
||||||
.key(dsTypeKey).name(dsTypeName).description(LOREM.words(10)).colour("black")));
|
.key(dsTypeKey).name(dsTypeName).description(randomDescriptionShort()).colour("black")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -765,15 +770,15 @@ public class TestdataFactory {
|
|||||||
final Collection<SoftwareModuleType> mandatory, final Collection<SoftwareModuleType> optional) {
|
final Collection<SoftwareModuleType> mandatory, final Collection<SoftwareModuleType> optional) {
|
||||||
return distributionSetTypeManagement.getByKey(dsTypeKey)
|
return distributionSetTypeManagement.getByKey(dsTypeKey)
|
||||||
.orElseGet(() -> distributionSetTypeManagement.create(entityFactory.distributionSetType().create()
|
.orElseGet(() -> distributionSetTypeManagement.create(entityFactory.distributionSetType().create()
|
||||||
.key(dsTypeKey).name(dsTypeName).description(LOREM.words(10)).colour("black")
|
.key(dsTypeKey).name(dsTypeName).description(randomDescriptionShort()).colour("black")
|
||||||
.optional(optional.stream().map(SoftwareModuleType::getId).collect(Collectors.toList()))
|
.optional(optional.stream().map(SoftwareModuleType::getId).collect(Collectors.toList()))
|
||||||
.mandatory(mandatory.stream().map(SoftwareModuleType::getId).collect(Collectors.toList()))));
|
.mandatory(mandatory.stream().map(SoftwareModuleType::getId).collect(Collectors.toList()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds {@link SoftwareModuleType} in repository with given
|
* Finds {@link SoftwareModuleType} in repository with given
|
||||||
* {@link SoftwareModuleType#getKey()} or creates if it does not exist yet with
|
* {@link SoftwareModuleType#getKey()} or creates if it does not exist yet
|
||||||
* {@link SoftwareModuleType#getMaxAssignments()} = 1.
|
* with {@link SoftwareModuleType#getMaxAssignments()} = 1.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* {@link SoftwareModuleType#getKey()}
|
* {@link SoftwareModuleType#getKey()}
|
||||||
@@ -796,9 +801,10 @@ public class TestdataFactory {
|
|||||||
* @return persisted {@link SoftwareModuleType}
|
* @return persisted {@link SoftwareModuleType}
|
||||||
*/
|
*/
|
||||||
public SoftwareModuleType findOrCreateSoftwareModuleType(final String key, final int maxAssignments) {
|
public SoftwareModuleType findOrCreateSoftwareModuleType(final String key, final int maxAssignments) {
|
||||||
return softwareModuleTypeManagement.getByKey(key).orElseGet(
|
return softwareModuleTypeManagement.getByKey(key)
|
||||||
() -> softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key(key).name(key)
|
.orElseGet(() -> softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create()
|
||||||
.description(LOREM.words(10)).colour("#ffffff").maxAssignments(maxAssignments)));
|
.key(key).name(key).description(randomDescriptionShort()).colour("#ffffff")
|
||||||
|
.maxAssignments(maxAssignments)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -817,9 +823,9 @@ public class TestdataFactory {
|
|||||||
*/
|
*/
|
||||||
public DistributionSet createDistributionSet(final String name, final String version,
|
public DistributionSet createDistributionSet(final String name, final String version,
|
||||||
final DistributionSetType type, final Collection<SoftwareModule> modules) {
|
final DistributionSetType type, final Collection<SoftwareModule> modules) {
|
||||||
return distributionSetManagement.create(
|
return distributionSetManagement.create(entityFactory.distributionSet().create().name(name).version(version)
|
||||||
entityFactory.distributionSet().create().name(name).version(version).description(LOREM.words(10))
|
.description(randomDescriptionShort()).type(type)
|
||||||
.type(type).modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList())));
|
.modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -841,8 +847,9 @@ public class TestdataFactory {
|
|||||||
public DistributionSet generateDistributionSet(final String name, final String version,
|
public DistributionSet generateDistributionSet(final String name, final String version,
|
||||||
final DistributionSetType type, final Collection<SoftwareModule> modules,
|
final DistributionSetType type, final Collection<SoftwareModule> modules,
|
||||||
final boolean requiredMigrationStep) {
|
final boolean requiredMigrationStep) {
|
||||||
return entityFactory.distributionSet().create().name(name).version(version).description(LOREM.words(10))
|
return entityFactory.distributionSet().create().name(name).version(version)
|
||||||
.type(type).modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList()))
|
.description(randomDescriptionShort()).type(type)
|
||||||
|
.modules(modules.stream().map(SoftwareModule::getId).collect(Collectors.toList()))
|
||||||
.requiredMigrationStep(requiredMigrationStep).build();
|
.requiredMigrationStep(requiredMigrationStep).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -879,8 +886,9 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link Target}s in repository and with {@link #DEFAULT_CONTROLLER_ID}
|
* Creates {@link Target}s in repository and with
|
||||||
* as prefix for {@link Target#getControllerId()}.
|
* {@link #DEFAULT_CONTROLLER_ID} as prefix for
|
||||||
|
* {@link Target#getControllerId()}.
|
||||||
*
|
*
|
||||||
* @param number
|
* @param number
|
||||||
* of {@link Target}s to create
|
* of {@link Target}s to create
|
||||||
@@ -966,7 +974,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds {@link Target} objects with given prefix for
|
* Builds {@link Target} objects with given prefix for
|
||||||
* {@link Target#getControllerId()} followed by a number suffix starting with 0.
|
* {@link Target#getControllerId()} followed by a number suffix starting
|
||||||
|
* with 0.
|
||||||
*
|
*
|
||||||
* @param numberOfTargets
|
* @param numberOfTargets
|
||||||
* of {@link Target}s to generate
|
* of {@link Target}s to generate
|
||||||
@@ -1014,7 +1023,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<Target> createTargets(final Collection<TargetCreate> targetCreates) {
|
private List<Target> createTargets(final Collection<TargetCreate> targetCreates) {
|
||||||
// init new instance of array list since the TargetManagement#create will
|
// init new instance of array list since the TargetManagement#create
|
||||||
|
// will
|
||||||
// provide a unmodifiable list
|
// provide a unmodifiable list
|
||||||
final List<Target> createdTargets = targetManagement.create(targetCreates);
|
final List<Target> createdTargets = targetManagement.create(targetCreates);
|
||||||
return new ArrayList<>(createdTargets);
|
return new ArrayList<>(createdTargets);
|
||||||
@@ -1091,7 +1101,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append {@link ActionStatus} to all {@link Action}s of given {@link Target}s.
|
* Append {@link ActionStatus} to all {@link Action}s of given
|
||||||
|
* {@link Target}s.
|
||||||
*
|
*
|
||||||
* @param targets
|
* @param targets
|
||||||
* to add {@link ActionStatus}
|
* to add {@link ActionStatus}
|
||||||
@@ -1108,7 +1119,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append {@link ActionStatus} to all {@link Action}s of given {@link Target}s.
|
* Append {@link ActionStatus} to all {@link Action}s of given
|
||||||
|
* {@link Target}s.
|
||||||
*
|
*
|
||||||
* @param targets
|
* @param targets
|
||||||
* to add {@link ActionStatus}
|
* to add {@link ActionStatus}
|
||||||
@@ -1187,8 +1199,8 @@ public class TestdataFactory {
|
|||||||
* @param weight
|
* @param weight
|
||||||
* weight of the Rollout
|
* weight of the Rollout
|
||||||
* @param confirmationRequired
|
* @param confirmationRequired
|
||||||
* if the confirmation is required (considered with confirmation flow
|
* if the confirmation is required (considered with confirmation
|
||||||
* active)
|
* flow active)
|
||||||
* @return created {@link Rollout}
|
* @return created {@link Rollout}
|
||||||
*/
|
*/
|
||||||
public Rollout createRolloutByVariables(final String rolloutName, final String rolloutDescription,
|
public Rollout createRolloutByVariables(final String rolloutName, final String rolloutDescription,
|
||||||
@@ -1216,8 +1228,8 @@ public class TestdataFactory {
|
|||||||
* {@link Target}s.
|
* {@link Target}s.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* for rollouts name, description, {@link Target#getControllerId()}
|
* for rollouts name, description,
|
||||||
* filter
|
* {@link Target#getControllerId()} filter
|
||||||
* @return created {@link Rollout}
|
* @return created {@link Rollout}
|
||||||
*/
|
*/
|
||||||
public Rollout createRollout(final String prefix) {
|
public Rollout createRollout(final String prefix) {
|
||||||
@@ -1338,17 +1350,17 @@ public class TestdataFactory {
|
|||||||
createTargets(amountTargetsForRollout, "rollout-" + suffix + "-", "rollout");
|
createTargets(amountTargetsForRollout, "rollout-" + suffix + "-", "rollout");
|
||||||
createTargets(amountOtherTargets, "others-" + suffix + "-", "rollout");
|
createTargets(amountOtherTargets, "others-" + suffix + "-", "rollout");
|
||||||
final String filterQuery = "controllerId==rollout-" + suffix + "-*";
|
final String filterQuery = "controllerId==rollout-" + suffix + "-*";
|
||||||
return createRolloutByVariables("rollout-" + suffix, "test-rollout-description", amountOfGroups,
|
return createRolloutByVariables("rollout-" + suffix, "test-rollout-description", amountOfGroups, filterQuery,
|
||||||
filterQuery, rolloutDS, successCondition, errorCondition, actionType, weight, false);
|
rolloutDS, successCondition, errorCondition, actionType, weight, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the soft deleted {@link Rollout} with a new {@link DistributionSet}
|
* Create the soft deleted {@link Rollout} with a new
|
||||||
* and {@link Target}s.
|
* {@link DistributionSet} and {@link Target}s.
|
||||||
*
|
*
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* for rollouts name, description, {@link Target#getControllerId()}
|
* for rollouts name, description,
|
||||||
* filter
|
* {@link Target#getControllerId()} filter
|
||||||
* @return created {@link Rollout}
|
* @return created {@link Rollout}
|
||||||
*/
|
*/
|
||||||
public Rollout createSoftDeletedRollout(final String prefix) {
|
public Rollout createSoftDeletedRollout(final String prefix) {
|
||||||
@@ -1362,8 +1374,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds {@link TargetType} in repository with given
|
* Finds {@link TargetType} in repository with given
|
||||||
* {@link TargetType#getName()} or creates if it does not exist yet. No ds types
|
* {@link TargetType#getName()} or creates if it does not exist yet. No ds
|
||||||
* are assigned on creation.
|
* types are assigned on creation.
|
||||||
*
|
*
|
||||||
* @param targetTypeName
|
* @param targetTypeName
|
||||||
* {@link TargetType#getName()}
|
* {@link TargetType#getName()}
|
||||||
@@ -1378,8 +1390,8 @@ public class TestdataFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link TargetType} in repository with given
|
* Creates {@link TargetType} in repository with given
|
||||||
* {@link TargetType#getName()}. Compatible distribution set types are assigned
|
* {@link TargetType#getName()}. Compatible distribution set types are
|
||||||
* on creation
|
* assigned on creation
|
||||||
*
|
*
|
||||||
* @param targetTypeName
|
* @param targetTypeName
|
||||||
* {@link TargetType#getName()}
|
* {@link TargetType#getName()}
|
||||||
@@ -1411,8 +1423,8 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a distribution set and directly invalidates it. No actions will be
|
* Creates a distribution set and directly invalidates it. No actions will
|
||||||
* canceled and no rollouts will be stopped with this invalidation.
|
* be canceled and no rollouts will be stopped with this invalidation.
|
||||||
*
|
*
|
||||||
* @return created invalidated {@link DistributionSet}
|
* @return created invalidated {@link DistributionSet}
|
||||||
*/
|
*/
|
||||||
@@ -1424,14 +1436,27 @@ public class TestdataFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a distribution set that has no software modules assigned, so it is
|
* Creates a distribution set that has no software modules assigned, so it
|
||||||
* incomplete.
|
* is incomplete.
|
||||||
*
|
*
|
||||||
* @return created incomplete {@link DistributionSet}
|
* @return created incomplete {@link DistributionSet}
|
||||||
*/
|
*/
|
||||||
public DistributionSet createIncompleteDistributionSet() {
|
public DistributionSet createIncompleteDistributionSet() {
|
||||||
return distributionSetManagement.create(entityFactory.distributionSet().create()
|
return distributionSetManagement.create(entityFactory.distributionSet().create()
|
||||||
.name(UUID.randomUUID().toString()).version(DEFAULT_VERSION).description(LOREM.words(10))
|
.name(UUID.randomUUID().toString()).version(DEFAULT_VERSION).description(randomDescriptionShort())
|
||||||
.type(findOrCreateDefaultTestDsType()).requiredMigrationStep(false));
|
.type(findOrCreateDefaultTestDsType()).requiredMigrationStep(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String randomDescriptionShort() {
|
||||||
|
return randomText(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String randomDescriptionLong() {
|
||||||
|
return randomText(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String randomText(final int len) {
|
||||||
|
return RandomStringUtils.randomAlphanumeric(len);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -203,7 +203,6 @@
|
|||||||
<guava.version>30.1.1-jre</guava.version>
|
<guava.version>30.1.1-jre</guava.version>
|
||||||
<javax.el-api.version>2.2.4</javax.el-api.version>
|
<javax.el-api.version>2.2.4</javax.el-api.version>
|
||||||
<corn-cps.version>1.1.7</corn-cps.version>
|
<corn-cps.version>1.1.7</corn-cps.version>
|
||||||
<jlorem.version>1.1</jlorem.version>
|
|
||||||
<commons-io.version>2.11.0</commons-io.version>
|
<commons-io.version>2.11.0</commons-io.version>
|
||||||
<rsql-parser.version>2.1.0</rsql-parser.version>
|
<rsql-parser.version>2.1.0</rsql-parser.version>
|
||||||
<awaitility.version>3.1.2</awaitility.version>
|
<awaitility.version>3.1.2</awaitility.version>
|
||||||
@@ -734,11 +733,6 @@
|
|||||||
<artifactId>corn-cps</artifactId>
|
<artifactId>corn-cps</artifactId>
|
||||||
<version>${corn-cps.version}</version>
|
<version>${corn-cps.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>net._01001111</groupId>
|
|
||||||
<artifactId>jlorem</artifactId>
|
|
||||||
<version>${jlorem.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.gwtd3</groupId>
|
<groupId>com.github.gwtd3</groupId>
|
||||||
<artifactId>gwt-d3-api</artifactId>
|
<artifactId>gwt-d3-api</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user