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.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)
@SpringApplicationConfiguration(classes = { ArtifactStoreAutoConfiguration.class, TestConfiguration.class })
public class ArtifactStoreTest {

View File

@@ -29,6 +29,11 @@ import org.springframework.hateoas.Identifiable;
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)
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.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 {
@Test

View File

@@ -21,6 +21,11 @@ import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.eventbus.EventBus;
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)
public class EventBusSubscriberProcessorTest {

View File

@@ -47,8 +47,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
*
* Test Amqp controller authentfication.
*/
@Features("AMQP Authenfication Test")
@Stories("Tests the authenfication")
@Features("Component Tests - Device Management Federation API")
@Stories("AmqpController Authentfication Test")
public class AmqpControllerAuthentficationTest {
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;
@ActiveProfiles({ "test" })
@Features("AMQP Dispatcher Test")
@Stories("Tests send messages")
@Features("Component Tests - Device Management Federation API")
@Stories("AmqpMessage Dispatcher Service Test")
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB {
private AmqpMessageDispatcherService amqpMessageDispatcherService;

View File

@@ -68,8 +68,8 @@ import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class)
@Features("AMQP Controller Test")
@Stories("Tests the servcies for message handler and dispatcher")
@Features("Component Tests - Device Management Federation API")
@Stories("AmqpMessage Handler Service Test")
public class AmqpMessageHandlerServiceTest {
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.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)
public class PreAuthTokenSourceTrustAuthenticationProviderTest {

View File

@@ -12,6 +12,11 @@ import static org.fest.assertions.api.Assertions.assertThat;
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 {
@Test

View File

@@ -26,6 +26,11 @@ import org.springframework.cache.CacheManager;
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)
public class CacheWriteNotifyTest {

View File

@@ -27,6 +27,11 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
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)
public class CacheFieldEntityListenerTest {

View File

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

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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter actions")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter distribution set")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter distribution set metadata")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter rollout group")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter software module")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter software module metadata")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter software module test type")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter target and distribution set tags")
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.Stories;
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL filter target")
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;
@RunWith(MockitoJUnitRunner.class)
@Features("Component Tests - RSQL filtering")
@Features("Component Tests - Repository")
@Stories("RSQL search utility")
// TODO: fully document tests -> @Description for long text and reasonable
// 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 java.util.concurrent.Callable;
import org.eclipse.hawkbit.AbstractIntegrationTest;
import org.eclipse.hawkbit.WithSpringAuthorityRule;
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
* belonging to the current tenant.
*
*
*
*
*/
@Features("Component Tests - Repository")
@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
// in bumlux and not
// mytenant
assertThat(
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"), new Callable<String>() {
@Override
public String call() throws Exception {
return systemManagement.getTenantMetadata().getTenant().toUpperCase();
}
})).isEqualTo("bumlux".toUpperCase());
assertThat(securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"),
() -> systemManagement.getTenantMetadata().getTenant().toUpperCase()))
.isEqualTo("bumlux".toUpperCase());
}
@Test
@@ -154,59 +145,38 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
}
private Target createTargetForTenant(final String controllerId, final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Target>() {
@Override
public Target call() throws Exception {
return targetManagement.createTarget(new Target(controllerId));
}
});
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
() -> targetManagement.createTarget(new Target(controllerId)));
}
private Slice<Target> findTargetsForTenant(final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
new Callable<Slice<Target>>() {
@Override
public Slice<Target> call() throws Exception {
return targetManagement.findTargetsAll(pageReq);
}
});
() -> targetManagement.findTargetsAll(pageReq));
}
private void deleteTargetsForTenant(final String tenant, final Long... targetIds) throws Exception {
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Void>() {
@Override
public Void call() throws Exception {
targetManagement.deleteTargets(targetIds);
return null;
}
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
targetManagement.deleteTargets(targetIds);
return null;
});
}
private DistributionSet createDistributionSetForTenant(final String name, final String version, final String tenant)
throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
new Callable<DistributionSet>() {
@Override
public DistributionSet call() throws Exception {
final DistributionSet ds = new DistributionSet();
ds.setName(name);
ds.setTenant(tenant);
ds.setVersion(version);
ds.setType(distributionSetManagement
.createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
return distributionSetManagement.createDistributionSet(ds);
}
});
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
final DistributionSet ds = new DistributionSet();
ds.setName(name);
ds.setTenant(tenant);
ds.setVersion(version);
ds.setType(distributionSetManagement
.createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
return distributionSetManagement.createDistributionSet(ds);
});
}
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
new Callable<Page<DistributionSet>>() {
@Override
public Page<DistributionSet> call() throws Exception {
return distributionSetManagement.findDistributionSetsAll(pageReq, false, false);
}
});
() -> 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)));
}
// TODO
@Test
@Description("Start the rollout in async mode")
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,
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;
/**
*
* Spring MVC Tests against the TargetResource.
*
*
*
*/
@Features("Component Tests - Management API")
@Stories("Target Resource")

View File

@@ -13,6 +13,11 @@ import java.security.NoSuchAlgorithmException;
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 {
@Test

View File

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