Features harmonised, more test descriptions

This commit is contained in:
Kai Zimmermann
2016-02-23 09:57:18 +01:00
parent a9f91e90da
commit 7f2a9d1ed2
28 changed files with 124 additions and 130 deletions

View File

@@ -34,6 +34,11 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
import com.mongodb.gridfs.GridFSDBFile; import com.mongodb.gridfs.GridFSDBFile;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - Repository")
@Stories("Artifact Store MongoDB")
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { ArtifactStoreAutoConfiguration.class, TestConfiguration.class }) @SpringApplicationConfiguration(classes = { ArtifactStoreAutoConfiguration.class, TestConfiguration.class })
public class ArtifactStoreTest { public class ArtifactStoreTest {

View File

@@ -29,6 +29,11 @@ import org.springframework.hateoas.Identifiable;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Cluster Cache")
@Stories("EventDistributor Test")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class EventDistributorTest { public class EventDistributorTest {

View File

@@ -13,6 +13,11 @@ import static org.fest.assertions.api.Assertions.assertThat;
import org.eclipse.hawkbit.cache.RedisProperties; import org.eclipse.hawkbit.cache.RedisProperties;
import org.junit.Test; import org.junit.Test;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Cluster Cache")
@Stories("Redis Properties Test")
public class RedisPropertiesTest { public class RedisPropertiesTest {
@Test @Test

View File

@@ -21,6 +21,11 @@ import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Cluster Event Bus")
@Stories("EventBus Subscriber Processor Test")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class EventBusSubscriberProcessorTest { public class EventBusSubscriberProcessorTest {

View File

@@ -47,8 +47,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
* *
* Test Amqp controller authentfication. * Test Amqp controller authentfication.
*/ */
@Features("AMQP Authenfication Test") @Features("Component Tests - Device Management Federation API")
@Stories("Tests the authenfication") @Stories("AmqpController Authentfication Test")
public class AmqpControllerAuthentficationTest { public class AmqpControllerAuthentficationTest {
private static final String TENANT = "DEFAULT"; private static final String TENANT = "DEFAULT";

View File

@@ -53,8 +53,8 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@ActiveProfiles({ "test" }) @ActiveProfiles({ "test" })
@Features("AMQP Dispatcher Test") @Features("Component Tests - Device Management Federation API")
@Stories("Tests send messages") @Stories("AmqpMessage Dispatcher Service Test")
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB { public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB {
private AmqpMessageDispatcherService amqpMessageDispatcherService; private AmqpMessageDispatcherService amqpMessageDispatcherService;

View File

@@ -68,8 +68,8 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@Features("AMQP Controller Test") @Features("Component Tests - Device Management Federation API")
@Stories("Tests the servcies for message handler and dispatcher") @Stories("AmqpMessage Handler Service Test")
public class AmqpMessageHandlerServiceTest { public class AmqpMessageHandlerServiceTest {
private static final String TENANT = "DEFAULT"; private static final String TENANT = "DEFAULT";

View File

@@ -20,6 +20,11 @@ import org.springframework.security.authentication.InsufficientAuthenticationExc
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Security")
@Stories("PreAuthToken Source TrustAuthentication Provider Test")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class PreAuthTokenSourceTrustAuthenticationProviderTest { public class PreAuthTokenSourceTrustAuthenticationProviderTest {

View File

@@ -12,6 +12,11 @@ import static org.fest.assertions.api.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Repository")
@Stories("CacheKeys")
public class CacheKeysTest { public class CacheKeysTest {
@Test @Test

View File

@@ -26,6 +26,11 @@ import org.springframework.cache.CacheManager;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Repository")
@Stories("CacheWriteNotify")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class CacheWriteNotifyTest { public class CacheWriteNotifyTest {

View File

@@ -27,6 +27,11 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.hateoas.Identifiable; import org.springframework.hateoas.Identifiable;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Repository")
@Stories("EventBus")
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class CacheFieldEntityListenerTest { public class CacheFieldEntityListenerTest {

View File

@@ -34,13 +34,9 @@ import ru.yandex.qatools.allure.annotations.Stories;
/** /**
* Test class for {@link TagManagement}. * Test class for {@link TagManagement}.
* *
*
*
*/ */
@Features("Component Tests - Repository") @Features("Component Tests - Repository")
@Stories("Tag Management") @Stories("Tag Management")
// TODO: fully document tests -> @Description for long text and reasonable
// method name as short text
public class TagManagementTest extends AbstractIntegrationTest { public class TagManagementTest extends AbstractIntegrationTest {
public TagManagementTest() { public TagManagementTest() {
LOG = LoggerFactory.getLogger(TagManagementTest.class); LOG = LoggerFactory.getLogger(TagManagementTest.class);
@@ -155,13 +151,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
return new DistributionSetFilterBuilder(); return new DistributionSetFilterBuilder();
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#findTargetTag(java.lang.String)}
* .
*/
@Test @Test
public void testFindTargetTag() { @Description("Ensures that all tags are retrieved through repository.")
public void findAllTargetTags() {
assertThat(targetTagRepository.findAll()).isEmpty(); assertThat(targetTagRepository.findAll()).isEmpty();
final List<TargetTag> tags = createTargetsWithTags(); final List<TargetTag> tags = createTargetsWithTags();
@@ -170,13 +162,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
.hasSize(20); .hasSize(20);
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#createTargetTag(org.eclipse.hawkbit.repository.model.TargetTag)}
* .
*/
@Test @Test
public void testCreateTargetTag() { @Description("Ensures that a created tag is persisted in the repository as defined.")
public void createTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty(); assertThat(targetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour")); final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour"));
@@ -186,13 +174,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour"); assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour");
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#deleteTargetTag(java.lang.String[])}
* .
*/
@Test @Test
public void testDeleteTargetTagsStringArray() { @Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteTargetTas() {
assertThat(targetTagRepository.findAll()).isEmpty(); assertThat(targetTagRepository.findAll()).isEmpty();
// create test data // create test data
@@ -217,7 +201,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
} }
@Test @Test
@Description("Tests the creation of a target tag.") @Description("Tests the name update of a target tag.")
public void updateTargetTag() { public void updateTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty(); assertThat(targetTagRepository.findAll()).isEmpty();
@@ -237,13 +221,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2); assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2);
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#createDistributionSetTag(org.eclipse.hawkbit.repository.model.DistributionSetTag)}
* .
*/
@Test @Test
public void testCreateDistributionSetTag() { @Description("Ensures that a created tag is persisted in the repository as defined.")
public void createDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty(); assertThat(distributionSetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour")); final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour"));
@@ -253,13 +233,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour"); assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour");
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#createDistributionSetTags(java.lang.Iterable)}
* .
*/
@Test @Test
public void testCreateDistributionSetTags() { @Description("Ensures that a created tags are persisted in the repository as defined.")
public void createDistributionSetTags() {
assertThat(distributionSetTagRepository.findAll()).isEmpty(); assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags(); final List<DistributionSetTag> tags = createDsSetsWithTags();
@@ -267,13 +243,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size()); assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size());
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#deleteDistributionSetTag(java.lang.String[])}
* .
*/
@Test @Test
public void testDeleteDistributionSetTag() { @Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty(); assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data // create test data
@@ -298,24 +270,40 @@ public class TagManagementTest extends AbstractIntegrationTest {
} }
@Test(expected = EntityAlreadyExistsException.class) @Test(expected = EntityAlreadyExistsException.class)
public void testFailedDuplicateTargetTagNameException() { @Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameException() {
tagManagement.createTargetTag(new TargetTag("A")); tagManagement.createTargetTag(new TargetTag("A"));
tagManagement.createTargetTag(new TargetTag("A")); tagManagement.createTargetTag(new TargetTag("A"));
} }
@Test(expected = EntityAlreadyExistsException.class) @Test(expected = EntityAlreadyExistsException.class)
public void testFailedDuplicateDsTagNameException() { @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameExceptionAfterUpdate() {
tagManagement.createTargetTag(new TargetTag("A"));
final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B"));
tag.setName("A");
tagManagement.updateTargetTag(tag);
}
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameException() {
tagManagement.createDistributionSetTag(new DistributionSetTag("A")); tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
tagManagement.createDistributionSetTag(new DistributionSetTag("A")); tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
} }
/** @Test(expected = EntityAlreadyExistsException.class)
* Test method for @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
* {@link org.eclipse.hawkbit.repository.TagManagement#updateDistributionSetTag(org.eclipse.hawkbit.repository.model.DistributionSetTag)} public void failedDuplicateDsTagNameExceptionAfterUpdate() {
* . tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
*/ final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B"));
tag.setName("A");
tagManagement.updateDistributionSetTag(tag);
}
@Test @Test
public void testUpdateDistributionSetTag() { @Description("Tests the name update of a target tag.")
public void updateDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty(); assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data // create test data
@@ -333,13 +321,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123"); assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123");
} }
/**
* Test method for
* {@link org.eclipse.hawkbit.repository.TagManagement#findAllDistributionSetTags()}
* .
*/
@Test @Test
public void testFindDistributionSetTagsAll() { @Description("Ensures that all tags are retrieved through repository.")
public void findDistributionSetTagsAll() {
assertThat(distributionSetTagRepository.findAll()).isEmpty(); assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags(); final List<DistributionSetTag> tags = createDsSetsWithTags();

View File

@@ -47,7 +47,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
final TargetTag targTagC = tagManagement.createTargetTag(new TargetTag("TargTag-C")); final TargetTag targTagC = tagManagement.createTargetTag(new TargetTag("TargTag-C"));
final TargetTag targTagD = tagManagement.createTargetTag(new TargetTag("TargTag-D")); final TargetTag targTagD = tagManagement.createTargetTag(new TargetTag("TargTag-D"));
// TODO kzimmerm: test also installedDS (not only assignedDS) // TODO kaizimmerm: test also installedDS (not only assignedDS)
final DistributionSet setA = TestDataUtil.generateDistributionSet("", softwareManagement, final DistributionSet setA = TestDataUtil.generateDistributionSet("", softwareManagement,
distributionSetManagement); distributionSetManagement);
@@ -90,7 +90,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
final PageRequest pageReq = new PageRequest(0, 500); final PageRequest pageReq = new PageRequest(0, 500);
// try to find several targets with different filter settings // try to find several targets with different filter settings
// TODO kzimmerm: comment and check also the content itself, not only // TODO kaizimmerm: comment and check also the content itself, not only
// the numbers // the numbers
// (containsOnly) // (containsOnly)
assertThat(targetManagement.countTargetsAll()).isEqualTo(400); assertThat(targetManagement.countTargetsAll()).isEqualTo(400);
@@ -185,7 +185,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
} }
// TODO kzimmerm: add filter tests // TODO kaizimmerm: add filter tests
@Test @Test
@Description("Tests the correct order of targets based on selected distribution set. The system expects to have an order based on installed, assigned DS.") @Description("Tests the correct order of targets based on selected distribution set. The system expects to have an order based on installed, assigned DS.")
public void targetSearchWithVariousFilterCombinationsAndOrderByDistributionSet() { public void targetSearchWithVariousFilterCombinationsAndOrderByDistributionSet() {

View File

@@ -26,7 +26,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter actions") @Stories("RSQL filter actions")
public class RSQLActionFieldsTest extends AbstractIntegrationTest { public class RSQLActionFieldsTest extends AbstractIntegrationTest {

View File

@@ -28,7 +28,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter distribution set") @Stories("RSQL filter distribution set")
public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest { public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest {

View File

@@ -24,7 +24,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter distribution set metadata") @Stories("RSQL filter distribution set metadata")
public class RSQLDistributionSetMetadataFieldsTest extends AbstractIntegrationTest { public class RSQLDistributionSetMetadataFieldsTest extends AbstractIntegrationTest {

View File

@@ -27,7 +27,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter rollout group") @Stories("RSQL filter rollout group")
public class RSQLRolloutGroupFields extends AbstractIntegrationTest { public class RSQLRolloutGroupFields extends AbstractIntegrationTest {

View File

@@ -23,7 +23,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter software module") @Stories("RSQL filter software module")
public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest { public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest {

View File

@@ -24,7 +24,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter software module metadata") @Stories("RSQL filter software module metadata")
public class RSQLSoftwareModuleMetadataFieldsTest extends AbstractIntegrationTest { public class RSQLSoftwareModuleMetadataFieldsTest extends AbstractIntegrationTest {

View File

@@ -21,7 +21,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter software module test type") @Stories("RSQL filter software module test type")
public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest { public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest {

View File

@@ -23,7 +23,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter target and distribution set tags") @Stories("RSQL filter target and distribution set tags")
public class RSQLTagFieldsTest extends AbstractIntegrationTest { public class RSQLTagFieldsTest extends AbstractIntegrationTest {

View File

@@ -30,7 +30,7 @@ import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL filter target") @Stories("RSQL filter target")
public class RSQLTargetFieldTest extends AbstractIntegrationTest { public class RSQLTargetFieldTest extends AbstractIntegrationTest {

View File

@@ -40,7 +40,7 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@Features("Component Tests - RSQL filtering") @Features("Component Tests - Repository")
@Stories("RSQL search utility") @Stories("RSQL search utility")
// TODO: fully document tests -> @Description for long text and reasonable // TODO: fully document tests -> @Description for long text and reasonable
// method name as short text // method name as short text

View File

@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.tenancy;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import java.util.concurrent.Callable;
import org.eclipse.hawkbit.AbstractIntegrationTest; import org.eclipse.hawkbit.AbstractIntegrationTest;
import org.eclipse.hawkbit.WithSpringAuthorityRule; import org.eclipse.hawkbit.WithSpringAuthorityRule;
import org.eclipse.hawkbit.WithUser; import org.eclipse.hawkbit.WithUser;
@@ -31,9 +29,6 @@ import ru.yandex.qatools.allure.annotations.Stories;
* CRUD-Operations are tenant aware and cannot access or delete entities not * CRUD-Operations are tenant aware and cannot access or delete entities not
* belonging to the current tenant. * belonging to the current tenant.
* *
*
*
*
*/ */
@Features("Component Tests - Repository") @Features("Component Tests - Repository")
@Stories("Multi Tenancy") @Stories("Multi Tenancy")
@@ -97,13 +92,9 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
// check that the cache is not getting in the way, i.e. "bumlux" results // check that the cache is not getting in the way, i.e. "bumlux" results
// in bumlux and not // in bumlux and not
// mytenant // mytenant
assertThat( assertThat(securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"),
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"), new Callable<String>() { () -> systemManagement.getTenantMetadata().getTenant().toUpperCase()))
@Override .isEqualTo("bumlux".toUpperCase());
public String call() throws Exception {
return systemManagement.getTenantMetadata().getTenant().toUpperCase();
}
})).isEqualTo("bumlux".toUpperCase());
} }
@Test @Test
@@ -154,59 +145,38 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
} }
private Target createTargetForTenant(final String controllerId, final String tenant) throws Exception { private Target createTargetForTenant(final String controllerId, final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Target>() { return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
@Override () -> targetManagement.createTarget(new Target(controllerId)));
public Target call() throws Exception {
return targetManagement.createTarget(new Target(controllerId));
}
});
} }
private Slice<Target> findTargetsForTenant(final String tenant) throws Exception { private Slice<Target> findTargetsForTenant(final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
new Callable<Slice<Target>>() { () -> targetManagement.findTargetsAll(pageReq));
@Override
public Slice<Target> call() throws Exception {
return targetManagement.findTargetsAll(pageReq);
}
});
} }
private void deleteTargetsForTenant(final String tenant, final Long... targetIds) throws Exception { private void deleteTargetsForTenant(final String tenant, final Long... targetIds) throws Exception {
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Void>() { securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
@Override targetManagement.deleteTargets(targetIds);
public Void call() throws Exception { return null;
targetManagement.deleteTargets(targetIds);
return null;
}
}); });
} }
private DistributionSet createDistributionSetForTenant(final String name, final String version, final String tenant) private DistributionSet createDistributionSetForTenant(final String name, final String version, final String tenant)
throws Exception { throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
new Callable<DistributionSet>() { final DistributionSet ds = new DistributionSet();
@Override ds.setName(name);
public DistributionSet call() throws Exception { ds.setTenant(tenant);
final DistributionSet ds = new DistributionSet(); ds.setVersion(version);
ds.setName(name); ds.setType(distributionSetManagement
ds.setTenant(tenant); .createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
ds.setVersion(version); return distributionSetManagement.createDistributionSet(ds);
ds.setType(distributionSetManagement });
.createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
return distributionSetManagement.createDistributionSet(ds);
}
});
} }
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception { private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
new Callable<Page<DistributionSet>>() { () -> distributionSetManagement.findDistributionSetsAll(pageReq, false, false));
@Override
public Page<DistributionSet> call() throws Exception {
return distributionSetManagement.findDistributionSetsAll(pageReq, false, false);
}
});
} }
} }

View File

@@ -435,7 +435,6 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
.andExpect(jsonPath("$content", hasSize(5))).andExpect(jsonPath("$total", equalTo(5))); .andExpect(jsonPath("$content", hasSize(5))).andExpect(jsonPath("$total", equalTo(5)));
} }
// TODO
@Test @Test
@Description("Start the rollout in async mode") @Description("Start the rollout in async mode")
public void startingRolloutSwitchesIntoRunningStateAsync() throws Exception { public void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
@@ -528,7 +527,6 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
} }
// TODO copied code from sp-bic-test
protected <T> T doWithTimeout(final Callable<T> callable, final SuccessCondition<T> successCondition, protected <T> T doWithTimeout(final Callable<T> callable, final SuccessCondition<T> successCondition,
final long timeout, final long pollInterval) throws Exception // NOPMD final long timeout, final long pollInterval) throws Exception // NOPMD
{ {

View File

@@ -66,11 +66,8 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
/** /**
*
* Spring MVC Tests against the TargetResource. * Spring MVC Tests against the TargetResource.
* *
*
*
*/ */
@Features("Component Tests - Management API") @Features("Component Tests - Management API")
@Stories("Target Resource") @Stories("Target Resource")

View File

@@ -13,6 +13,11 @@ import java.security.NoSuchAlgorithmException;
import org.junit.Test; import org.junit.Test;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@Features("Unit Tests - Security")
@Stories("SecurityToken Generator Test")
public class SecurityTokenGeneratorTest { public class SecurityTokenGeneratorTest {
@Test @Test

View File

@@ -33,8 +33,8 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
@Features("IpUtil Test") @Features("Unit Tests - Security")
@Stories("Tests the created uris") @Stories("IP Util Test")
public class IpUtilTest { public class IpUtilTest {
@Mock @Mock