Merge branch 'master' into feature_enable_push_in_deployment_view
This commit is contained in:
@@ -31,8 +31,6 @@ import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.eclipse.persistence.config.PersistenceUnitProperties;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
@@ -214,7 +212,6 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = { "tenantMetadata" }, key = "#tenant.toUpperCase()", cacheManager = "directCacheManager")
|
||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||
@Modifying
|
||||
public void deleteTenant(final String tenant) {
|
||||
@@ -241,7 +238,6 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = "tenantMetadata", keyGenerator = "tenantKeyGenerator", cacheManager = "directCacheManager")
|
||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||
@Modifying
|
||||
public TenantMetaData getTenantMetadata() {
|
||||
@@ -276,7 +272,6 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
}
|
||||
|
||||
@Override
|
||||
@CachePut(value = "tenantMetadata", key = "#metaData.tenant.toUpperCase()", cacheManager = "directCacheManager")
|
||||
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
|
||||
@Modifying
|
||||
public TenantMetaData updateTenantMetadata(final TenantMetaData metaData) {
|
||||
|
||||
@@ -37,6 +37,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
@Features("Component Tests - Repository")
|
||||
@Stories("RSQL filter target")
|
||||
public class RSQLTargetFieldTest extends AbstractJpaIntegrationTest {
|
||||
private static final long LAST_TARGET_QUERY = 10000;
|
||||
private static final long LAST_TARGET_QUERY_SMALLER = 1000;
|
||||
|
||||
@Before
|
||||
public void seuptBeforeTest() {
|
||||
@@ -48,14 +50,16 @@ public class RSQLTargetFieldTest extends AbstractJpaIntegrationTest {
|
||||
final TargetInfo targetInfo = target.getTargetInfo();
|
||||
targetInfo.getControllerAttributes().put("revision", "1.1");
|
||||
((JpaTargetInfo) target.getTargetInfo()).setUpdateStatus(TargetUpdateStatus.PENDING);
|
||||
|
||||
((JpaTargetInfo) target.getTargetInfo()).setLastTargetQuery(LAST_TARGET_QUERY);
|
||||
targetManagement.createTarget(target);
|
||||
|
||||
final JpaTarget target2 = new JpaTarget("targetId1234");
|
||||
target2.setDescription("targetId1234");
|
||||
final TargetInfo targetInfo2 = new JpaTargetInfo(target2);
|
||||
final TargetInfo targetInfo2 = target2.getTargetInfo();
|
||||
targetInfo2.getControllerAttributes().put("revision", "1.2");
|
||||
target2.setTargetInfo(targetInfo2);
|
||||
((JpaTargetInfo) target2.getTargetInfo()).setLastTargetQuery(LAST_TARGET_QUERY_SMALLER);
|
||||
targetManagement.createTarget(target2);
|
||||
|
||||
targetManagement.createTarget(new JpaTarget("targetId1235"));
|
||||
targetManagement.createTarget(new JpaTarget("targetId1236"));
|
||||
|
||||
@@ -166,6 +170,17 @@ public class RSQLTargetFieldTest extends AbstractJpaIntegrationTest {
|
||||
assertRSQLQuery(TargetFields.TAG.name() + "=out=(Tag1,notexist)", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Test filter target by lastTargetQuery")
|
||||
public void testFilterByLastTargetQuery() {
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "==" + LAST_TARGET_QUERY, 1);
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "!=" + LAST_TARGET_QUERY, 1);
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "=lt=" + LAST_TARGET_QUERY, 1);
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "=lt=" + LAST_TARGET_QUERY_SMALLER, 0);
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "=gt=" + LAST_TARGET_QUERY_SMALLER, 1);
|
||||
assertRSQLQuery(TargetFields.LASTCONTROLLERREQUESTAT.name() + "=gt=" + LAST_TARGET_QUERY, 0);
|
||||
}
|
||||
|
||||
private void assertRSQLQuery(final String rsqlParam, final long expcetedTargets) {
|
||||
final Page<Target> findTargetPage = targetManagement.findTargetsAll(rsqlParam, new PageRequest(0, 100));
|
||||
final long countTargetsAll = findTargetPage.getTotalElements();
|
||||
|
||||
Reference in New Issue
Block a user