Sonar Fixes (#2231)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-01-24 13:41:39 +02:00
committed by GitHub
parent d488203b5f
commit 51054bdd2f
12 changed files with 123 additions and 106 deletions

View File

@@ -29,7 +29,6 @@ import org.eclipse.hawkbit.repository.jpa.builder.JpaTagBuilder;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetMetadata;
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetMetadata;
import org.eclipse.hawkbit.repository.model.MetaData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
/**
@@ -38,23 +37,31 @@ import org.springframework.validation.annotation.Validated;
@Validated
public class JpaEntityFactory implements EntityFactory {
@Autowired
private DistributionSetBuilder distributionSetBuilder;
@Autowired
private TargetBuilder targetBuilder;
@Autowired
private DistributionSetTypeBuilder distributionSetTypeBuilder;
@Autowired
private SoftwareModuleBuilder softwareModuleBuilder;
@Autowired
private RolloutBuilder rolloutBuilder;
@Autowired
private TargetFilterQueryBuilder targetFilterQueryBuilder;
@Autowired
private SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder;
@Autowired
private TargetTypeBuilder targetTypeBuilder;
private final TargetBuilder targetBuilder;
private final TargetTypeBuilder targetTypeBuilder;
private final TargetFilterQueryBuilder targetFilterQueryBuilder;
private final SoftwareModuleBuilder softwareModuleBuilder;
private final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder;
private final DistributionSetBuilder distributionSetBuilder;
private final DistributionSetTypeBuilder distributionSetTypeBuilder;
private final RolloutBuilder rolloutBuilder;
@SuppressWarnings("java:S107")
public JpaEntityFactory(
final TargetBuilder targetBuilder, final TargetTypeBuilder targetTypeBuilder,
final TargetFilterQueryBuilder targetFilterQueryBuilder,
final SoftwareModuleBuilder softwareModuleBuilder, final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
final DistributionSetBuilder distributionSetBuilder, final DistributionSetTypeBuilder distributionSetTypeBuilder,
final RolloutBuilder rolloutBuilder) {
this.targetBuilder = targetBuilder;
this.targetTypeBuilder = targetTypeBuilder;
this.targetFilterQueryBuilder = targetFilterQueryBuilder;
this.softwareModuleBuilder = softwareModuleBuilder;
this.softwareModuleMetadataBuilder = softwareModuleMetadataBuilder;
this.distributionSetBuilder = distributionSetBuilder;
this.distributionSetTypeBuilder = distributionSetTypeBuilder;
this.rolloutBuilder = rolloutBuilder;
}
@Override
public ActionStatusBuilder actionStatus() {
return new JpaActionStatusBuilder();

View File

@@ -29,7 +29,6 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.CrudRepository;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
/**
* A collection of static helper methods for the management classes

View File

@@ -121,6 +121,7 @@ public class JpaRolloutExecutor implements RolloutExecutor {
private final RepositoryProperties repositoryProperties;
private final Map<Long, AtomicLong> lastDynamicGroupFill = new ConcurrentHashMap<>();
@SuppressWarnings("java:S107")
public JpaRolloutExecutor(
final ActionRepository actionRepository, final RolloutGroupRepository rolloutGroupRepository,
final RolloutTargetGroupRepository rolloutTargetGroupRepository,

View File

@@ -181,6 +181,7 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.integration.support.locks.LockRegistry;
import org.springframework.lang.NonNull;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.PlatformTransactionManager;
@@ -702,16 +703,26 @@ public class RepositoryApplicationConfiguration {
@Bean
@ConditionalOnMissingBean
RolloutManagement rolloutManagement(final TargetManagement targetManagement,
final DistributionSetManagement distributionSetManagement, final EventPublisherHolder eventPublisherHolder,
final VirtualPropertyReplacer virtualPropertyReplacer, final JpaProperties properties,
RolloutManagement rolloutManagement(
final RolloutRepository rolloutRepository,
final RolloutGroupRepository rolloutGroupRepository,
final RolloutApprovalStrategy rolloutApprovalStrategy,
final StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction,
final RolloutStatusCache rolloutStatusCache,
final ActionRepository actionRepository,
final TargetManagement targetManagement,
final DistributionSetManagement distributionSetManagement,
final TenantConfigurationManagement tenantConfigurationManagement,
final SystemSecurityContext systemSecurityContext,
final ContextAware contextAware) {
return new JpaRolloutManagement(targetManagement, distributionSetManagement, eventPublisherHolder,
virtualPropertyReplacer, properties.getDatabase(), rolloutApprovalStrategy,
tenantConfigurationManagement, systemSecurityContext, contextAware);
final QuotaManagement quotaManagement,
final AfterTransactionCommitExecutor afterCommit, final EventPublisherHolder eventPublisherHolder,
final VirtualPropertyReplacer virtualPropertyReplacer,
final SystemSecurityContext systemSecurityContext, final ContextAware contextAware, final JpaProperties properties,
final RepositoryProperties repositoryProperties) {
return new JpaRolloutManagement(rolloutRepository, rolloutGroupRepository, rolloutApprovalStrategy,
startNextRolloutGroupAction, rolloutStatusCache, actionRepository, targetManagement,
distributionSetManagement, tenantConfigurationManagement, quotaManagement, afterCommit,
eventPublisherHolder, virtualPropertyReplacer, systemSecurityContext, contextAware, properties.getDatabase(),
repositoryProperties);
}
/**
@@ -821,8 +832,14 @@ public class RepositoryApplicationConfiguration {
*/
@Bean
@ConditionalOnMissingBean
EntityFactory entityFactory() {
return new JpaEntityFactory();
EntityFactory entityFactory(
final TargetBuilder targetBuilder, final TargetTypeBuilder targetTypeBuilder,
final TargetFilterQueryBuilder targetFilterQueryBuilder,
final SoftwareModuleBuilder softwareModuleBuilder, final SoftwareModuleMetadataBuilder softwareModuleMetadataBuilder,
final DistributionSetBuilder distributionSetBuilder, final DistributionSetTypeBuilder distributionSetTypeBuilder,
final RolloutBuilder rolloutBuilder) {
return new JpaEntityFactory(targetBuilder, targetTypeBuilder, targetFilterQueryBuilder, softwareModuleBuilder,
softwareModuleMetadataBuilder, distributionSetBuilder, distributionSetTypeBuilder, rolloutBuilder);
}
/**

View File

@@ -21,7 +21,6 @@ import org.eclipse.hawkbit.repository.builder.RolloutCreate;
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.springframework.util.StringUtils;
public class JpaRolloutCreate extends AbstractNamedEntityBuilder<RolloutCreate> implements RolloutCreate {

View File

@@ -33,17 +33,8 @@ public class JpaRolloutGroupCreate extends AbstractRolloutGroupCreate<RolloutGro
/**
* Set the Success And Error conditions for the rollout group
*
* @param group The Rollout group
* @param successCondition The Rollout group success condition
* @param successConditionExp The Rollout group success expression
* @param successAction The Rollout group success action
* @param successActionExp The Rollout group success action expression
* @param errorCondition The Rollout group error condition
* @param errorConditionExp The Rollout group error expression
* @param errorAction The Rollout group error action
* @param errorActionExp The Rollout group error action expression
*/
@SuppressWarnings("java:S107")
public static void addSuccessAndErrorConditionsAndActions(final JpaRolloutGroup group,
final RolloutGroup.RolloutGroupSuccessCondition successCondition, final String successConditionExp,
final RolloutGroup.RolloutGroupSuccessAction successAction, final String successActionExp,

View File

@@ -29,9 +29,9 @@ import org.eclipse.hawkbit.repository.RolloutStatusCache;
import org.eclipse.hawkbit.repository.TargetFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup_;
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout_;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget_;
import org.eclipse.hawkbit.repository.jpa.model.RolloutTargetGroup;
@@ -66,21 +66,15 @@ import org.springframework.validation.annotation.Validated;
public class JpaRolloutGroupManagement implements RolloutGroupManagement {
private final RolloutGroupRepository rolloutGroupRepository;
private final RolloutRepository rolloutRepository;
private final ActionRepository actionRepository;
private final TargetRepository targetRepository;
private final EntityManager entityManager;
private final VirtualPropertyReplacer virtualPropertyReplacer;
private final RolloutStatusCache rolloutStatusCache;
private final Database database;
@SuppressWarnings("java:S107")
public JpaRolloutGroupManagement(final RolloutGroupRepository rolloutGroupRepository,
final RolloutRepository rolloutRepository, final ActionRepository actionRepository,
final TargetRepository targetRepository, final EntityManager entityManager,
@@ -130,7 +124,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
final List<Specification<JpaRolloutGroup>> specList = Arrays.asList(
RSQLUtility.buildRsqlSpecification(rsqlParam, RolloutGroupFields.class, virtualPropertyReplacer,
database),
(root, query, cb) -> cb.equal(root.get(JpaRolloutGroup_.rollout).get(JpaRollout_.id), rolloutId));
(root, query, cb) -> cb.equal(root.get(JpaRolloutGroup_.rollout).get(AbstractJpaBaseEntity_.id), rolloutId));
return JpaManagementHelper.findAllWithCountBySpec(rolloutGroupRepository, specList, pageable);
}
@@ -180,7 +174,8 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
// in case of status ready the action has not been created yet and
// the relation information between target and rollout-group is
// stored in the #TargetRolloutGroup.
return JpaManagementHelper.findAllWithCountBySpec(targetRepository,
return JpaManagementHelper.findAllWithCountBySpec(
targetRepository,
Collections.singletonList(TargetSpecifications.isInRolloutGroup(rolloutGroupId)), page
);
}
@@ -190,17 +185,14 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
}
@Override
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final long rolloutGroupId,
final String rsqlParam) {
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final long rolloutGroupId, final String rsqlParam) {
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
final List<Specification<JpaTarget>> specList = Arrays.asList(
RSQLUtility.buildRsqlSpecification(rsqlParam, TargetFields.class, virtualPropertyReplacer, database),
(root, query, cb) -> {
final ListJoin<JpaTarget, RolloutTargetGroup> rolloutTargetJoin = root
.join(JpaTarget_.rolloutTargetGroup);
return cb.equal(rolloutTargetJoin.get(RolloutTargetGroup_.rolloutGroup).get(JpaRolloutGroup_.id),
rolloutGroupId);
final ListJoin<JpaTarget, RolloutTargetGroup> rolloutTargetJoin = root.join(JpaTarget_.rolloutTargetGroup);
return cb.equal(rolloutTargetJoin.get(RolloutTargetGroup_.rolloutGroup).get(AbstractJpaBaseEntity_.id), rolloutGroupId);
});
return JpaManagementHelper.findAllWithCountBySpec(targetRepository, specList, pageable);
@@ -273,8 +265,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
private Predicate getRolloutGroupTargetWithRolloutGroupJoinCondition(final long rolloutGroupId,
final CriteriaBuilder cb, final Root<RolloutTargetGroup> targetRoot) {
return cb.equal(targetRoot.get(RolloutTargetGroup_.rolloutGroup).get(JpaRolloutGroup_.id), //
rolloutGroupId);
return cb.equal(targetRoot.get(RolloutTargetGroup_.rolloutGroup).get(AbstractJpaBaseEntity_.id), rolloutGroupId);
}
private void throwExceptionIfRolloutGroupDoesNotExist(final Long rolloutGroupId) {

View File

@@ -52,6 +52,7 @@ import org.eclipse.hawkbit.repository.jpa.JpaManagementHelper;
import org.eclipse.hawkbit.repository.jpa.builder.JpaRolloutGroupCreate;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.jpa.model.AbstractJpaBaseEntity_;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
@@ -109,48 +110,57 @@ public class JpaRolloutManagement implements RolloutManagement {
RolloutStatus.CREATING, RolloutStatus.PAUSED, RolloutStatus.READY, RolloutStatus.STARTING,
RolloutStatus.WAITING_FOR_APPROVAL, RolloutStatus.APPROVAL_DENIED);
private final RolloutRepository rolloutRepository;
private final RolloutGroupRepository rolloutGroupRepository;
private final RolloutApprovalStrategy rolloutApprovalStrategy;
private final StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction;
private final RolloutStatusCache rolloutStatusCache;
private final ActionRepository actionRepository;
private final TargetManagement targetManagement;
private final DistributionSetManagement distributionSetManagement;
private final VirtualPropertyReplacer virtualPropertyReplacer;
private final RolloutApprovalStrategy rolloutApprovalStrategy;
private final TenantConfigurationManagement tenantConfigurationManagement;
private final SystemSecurityContext systemSecurityContext;
private final QuotaManagement quotaManagement;
private final AfterTransactionCommitExecutor afterCommit;
private final EventPublisherHolder eventPublisherHolder;
private final VirtualPropertyReplacer virtualPropertyReplacer;
private final SystemSecurityContext systemSecurityContext;
private final ContextAware contextAware;
private final Database database;
@Autowired
private RepositoryProperties repositoryProperties;
@Autowired
private RolloutRepository rolloutRepository;
@Autowired
private RolloutGroupRepository rolloutGroupRepository;
@Autowired
private ActionRepository actionRepository;
@Autowired
private AfterTransactionCommitExecutor afterCommit;
@Autowired
private QuotaManagement quotaManagement;
@Autowired
private RolloutStatusCache rolloutStatusCache;
@Autowired
private StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction;
private final RepositoryProperties repositoryProperties;
public JpaRolloutManagement(final TargetManagement targetManagement,
final DistributionSetManagement distributionSetManagement, final EventPublisherHolder eventPublisherHolder,
final VirtualPropertyReplacer virtualPropertyReplacer, final Database database,
@SuppressWarnings("java:S107")
public JpaRolloutManagement(
final RolloutRepository rolloutRepository,
final RolloutGroupRepository rolloutGroupRepository,
final RolloutApprovalStrategy rolloutApprovalStrategy,
final StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction,
final RolloutStatusCache rolloutStatusCache,
final ActionRepository actionRepository,
final TargetManagement targetManagement,
final DistributionSetManagement distributionSetManagement,
final TenantConfigurationManagement tenantConfigurationManagement,
final SystemSecurityContext systemSecurityContext,
final ContextAware contextAware) {
final QuotaManagement quotaManagement,
final AfterTransactionCommitExecutor afterCommit, final EventPublisherHolder eventPublisherHolder,
final VirtualPropertyReplacer virtualPropertyReplacer,
final SystemSecurityContext systemSecurityContext, final ContextAware contextAware, final Database database,
final RepositoryProperties repositoryProperties) {
this.rolloutRepository = rolloutRepository;
this.rolloutGroupRepository = rolloutGroupRepository;
this.rolloutApprovalStrategy = rolloutApprovalStrategy;
this.startNextRolloutGroupAction = startNextRolloutGroupAction;
this.rolloutStatusCache = rolloutStatusCache;
this.actionRepository = actionRepository;
this.targetManagement = targetManagement;
this.distributionSetManagement = distributionSetManagement;
this.virtualPropertyReplacer = virtualPropertyReplacer;
this.database = database;
this.rolloutApprovalStrategy = rolloutApprovalStrategy;
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.systemSecurityContext = systemSecurityContext;
this.quotaManagement = quotaManagement;
this.afterCommit = afterCommit;
this.eventPublisherHolder = eventPublisherHolder;
this.virtualPropertyReplacer = virtualPropertyReplacer;
this.systemSecurityContext = systemSecurityContext;
this.contextAware = contextAware;
this.database = database;
this.repositoryProperties = repositoryProperties;
}
public static String createRolloutLockKey(final String tenant) {
@@ -164,7 +174,7 @@ public class JpaRolloutManagement implements RolloutManagement {
@Override
public long count() {
return rolloutRepository.count(RolloutSpecification.isDeleted(false, Sort.by(Direction.DESC, JpaRollout_.ID)));
return rolloutRepository.count(RolloutSpecification.isDeleted(false, Sort.by(Direction.DESC, AbstractJpaBaseEntity_.ID)));
}
@Override

View File

@@ -12,7 +12,7 @@ package org.eclipse.hawkbit.repository.jpa.model;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Optional;
@@ -61,8 +61,9 @@ import org.eclipse.hawkbit.repository.model.helper.EventPublisherHolder;
@Entity
@Table(name = "sp_rollout", uniqueConstraints = @UniqueConstraint(columnNames = { "name", "tenant" }, name = "uk_rollout"))
@NamedEntityGraphs({ @NamedEntityGraph(name = "Rollout.ds", attributeNodes = { @NamedAttributeNode("distributionSet") }) })
// exception squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
@SuppressWarnings("squid:S2160")
// squid:S2160 - BaseEntity equals/hashcode is handling correctly for sub entities
// java:S1710 - not possible to use without group annotation
@SuppressWarnings({ "squid:S2160", "java:S1710", "java:S1171", "java:S3599" })
public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, EventAwareEntity {
@Serial
@@ -226,7 +227,7 @@ public class JpaRollout extends AbstractJpaNamedEntity implements Rollout, Event
public static class RolloutStatusConverter extends MapAttributeConverter<RolloutStatus, Integer> {
public RolloutStatusConverter() {
super(new HashMap<>() {{
super(new EnumMap<>(RolloutStatus.class) {{
put(RolloutStatus.CREATING, 0);
put(RolloutStatus.READY, 1);
put(RolloutStatus.PAUSED, 2);

View File

@@ -567,6 +567,7 @@ public class JpaQueryRsqlVisitor<A extends Enum<A> & RsqlQueryField, T> extends
return childs;
}
@SuppressWarnings("java:S1221") // java:S1221 - intentionally to match the SQL wording
private Predicate equal(final Expression<String> expressionToCompare, final String sqlValue) {
return cb.equal(caseWise(cb, expressionToCompare), caseWise(sqlValue));
}

View File

@@ -288,13 +288,12 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
return fieldPath;
}
// if root.get creates a join we call join directly in order to specify LEFT JOIN type,
// to include rows for missing in particular table / criteria (root.get creates INNER JOIN)
// (see org.eclipse.persistence.internal.jpa.querydef.FromImpl implementation for more details)
// otherwise delegate to root.get
// if root.get creates a join we call join directly in order to specify LEFT JOIN type, to include rows for missing in particular
// table / criteria (root.get creates INNER JOIN) (see org.eclipse.persistence.internal.jpa.querydef.FromImpl implementation
// for more details) otherwise delegate to root.get
@SuppressWarnings("java:S1066") // java:S1066 - better reading this way
private Path<?> getPath(final Root<?> root, final String fieldNameSplit) {
// see org.eclipse.persistence.internal.jpa.querydef.FromImpl implementation for more details
// when root.get creates a join
// see org.eclipse.persistence.internal.jpa.querydef.FromImpl implementation for more details when root.get creates a join
final Attribute<?, ?> attribute = root.getModel().getAttribute(fieldNameSplit);
if (!attribute.isCollection()) {
// it is a SingularAttribute and not join if it is of basic persistent type
@@ -393,7 +392,7 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
}
return enumField.getSubEntityMapTuple()
.map(Entry::getValue)
.map(valueFieldName -> fieldPath.<String> get(valueFieldName))
.map(fieldPath::<String>get)
.orElseThrow(() ->
new UnsupportedOperationException(
"For the fields, defined as Map, only Map java type or tuple in the form of SimpleImmutableEntry are allowed." +
@@ -434,6 +433,7 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
return children;
}
@SuppressWarnings("java:S1221") // java:S1221 - intentionally to match the SQL wording
private Predicate equal(final Path<String> expressionToCompare, final String sqlValue) {
if (caseWise(expressionToCompare)) {
return cb.equal(cb.upper(expressionToCompare), sqlValue.toUpperCase());

View File

@@ -38,11 +38,11 @@ import org.springframework.data.domain.Slice;
@Feature("Component Tests - Repository")
@Story("Multi Tenancy")
@ExtendWith(DisposableSqlTestDatabaseExtension.class)
public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
@Test
@Description(value = "Ensures that multiple targets with same controller-ID can be created for different tenants.")
public void createMultipleTargetsWithSameIdForDifferentTenant() throws Exception {
void createMultipleTargetsWithSameIdForDifferentTenant() throws Exception {
// known controller ID for overall tenants same
final String knownControllerId = "controllerId";
@@ -64,9 +64,9 @@ public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
}
@Test
@Description(value = "Ensures that targtes created by a tenant are not visible by another tenant.")
@Description(value = "Ensures that targets created by a tenant are not visible by another tenant.")
@WithUser(tenantId = "mytenant", allSpPermissions = true)
public void queryTargetFromDifferentTenantIsNotVisible() throws Exception {
void queryTargetFromDifferentTenantIsNotVisible() throws Exception {
// create target for another tenant
final String anotherTenant = "anotherTenant";
final String controllerAnotherTenant = "anotherController";
@@ -86,7 +86,7 @@ public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
@Test
@Description(value = "Ensures that tenant with proper permissions can read and delete other tenants.")
@WithUser(tenantId = "mytenant", allSpPermissions = true)
public void deleteAnotherTenantPossible() throws Exception {
void deleteAnotherTenantPossible() throws Exception {
// create target for another tenant
final String anotherTenant = "anotherTenant";
final String controllerAnotherTenant = "anotherController";
@@ -102,7 +102,7 @@ public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
@Test
@Description(value = "Ensures that tenant metadata is retrieved for the current tenant.")
@WithUser(tenantId = "mytenant", autoCreateTenant = false, allSpPermissions = true)
public void getTenanatMetdata() throws Exception {
void getTenanatMetdata() throws Exception {
// logged in tenant mytenant - check if tenant default data is
// autogenerated
@@ -122,7 +122,7 @@ public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
@Test
@Description(value = "Ensures that targets created from a different tenant cannot be deleted from other tenants")
@WithUser(tenantId = "mytenant", allSpPermissions = true)
public void deleteTargetFromOtherTenantIsNotPossible() throws Exception {
void deleteTargetFromOtherTenantIsNotPossible() throws Exception {
// create target for another tenant
final String anotherTenant = "anotherTenant";
final String controllerAnotherTenant = "anotherController";
@@ -147,7 +147,7 @@ public class MultiTenancyEntityTest extends AbstractJpaIntegrationTest {
@Test
@Description(value = "Ensures that multiple distribution sets with same name and version can be created for different tenants.")
public void createMultipleDistributionSetsWithSameNameForDifferentTenants() throws Exception {
void createMultipleDistributionSetsWithSameNameForDifferentTenants() throws Exception {
// known tenant names
final String tenant = "aTenant";