Merge pull request #50 from bsinno/harmonize-test-documentation
merging
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
|
||||
Please read this if you intend to contribute to the project.
|
||||
|
||||
## Code Conventions
|
||||
## Conventions
|
||||
|
||||
### Code Style
|
||||
|
||||
* Java files:
|
||||
* we follow the standard eclipse IDE (built in) code formatter with the following changes:
|
||||
@@ -19,6 +21,37 @@ Please read this if you intend to contribute to the project.
|
||||
* Sonarqube:
|
||||
* Our rule set is defined [here](http://sonar.eu-gb.mybluemix.net)
|
||||
|
||||
### Test documentation
|
||||
|
||||
Please documented the test cases that you contribute by means of [Allure](http://allure.qatools.ru) annotations and proper test method naming.
|
||||
|
||||
All test classes are documented with [Allure's](https://github.com/allure-framework/allure-core/wiki/Features-and-Stories) **@Features** and **@Stories** annotations in the following format:
|
||||
```
|
||||
@Features("TEST_TYPE - HAWKBIT_COMPONENT")
|
||||
@Stories("Test class description")
|
||||
```
|
||||
|
||||
Test types are:
|
||||
* Unit Tests - for single units tests with a mocked environment
|
||||
* Component Tests - for complete components including lower layers, e.g. Spring MVC test on rest API including repository and database.
|
||||
* Integration Tests - including clients, e.g. Selenium UI tests with various browsers.
|
||||
* System Tests - on target environments, e.g. Cloud Foundry.
|
||||
|
||||
Examples for hawkBit components:
|
||||
* Management API
|
||||
* Direct Device Integration API
|
||||
* Device Management Federation API
|
||||
* Management UI
|
||||
* Repository
|
||||
* Security
|
||||
|
||||
```
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Distribution Set Type Resource")
|
||||
```
|
||||
|
||||
In addition all test method's name describes in **camel case** what the test is all about and has a long description aith Allures **@Description** annotation.
|
||||
|
||||
## Legal considerations for your contribution
|
||||
|
||||
The following steps are necessary to comply with the Eclipse Foundation's IP policy.
|
||||
|
||||
@@ -34,6 +34,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.mongodb.gridfs.GridFSDBFile;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
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 {
|
||||
@@ -48,6 +54,7 @@ public class ArtifactStoreTest {
|
||||
private GridFsOperations gridFs;
|
||||
|
||||
@Test
|
||||
@Description("Ensures that storage in MongoDB is correctly executed.s")
|
||||
public void storeArtifactInMongoDB() {
|
||||
final int filelengthBytes = 128;
|
||||
final String filename = "testfile.json";
|
||||
@@ -60,6 +67,7 @@ public class ArtifactStoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that search by SHA1 hash (which is used by hawkBit as artifact ID) finds the expected results.")
|
||||
public void findArtifactBySHA1Hash() throws NoSuchAlgorithmException {
|
||||
final int filelengthBytes = 128;
|
||||
final String filename = "testfile.json";
|
||||
@@ -72,6 +80,7 @@ public class ArtifactStoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that search by MD5 hash finds the expected results.")
|
||||
public void findArtifactByMD5Hash() throws NoSuchAlgorithmException {
|
||||
final int filelengthBytes = 128;
|
||||
final String filename = "testfile.json";
|
||||
@@ -84,6 +93,7 @@ public class ArtifactStoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that artifact content can be read through InputStream.")
|
||||
public void getInputStreamFromArtifact() throws IOException {
|
||||
final int filelengthBytes = 128;
|
||||
final String filename = "testfile.json";
|
||||
@@ -103,7 +113,8 @@ public class ArtifactStoreTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteArtifactWithOnlyOneTenantLast() throws NoSuchAlgorithmException {
|
||||
@Description("Ensures that artifact delete actually results in deletion from database.")
|
||||
public void deleteArtifact() throws NoSuchAlgorithmException {
|
||||
final int filelengthBytes = 128;
|
||||
final String filename = "testfile.json";
|
||||
final String contentType = "application/json";
|
||||
|
||||
@@ -29,7 +29,13 @@ 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)
|
||||
// TODO: create description annotations
|
||||
public class EventDistributorTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -21,7 +21,13 @@ 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)
|
||||
// TODO: create description annotations
|
||||
public class EventBusSubscriberProcessorTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -46,11 +46,11 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
*
|
||||
* Test Amqp controller authentfication.
|
||||
* Test Amqp controller authentication.
|
||||
*/
|
||||
@Features("AMQP Authenfication Test")
|
||||
@Stories("Tests the authenfication")
|
||||
public class AmqpControllerAuthentficationTest {
|
||||
@Features("Component Tests - Device Management Federation API")
|
||||
@Stories("AmqpController Authentication Test")
|
||||
public class AmqpControllerAuthenticationTest {
|
||||
|
||||
private static final String TENANT = "DEFAULT";
|
||||
private static String CONTROLLLER_ID = "123";
|
||||
@@ -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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -20,7 +20,13 @@ 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)
|
||||
// TODO: create description annotations
|
||||
public class PreAuthTokenSourceTrustAuthenticationProviderTest {
|
||||
|
||||
private static final String REQUEST_SOURCE_IP = "127.0.0.1";
|
||||
|
||||
@@ -365,7 +365,7 @@ public class DeploymentManagement {
|
||||
}).collect(Collectors.toList())).stream()
|
||||
.collect(Collectors.toMap(a -> a.getTarget().getControllerId(), Function.identity()));
|
||||
|
||||
// MECS-720 create initial action status when action is created so we
|
||||
// create initial action status when action is created so we
|
||||
// remember the initial
|
||||
// running status because we will change the status of the action itself
|
||||
// and with this action
|
||||
|
||||
@@ -294,8 +294,7 @@ public class DistributionSetManagement {
|
||||
// hard delete the rest if exixts
|
||||
if (!toHardDelete.isEmpty()) {
|
||||
// don't give the delete statement an empty list, JPA/Oracle cannot
|
||||
// handle the empty list,
|
||||
// see MECS-403
|
||||
// handle the empty list
|
||||
distributionSetRepository.deleteByIdIn(toHardDelete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,7 +280,7 @@ public class SystemManagement implements EnvironmentAware {
|
||||
* @return {@code true} in case the tenant exits or {@code false} if not
|
||||
*/
|
||||
@Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator")
|
||||
// MECS-903 set transaction to not supported, due we call this in
|
||||
// set transaction to not supported, due we call this in
|
||||
// BaseEntity#prePersist methods
|
||||
// and it seems that JPA committing the transaction when executing this
|
||||
// transactional method,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -14,10 +14,16 @@ import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Unit Tests - Repository")
|
||||
@Stories("Deployment Management")
|
||||
public class ActionTest {
|
||||
|
||||
// issue MECS-670 timeforced update and eTAG calculation
|
||||
@Test
|
||||
@Description("Ensures that timeforced moded switch from soft to forces after defined timeframe.")
|
||||
public void timeforcedHitNewHasCodeIsGenerated() throws InterruptedException {
|
||||
|
||||
final boolean active = true;
|
||||
|
||||
@@ -25,9 +25,6 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
/**
|
||||
* Addition tests next to {@link ArtifactManagementTest} with no running MongoDB
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Repository")
|
||||
@Stories("Artifact Management")
|
||||
|
||||
@@ -145,7 +145,6 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Description("Test verifies that an assignment with automatic cancelation works correctly even if the update is split into multiple partitions on the database.")
|
||||
@Issue("MECS-674")
|
||||
public void multiAssigmentHistoryOverMultiplePagesResultsInTwoActiveAction() {
|
||||
|
||||
final DistributionSet cancelDs = TestDataUtil.generateDistributionSet("Canceled DS", "1.0", softwareManagement,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -427,8 +427,6 @@ public class RootController {
|
||||
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
||||
targetid, feedback.getStatus().getExecution());
|
||||
actionStatus.setStatus(Status.RUNNING);
|
||||
// MECS-400: we should not use the unstructed message list for
|
||||
// the server comment on the status.
|
||||
actionStatus.addMessage("Controller reported: " + feedback.getStatus().getExecution());
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
*/
|
||||
|
||||
@ActiveProfiles({ "im", "test" })
|
||||
@Features("Component Tests - Controller RESTful API")
|
||||
@Features("Component Tests - Direct Device Integration API")
|
||||
@Stories("Artifact Download Resource")
|
||||
public class ArtifactDownloadTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@ActiveProfiles({ "im", "test" })
|
||||
@Features("Component Tests - Controller RESTful API")
|
||||
@Features("Component Tests - Direct Device Integration API")
|
||||
@Stories("Cancel Action Resource")
|
||||
public class CancelActionTest extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@ActiveProfiles({ "im", "test" })
|
||||
@Features("Component Tests - Controller RESTful API")
|
||||
@Features("Component Tests - Direct Device Integration API")
|
||||
@Stories("Config Data Resource")
|
||||
public class ConfigDataTest extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@ActiveProfiles({ "im", "test" })
|
||||
@Features("Component Tests - Controller RESTful API")
|
||||
@Features("Component Tests - Direct Device Integration API")
|
||||
@Stories("Deployment Action Resource")
|
||||
public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
|
||||
@@ -45,13 +45,11 @@ import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@ActiveProfiles({ "im", "test" })
|
||||
@Features("Component Tests - Controller RESTful API")
|
||||
@Features("Component Tests - Direct Device Integration API")
|
||||
@Stories("Root Poll Resource")
|
||||
// TODO: fully document tests -> @Description for long text and reasonable
|
||||
// method name as short text
|
||||
public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
@Test()
|
||||
@Test
|
||||
@Description("Ensures that targets cannot be created e.g. in plug'n play scenarios when tenant does not exists but can be created if the tenant exists.")
|
||||
@WithUser(tenantId = "tenantDoesNotExists", allSpPermissions = true, authorities = "ROLE_CONTROLLER", autoCreateTenant = false)
|
||||
public void targetCannotBeRegisteredIfTenantDoesNotExistsButWhenExists() throws Exception {
|
||||
@@ -73,6 +71,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that target poll request does not change audit data on the entity.")
|
||||
@WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET,
|
||||
SpPermission.CREATE_TARGET })
|
||||
public void targetPollDoesNotModifyAuditData() throws Exception {
|
||||
@@ -104,11 +103,13 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that server returns a not found response in case of empty controlloer ID.")
|
||||
public void rootRsWithoutId() throws Exception {
|
||||
mvc.perform(get("/controller/v1/")).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the system creates a new target in plug and play manner, i.e. target is authenticated but does not exist yet.")
|
||||
public void rootRsPlugAndPlay() throws Exception {
|
||||
|
||||
final long current = System.currentTimeMillis();
|
||||
@@ -133,6 +134,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that etag check results in not modified response if provided etag by client is identical to entity in repository.")
|
||||
public void rootRsNotModified() throws Exception {
|
||||
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||
@@ -197,6 +199,8 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the target state machine of a precomissioned target switches from "
|
||||
+ "UNKNOWN to REGISTERED when the target polls for the first time.")
|
||||
public void rootRsPrecommissioned() throws Exception {
|
||||
final Target target = new Target("4711");
|
||||
targetManagement.createTarget(target);
|
||||
@@ -219,6 +223,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the source IP address of the polling target is correctly stored in repository")
|
||||
public void rootRsPlugAndPlayIpAddress() throws Exception {
|
||||
// test
|
||||
final String knownControllerId1 = "0815";
|
||||
|
||||
@@ -47,7 +47,6 @@ import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.Description;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -59,15 +58,8 @@ import com.jayway.jsonpath.JsonPath;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Distribution Set Resource")
|
||||
// TODO: fully document tests -> @Description for long text and reasonable
|
||||
// method name as short text
|
||||
public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
@@ -235,6 +227,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that multi target assignment through API is reflected by the repository.")
|
||||
public void assignMultipleTargetsToDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||
@@ -255,9 +248,13 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
.andExpect(status().isOk()).andExpect(jsonPath("$.assigned", equalTo(knownTargetIds.length - 1)))
|
||||
.andExpect(jsonPath("$.alreadyAssigned", equalTo(1)))
|
||||
.andExpect(jsonPath("$.total", equalTo(knownTargetIds.length)));
|
||||
|
||||
assertThat(targetManagement.findTargetByAssignedDistributionSet(createdDs.getId(), pageReq).getContent())
|
||||
.as("Five targets in repository have DS assigned").hasSize(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned targets of DS are returned as reflected by the repository.")
|
||||
public void getAssignedTargetsOfDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final String knownTargetId = "knownTargetId1";
|
||||
@@ -273,6 +270,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that assigned targets of DS are returned as persisted in the repository.")
|
||||
public void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
|
||||
@@ -283,6 +281,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that installed targets of DS are returned as persisted in the repository.")
|
||||
public void getInstalledTargetsOfDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final String knownTargetId = "knownTargetId1";
|
||||
@@ -305,46 +304,50 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that DS in repository are listed with proper paging properties.")
|
||||
public void getDistributionSetsWithoutAddtionalRequestParameters() throws Exception {
|
||||
final int modules = 5;
|
||||
createDistributionSetsAlphabetical(modules);
|
||||
final int sets = 5;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(modules)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(modules)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(modules)));
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(sets)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(sets)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(sets)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that DS in repository are listed with proper paging results with paging limit parameter.")
|
||||
public void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
||||
final int modules = 5;
|
||||
final int sets = 5;
|
||||
final int limitSize = 1;
|
||||
createDistributionSetsAlphabetical(modules);
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(modules)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(sets)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(limitSize)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.")
|
||||
public void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int modules = 5;
|
||||
final int sets = 5;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = modules - offsetParam;
|
||||
createDistributionSetsAlphabetical(modules);
|
||||
final int expectedSize = sets - offsetParam;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(modules)))
|
||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(sets)))
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(modules)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(sets)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(expectedSize)))
|
||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||
@Description("Ensures that multiple DS requested are listed with expected payload.")
|
||||
public void getDistributionSets() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||
@@ -389,6 +392,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||
@Description("Ensures that single DS requested by ID is listed with expected payload.")
|
||||
public void getDistributionSet() throws Exception {
|
||||
final DistributionSet set = createTestDistributionSet(softwareManagement, distributionSetManagement);
|
||||
|
||||
@@ -420,6 +424,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
@Test
|
||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||
@Description("Ensures that multipe DS posted to API are created in the repository.")
|
||||
public void createDistributionSets() throws JSONException, Exception {
|
||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||
|
||||
@@ -534,7 +539,8 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteUnassignedistributionSet() throws Exception {
|
||||
@Description("Ensures that DS deletion request to API is reflected by the repository.")
|
||||
public void deleteUnassignedistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||
|
||||
@@ -553,7 +559,8 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteAssignedDistributionSet() throws Exception {
|
||||
@Description("Ensures that assigned DS deletion request to API is reflected by the repository by means of deleted flag set.")
|
||||
public void deleteAssignedDistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||
|
||||
@@ -574,6 +581,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that DS property update request to API is reflected by the repository.")
|
||||
public void updateDistributionSet() throws Exception {
|
||||
|
||||
// prepare test data
|
||||
@@ -601,6 +609,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.")
|
||||
public void invalidRequestsOnDistributionSetsResource() throws Exception {
|
||||
final DistributionSet set = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
||||
distributionSetManagement);
|
||||
@@ -642,6 +651,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that the metadata creation through API is reflected by the repository.")
|
||||
public void createMetadata() throws Exception {
|
||||
final DistributionSet testDS = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
||||
distributionSetManagement);
|
||||
@@ -674,6 +684,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a metadata update through API is reflected by the repository.")
|
||||
public void updateMetadata() throws Exception {
|
||||
// prepare and create metadata for update
|
||||
final String knownKey = "knownKey";
|
||||
@@ -700,6 +711,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a metadata entry deletion through API is reflected by the repository.")
|
||||
public void deleteMetadata() throws Exception {
|
||||
// prepare and create metadata for deletion
|
||||
final String knownKey = "knownKey";
|
||||
@@ -722,6 +734,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a metadata entry selection through API reflectes the repository content.")
|
||||
public void getSingleMetadata() throws Exception {
|
||||
// prepare and create metadata
|
||||
final String knownKey = "knownKey";
|
||||
@@ -737,6 +750,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a metadata entry paged list selection through API reflectes the repository content.")
|
||||
public void getPagedListofMetadata() throws Exception {
|
||||
|
||||
final int totalMetadata = 10;
|
||||
@@ -760,6 +774,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a DS search with query parameters returns the expected result.")
|
||||
public void searchDistributionSetRsql() throws Exception {
|
||||
final String dsSuffix = "test";
|
||||
final int amount = 10;
|
||||
@@ -776,11 +791,13 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
@Description("Ensures that a DS search with complete==true parameter returns only DS that are actually completely filled with mandatory modules.")
|
||||
public void filterDistributionSetComplete() throws Exception {
|
||||
final int amount = 10;
|
||||
TestDataUtil.generateDistributionSets(amount, softwareManagement, distributionSetManagement);
|
||||
distributionSetManagement.createDistributionSet(new DistributionSet("incomplete", "2", "incomplete",
|
||||
distributionSetManagement.findDistributionSetTypeByKey("ecl_os"), null));
|
||||
|
||||
final String rsqlFindLikeDs1OrDs2 = "complete==" + Boolean.TRUE;
|
||||
|
||||
@@ -790,6 +807,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a DS assigned target search with controllerId==1 parameter returns only the target with the given ID.")
|
||||
public void searchDistributionSetAssignedTargetsRsql() throws Exception {
|
||||
// prepare distribution set
|
||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||
@@ -815,6 +833,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a DS metadata filtered query with value==knownValue1 parameter returns only the metadata entries with that value.")
|
||||
public void searchDistributionSetMetadataRsql() throws Exception {
|
||||
final int totalMetadata = 10;
|
||||
final String knownKeyPrefix = "knownKey";
|
||||
|
||||
@@ -46,11 +46,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
/**
|
||||
* Test for {@link DistributionSetTypeResource}.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Distribution Set Type Resource")
|
||||
public class DistributionSetTypeResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@@ -30,11 +30,7 @@ import org.springframework.context.annotation.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests- Download Restful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Download Resource")
|
||||
public class DownloadResourceTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
/**
|
||||
* Tests for covering the {@link RolloutResource}.
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Rollout Resource")
|
||||
public class RolloutResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
|
||||
.andReturn();
|
||||
}
|
||||
|
||||
@Description("TODO")
|
||||
@Description("Ensures that the repository refuses to create rollout without a defined target filter set.")
|
||||
public void missingTargetFilterQueryInRollout() throws Exception {
|
||||
|
||||
final String targetFilterQuery = null;
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -23,13 +23,16 @@ import org.junit.Test;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
* Tests {@link SoftwareModuleResource} in case of missing MongoDB connection.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Download Resource")
|
||||
public class SMRessourceMisingMongoDbConnectionTest extends AbstractIntegrationTest {
|
||||
|
||||
@BeforeClass
|
||||
@@ -40,7 +43,8 @@ public class SMRessourceMisingMongoDbConnectionTest extends AbstractIntegrationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMissingMongoDbConnection() throws Exception {
|
||||
@Description("Ensures that the correct error code is returned in case MongoDB unavailable.")
|
||||
public void missingMongoDbConnectionResultsInErrorAtUpload() throws Exception {
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
||||
assertThat(artifactRepository.findAll()).hasSize(0);
|
||||
|
||||
@@ -67,7 +67,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
* Tests for {@link SoftwareModuleResource} {@link RestController}.
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Software Module Resource")
|
||||
public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
@@ -117,14 +117,6 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.rest.resource.SoftwareModuleResource#uploadArtifact(java.lang.Long, org.springframework.web.multipart.MultipartFile)}
|
||||
* .
|
||||
*
|
||||
* @throws Exception
|
||||
* if test fails
|
||||
*/
|
||||
@Test
|
||||
@Description("Tests the uppload of an artifact binary. The upload is executed and the content checked in the repository for completenes.")
|
||||
public void uploadArtifact() throws Exception {
|
||||
|
||||
@@ -43,11 +43,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
/**
|
||||
* Test for {@link SoftwareModuleTypeResource}.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Software Module Type Resource")
|
||||
public class SoftwareModuleTypeResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Sorting parameter")
|
||||
public class SortUtilityTest {
|
||||
private static final String SORT_PARAM_1 = "NAME:ASC";
|
||||
|
||||
@@ -40,7 +40,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - System Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("System Management Resource")
|
||||
public class SystemManagementResourceTest extends AbstractIntegrationTestWithMongoDB {
|
||||
|
||||
|
||||
@@ -68,16 +68,11 @@ import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
*
|
||||
* Spring MVC Tests against the TargetResource.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Component Tests - Management RESTful API")
|
||||
@Features("Component Tests - Management API")
|
||||
@Stories("Target Resource")
|
||||
// TODO: fully document tests -> @Description for long text and reasonable
|
||||
// method name as short text
|
||||
public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
|
||||
private static final String TARGET_DESCRIPTION_TEST = "created in test";
|
||||
@@ -105,10 +100,8 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
private static final String JSON_PATH_CONTROLLERID = JSON_PATH_ROOT + JSON_PATH_FIELD_CONTROLLERID;
|
||||
private static final String JSON_PATH_DESCRIPTION = JSON_PATH_ROOT + JSON_PATH_FIELD_DESCRIPTION;
|
||||
|
||||
// TODO kzimmerm: test *modified after entity change
|
||||
|
||||
@Test
|
||||
// MECS-1064
|
||||
@Description("Ensures that actions list is in exptected order.")
|
||||
public void getActionStatusReturnsCorrectType() throws Exception {
|
||||
final int limitSize = 2;
|
||||
final String knownTargetId = "targetId";
|
||||
@@ -140,6 +133,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that security token is not returned if user does not have READ_TARGET_SEC_TOKEN permission.")
|
||||
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
|
||||
public void securityTokenIsNotInResponseIfMissingPermission() throws Exception {
|
||||
|
||||
@@ -151,6 +145,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that security token is returned if user does have READ_TARGET_SEC_TOKEN permission.")
|
||||
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
|
||||
SpPermission.READ_TARGET_SEC_TOKEN })
|
||||
public void securityTokenIsInResponseWithCorrectPermission() throws Exception {
|
||||
@@ -163,6 +158,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that that IP address is in result as stored in the repository.")
|
||||
public void addressAndIpAddressInTargetResult() throws Exception {
|
||||
// prepare targets with IP
|
||||
final String knownControllerId1 = "0815";
|
||||
@@ -194,6 +190,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that actions history is returned as defined by filter status==pending,status==finished.")
|
||||
public void searchActionsRsql() throws Exception {
|
||||
|
||||
// prepare test
|
||||
@@ -226,6 +223,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that a deletion of an active action results in cancelation triggered.")
|
||||
public void cancelActionOK() throws Exception {
|
||||
// prepare test
|
||||
final Target tA = createTargetAndStartAction();
|
||||
@@ -249,7 +247,8 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cancelAnCancelActionIsNotAllowed() throws Exception {
|
||||
@Description("Ensures that method not allowed is returned if cancelation is triggered on already canceled action.")
|
||||
public void cancelAndCancelActionIsNotAllowed() throws Exception {
|
||||
// prepare test
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
@@ -301,6 +300,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that deletion is executed if permitted.")
|
||||
public void deleteTargetReturnsOK() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdDelete";
|
||||
targetManagement.createTarget(new Target(knownControllerId));
|
||||
@@ -313,6 +313,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that deletion is refused with not found if target does not exist.")
|
||||
public void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdDelete";
|
||||
|
||||
@@ -321,6 +322,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that update is refused with not found if target does not exist.")
|
||||
public void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdUpdate";
|
||||
mvc.perform(put(RestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId).content("{}")
|
||||
@@ -329,6 +331,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that target update request is reflected by repository.")
|
||||
public void updateTargetDescription() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewDescription = "a new desc updated over rest";
|
||||
@@ -353,6 +356,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that target query returns list of targets in defined format.")
|
||||
public void getTargetWithoutAddtionalRequestParameters() throws Exception {
|
||||
final int knownTargetAmount = 3;
|
||||
final String idA = "a";
|
||||
@@ -392,6 +396,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that target query returns list of targets in defined format in size reduced by given limit parameter.")
|
||||
public void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||
final int knownTargetAmount = 3;
|
||||
final int limitSize = 1;
|
||||
@@ -412,10 +417,10 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
||||
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].controllerId", equalTo(idA)))
|
||||
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].createdBy", equalTo("bumlux")))
|
||||
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].updateStatus", equalTo("unknown")));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Ensures that target query returns list of targets in defined format in size reduced by given limit and offset parameter.")
|
||||
public void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int knownTargetAmount = 5;
|
||||
final int offsetParam = 2;
|
||||
|
||||
@@ -15,10 +15,17 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Unit Tests - Management API")
|
||||
@Stories("Error Handling")
|
||||
public class ExceptionInfoTest {
|
||||
|
||||
@Test
|
||||
public void setterAndGetter() {
|
||||
@Description("Ensures that setters and getters match on teh payload.")
|
||||
public void setterAndGetterOnExceptionInfo() {
|
||||
final String knownExceptionClass = "hawkbit.test.exception.Class";
|
||||
final String knownErrorCode = "hawkbit.error.code.Known";
|
||||
final String knownMessage = "a known message";
|
||||
|
||||
@@ -15,14 +15,22 @@ import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Unit Tests - Management API")
|
||||
@Stories("Paged List Handling")
|
||||
public class PagedListTest {
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Description("Ensures that a null payload entitiy throws an exception.")
|
||||
public void createListWithNullContentThrowsException() {
|
||||
new PagedList<>(null, 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Create list with payload and verify content.")
|
||||
public void createListWithContent() {
|
||||
final long knownTotal = 2;
|
||||
final List<String> knownContentList = new ArrayList<>();
|
||||
@@ -39,6 +47,7 @@ public class PagedListTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Create list with payload and verify size values.")
|
||||
public void createListWithSmallerTotalThanContentSizeIsOk() {
|
||||
final long knownTotal = 0;
|
||||
final List<String> knownContentList = new ArrayList<>();
|
||||
|
||||
@@ -28,6 +28,11 @@ import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Unit Tests - Security")
|
||||
@Stories("Exclude path aware shallow ETag filter")
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ExcludePathAwareShallowETagFilterTest {
|
||||
|
||||
|
||||
@@ -13,8 +13,14 @@ 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 {
|
||||
|
||||
// FIXME: figure what is this all about??
|
||||
@Test
|
||||
public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException {
|
||||
final SecurityTokenGenerator securityTokenGenerator = new SecurityTokenGenerator();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>hawkbit-test-report</artifactId>
|
||||
<name>Hawkbit :: Test Report</name>
|
||||
<name>hawkBit :: Test Report</name>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -75,8 +75,7 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -84,8 +84,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||
gatewayTokenNameTextField.setImmediate(true);
|
||||
// hide text field until we support multiple gateway tokens for a tenant
|
||||
// MECS-830
|
||||
// hide text field until we support multiple gateway tokens for a tenan
|
||||
gatewayTokenNameTextField.setVisible(false);
|
||||
gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged());
|
||||
|
||||
|
||||
@@ -25,7 +25,13 @@ import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Unit Tests - Management UI")
|
||||
@Stories("Push Security")
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
// TODO: create description annotations
|
||||
public class SpringSecurityAtmosphereInterceptorTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
@Features("Component Tests - UI")
|
||||
@Features("Unit Tests - Management UI")
|
||||
@Stories("Threads with NamingThreadFactory")
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class NamingThreadFactoryTest {
|
||||
|
||||
@@ -19,12 +19,15 @@ import com.vaadin.shared.ui.label.ContentMode;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Label;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
* Unit Test block for UI Component provider. Dynamic Factory Testing.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Features("Unit Tests - Management UI")
|
||||
@Stories("UI components")
|
||||
public class SPUIComponentProviderTest {
|
||||
/**
|
||||
* Test case for check button factory.
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -86,7 +86,7 @@
|
||||
<!-- Misc libraries versions - START -->
|
||||
<fest-assert.version>1.4</fest-assert.version>
|
||||
<org.easytesting.version>2.0M10</org.easytesting.version>
|
||||
<allure.version>1.4.15</allure.version>
|
||||
<allure.version>1.4.22</allure.version>
|
||||
<eclipselink.version>2.6.2</eclipselink.version>
|
||||
<org.powermock.version>1.5.4</org.powermock.version>
|
||||
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
||||
|
||||
Reference in New Issue
Block a user