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.
|
Please read this if you intend to contribute to the project.
|
||||||
|
|
||||||
## Code Conventions
|
## Conventions
|
||||||
|
|
||||||
|
### Code Style
|
||||||
|
|
||||||
* Java files:
|
* Java files:
|
||||||
* we follow the standard eclipse IDE (built in) code formatter with the following changes:
|
* 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:
|
* Sonarqube:
|
||||||
* Our rule set is defined [here](http://sonar.eu-gb.mybluemix.net)
|
* 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
|
## Legal considerations for your contribution
|
||||||
|
|
||||||
The following steps are necessary to comply with the Eclipse Foundation's IP policy.
|
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.google.common.io.BaseEncoding;
|
||||||
import com.mongodb.gridfs.GridFSDBFile;
|
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)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringApplicationConfiguration(classes = { ArtifactStoreAutoConfiguration.class, TestConfiguration.class })
|
@SpringApplicationConfiguration(classes = { ArtifactStoreAutoConfiguration.class, TestConfiguration.class })
|
||||||
public class ArtifactStoreTest {
|
public class ArtifactStoreTest {
|
||||||
@@ -48,6 +54,7 @@ public class ArtifactStoreTest {
|
|||||||
private GridFsOperations gridFs;
|
private GridFsOperations gridFs;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that storage in MongoDB is correctly executed.s")
|
||||||
public void storeArtifactInMongoDB() {
|
public void storeArtifactInMongoDB() {
|
||||||
final int filelengthBytes = 128;
|
final int filelengthBytes = 128;
|
||||||
final String filename = "testfile.json";
|
final String filename = "testfile.json";
|
||||||
@@ -60,6 +67,7 @@ public class ArtifactStoreTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void findArtifactBySHA1Hash() throws NoSuchAlgorithmException {
|
||||||
final int filelengthBytes = 128;
|
final int filelengthBytes = 128;
|
||||||
final String filename = "testfile.json";
|
final String filename = "testfile.json";
|
||||||
@@ -72,6 +80,7 @@ public class ArtifactStoreTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that search by MD5 hash finds the expected results.")
|
||||||
public void findArtifactByMD5Hash() throws NoSuchAlgorithmException {
|
public void findArtifactByMD5Hash() throws NoSuchAlgorithmException {
|
||||||
final int filelengthBytes = 128;
|
final int filelengthBytes = 128;
|
||||||
final String filename = "testfile.json";
|
final String filename = "testfile.json";
|
||||||
@@ -84,6 +93,7 @@ public class ArtifactStoreTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that artifact content can be read through InputStream.")
|
||||||
public void getInputStreamFromArtifact() throws IOException {
|
public void getInputStreamFromArtifact() throws IOException {
|
||||||
final int filelengthBytes = 128;
|
final int filelengthBytes = 128;
|
||||||
final String filename = "testfile.json";
|
final String filename = "testfile.json";
|
||||||
@@ -103,7 +113,8 @@ public class ArtifactStoreTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 int filelengthBytes = 128;
|
||||||
final String filename = "testfile.json";
|
final String filename = "testfile.json";
|
||||||
final String contentType = "application/json";
|
final String contentType = "application/json";
|
||||||
|
|||||||
@@ -29,7 +29,13 @@ import org.springframework.hateoas.Identifiable;
|
|||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Cluster Cache")
|
||||||
|
@Stories("EventDistributor Test")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
// TODO: create description annotations
|
||||||
public class EventDistributorTest {
|
public class EventDistributorTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ import static org.fest.assertions.api.Assertions.assertThat;
|
|||||||
import org.eclipse.hawkbit.cache.RedisProperties;
|
import org.eclipse.hawkbit.cache.RedisProperties;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Cluster Cache")
|
||||||
|
@Stories("Redis Properties Test")
|
||||||
public class RedisPropertiesTest {
|
public class RedisPropertiesTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Cluster Event Bus")
|
||||||
|
@Stories("EventBus Subscriber Processor Test")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
// TODO: create description annotations
|
||||||
public class EventBusSubscriberProcessorTest {
|
public class EventBusSubscriberProcessorTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Test Amqp controller authentfication.
|
* Test Amqp controller authentication.
|
||||||
*/
|
*/
|
||||||
@Features("AMQP Authenfication Test")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("Tests the authenfication")
|
@Stories("AmqpController Authentication Test")
|
||||||
public class AmqpControllerAuthentficationTest {
|
public class AmqpControllerAuthenticationTest {
|
||||||
|
|
||||||
private static final String TENANT = "DEFAULT";
|
private static final String TENANT = "DEFAULT";
|
||||||
private static String CONTROLLLER_ID = "123";
|
private static String CONTROLLLER_ID = "123";
|
||||||
@@ -53,8 +53,8 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@Features("AMQP Dispatcher Test")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("Tests send messages")
|
@Stories("AmqpMessage Dispatcher Service Test")
|
||||||
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB {
|
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
private AmqpMessageDispatcherService amqpMessageDispatcherService;
|
private AmqpMessageDispatcherService amqpMessageDispatcherService;
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
@Features("AMQP Controller Test")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("Tests the servcies for message handler and dispatcher")
|
@Stories("AmqpMessage Handler Service Test")
|
||||||
public class AmqpMessageHandlerServiceTest {
|
public class AmqpMessageHandlerServiceTest {
|
||||||
|
|
||||||
private static final String TENANT = "DEFAULT";
|
private static final String TENANT = "DEFAULT";
|
||||||
|
|||||||
@@ -20,7 +20,13 @@ import org.springframework.security.authentication.InsufficientAuthenticationExc
|
|||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
|
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Security")
|
||||||
|
@Stories("PreAuthToken Source TrustAuthentication Provider Test")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
// TODO: create description annotations
|
||||||
public class PreAuthTokenSourceTrustAuthenticationProviderTest {
|
public class PreAuthTokenSourceTrustAuthenticationProviderTest {
|
||||||
|
|
||||||
private static final String REQUEST_SOURCE_IP = "127.0.0.1";
|
private static final String REQUEST_SOURCE_IP = "127.0.0.1";
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ public class DeploymentManagement {
|
|||||||
}).collect(Collectors.toList())).stream()
|
}).collect(Collectors.toList())).stream()
|
||||||
.collect(Collectors.toMap(a -> a.getTarget().getControllerId(), Function.identity()));
|
.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
|
// remember the initial
|
||||||
// running status because we will change the status of the action itself
|
// running status because we will change the status of the action itself
|
||||||
// and with this action
|
// and with this action
|
||||||
|
|||||||
@@ -294,8 +294,7 @@ public class DistributionSetManagement {
|
|||||||
// hard delete the rest if exixts
|
// hard delete the rest if exixts
|
||||||
if (!toHardDelete.isEmpty()) {
|
if (!toHardDelete.isEmpty()) {
|
||||||
// don't give the delete statement an empty list, JPA/Oracle cannot
|
// don't give the delete statement an empty list, JPA/Oracle cannot
|
||||||
// handle the empty list,
|
// handle the empty list
|
||||||
// see MECS-403
|
|
||||||
distributionSetRepository.deleteByIdIn(toHardDelete);
|
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
|
* @return {@code true} in case the tenant exits or {@code false} if not
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator")
|
@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
|
// BaseEntity#prePersist methods
|
||||||
// and it seems that JPA committing the transaction when executing this
|
// and it seems that JPA committing the transaction when executing this
|
||||||
// transactional method,
|
// transactional method,
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ import static org.fest.assertions.api.Assertions.assertThat;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Repository")
|
||||||
|
@Stories("CacheKeys")
|
||||||
public class CacheKeysTest {
|
public class CacheKeysTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ import org.springframework.cache.CacheManager;
|
|||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Repository")
|
||||||
|
@Stories("CacheWriteNotify")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class CacheWriteNotifyTest {
|
public class CacheWriteNotifyTest {
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ import org.springframework.cache.CacheManager;
|
|||||||
import org.springframework.cache.support.SimpleValueWrapper;
|
import org.springframework.cache.support.SimpleValueWrapper;
|
||||||
import org.springframework.hateoas.Identifiable;
|
import org.springframework.hateoas.Identifiable;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Repository")
|
||||||
|
@Stories("EventBus")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class CacheFieldEntityListenerTest {
|
public class CacheFieldEntityListenerTest {
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,16 @@ import org.eclipse.hawkbit.repository.model.Action;
|
|||||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||||
import org.junit.Test;
|
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 {
|
public class ActionTest {
|
||||||
|
|
||||||
// issue MECS-670 timeforced update and eTAG calculation
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that timeforced moded switch from soft to forces after defined timeframe.")
|
||||||
public void timeforcedHitNewHasCodeIsGenerated() throws InterruptedException {
|
public void timeforcedHitNewHasCodeIsGenerated() throws InterruptedException {
|
||||||
|
|
||||||
final boolean active = true;
|
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
|
* Addition tests next to {@link ArtifactManagementTest} with no running MongoDB
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Repository")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("Artifact Management")
|
@Stories("Artifact Management")
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Test verifies that an assignment with automatic cancelation works correctly even if the update is split into multiple partitions on the database.")
|
@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() {
|
public void multiAssigmentHistoryOverMultiplePagesResultsInTwoActiveAction() {
|
||||||
|
|
||||||
final DistributionSet cancelDs = TestDataUtil.generateDistributionSet("Canceled DS", "1.0", softwareManagement,
|
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}.
|
* Test class for {@link TagManagement}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Repository")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("Tag Management")
|
@Stories("Tag Management")
|
||||||
// TODO: fully document tests -> @Description for long text and reasonable
|
|
||||||
// method name as short text
|
|
||||||
public class TagManagementTest extends AbstractIntegrationTest {
|
public class TagManagementTest extends AbstractIntegrationTest {
|
||||||
public TagManagementTest() {
|
public TagManagementTest() {
|
||||||
LOG = LoggerFactory.getLogger(TagManagementTest.class);
|
LOG = LoggerFactory.getLogger(TagManagementTest.class);
|
||||||
@@ -155,13 +151,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
return new DistributionSetFilterBuilder();
|
return new DistributionSetFilterBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#findTargetTag(java.lang.String)}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testFindTargetTag() {
|
@Description("Ensures that all tags are retrieved through repository.")
|
||||||
|
public void findAllTargetTags() {
|
||||||
assertThat(targetTagRepository.findAll()).isEmpty();
|
assertThat(targetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
final List<TargetTag> tags = createTargetsWithTags();
|
final List<TargetTag> tags = createTargetsWithTags();
|
||||||
@@ -170,13 +162,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
.hasSize(20);
|
.hasSize(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#createTargetTag(org.eclipse.hawkbit.repository.model.TargetTag)}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateTargetTag() {
|
@Description("Ensures that a created tag is persisted in the repository as defined.")
|
||||||
|
public void createTargetTag() {
|
||||||
assertThat(targetTagRepository.findAll()).isEmpty();
|
assertThat(targetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour"));
|
final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour"));
|
||||||
@@ -186,13 +174,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour");
|
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#deleteTargetTag(java.lang.String[])}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteTargetTagsStringArray() {
|
@Description("Ensures that a deleted tag is removed from the repository as defined.")
|
||||||
|
public void deleteTargetTas() {
|
||||||
assertThat(targetTagRepository.findAll()).isEmpty();
|
assertThat(targetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
// create test data
|
// create test data
|
||||||
@@ -217,7 +201,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests the creation of a target tag.")
|
@Description("Tests the name update of a target tag.")
|
||||||
public void updateTargetTag() {
|
public void updateTargetTag() {
|
||||||
assertThat(targetTagRepository.findAll()).isEmpty();
|
assertThat(targetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
@@ -237,13 +221,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2);
|
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#createDistributionSetTag(org.eclipse.hawkbit.repository.model.DistributionSetTag)}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDistributionSetTag() {
|
@Description("Ensures that a created tag is persisted in the repository as defined.")
|
||||||
|
public void createDistributionSetTag() {
|
||||||
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour"));
|
final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour"));
|
||||||
@@ -253,13 +233,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour");
|
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#createDistributionSetTags(java.lang.Iterable)}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDistributionSetTags() {
|
@Description("Ensures that a created tags are persisted in the repository as defined.")
|
||||||
|
public void createDistributionSetTags() {
|
||||||
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
final List<DistributionSetTag> tags = createDsSetsWithTags();
|
final List<DistributionSetTag> tags = createDsSetsWithTags();
|
||||||
@@ -267,13 +243,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size());
|
assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#deleteDistributionSetTag(java.lang.String[])}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteDistributionSetTag() {
|
@Description("Ensures that a deleted tag is removed from the repository as defined.")
|
||||||
|
public void deleteDistributionSetTag() {
|
||||||
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
// create test data
|
// create test data
|
||||||
@@ -298,24 +270,40 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = EntityAlreadyExistsException.class)
|
@Test(expected = EntityAlreadyExistsException.class)
|
||||||
public void testFailedDuplicateTargetTagNameException() {
|
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
|
||||||
|
public void failedDuplicateTargetTagNameException() {
|
||||||
tagManagement.createTargetTag(new TargetTag("A"));
|
tagManagement.createTargetTag(new TargetTag("A"));
|
||||||
tagManagement.createTargetTag(new TargetTag("A"));
|
tagManagement.createTargetTag(new TargetTag("A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = EntityAlreadyExistsException.class)
|
@Test(expected = EntityAlreadyExistsException.class)
|
||||||
public void testFailedDuplicateDsTagNameException() {
|
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
|
||||||
|
public void failedDuplicateTargetTagNameExceptionAfterUpdate() {
|
||||||
|
tagManagement.createTargetTag(new TargetTag("A"));
|
||||||
|
final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B"));
|
||||||
|
tag.setName("A");
|
||||||
|
tagManagement.updateTargetTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = EntityAlreadyExistsException.class)
|
||||||
|
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
|
||||||
|
public void failedDuplicateDsTagNameException() {
|
||||||
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
|
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
|
||||||
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
|
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Test(expected = EntityAlreadyExistsException.class)
|
||||||
* Test method for
|
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#updateDistributionSetTag(org.eclipse.hawkbit.repository.model.DistributionSetTag)}
|
public void failedDuplicateDsTagNameExceptionAfterUpdate() {
|
||||||
* .
|
tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
|
||||||
*/
|
final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B"));
|
||||||
|
tag.setName("A");
|
||||||
|
tagManagement.updateDistributionSetTag(tag);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateDistributionSetTag() {
|
@Description("Tests the name update of a target tag.")
|
||||||
|
public void updateDistributionSetTag() {
|
||||||
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
// create test data
|
// create test data
|
||||||
@@ -333,13 +321,9 @@ public class TagManagementTest extends AbstractIntegrationTest {
|
|||||||
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123");
|
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test method for
|
|
||||||
* {@link org.eclipse.hawkbit.repository.TagManagement#findAllDistributionSetTags()}
|
|
||||||
* .
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void testFindDistributionSetTagsAll() {
|
@Description("Ensures that all tags are retrieved through repository.")
|
||||||
|
public void findDistributionSetTagsAll() {
|
||||||
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
assertThat(distributionSetTagRepository.findAll()).isEmpty();
|
||||||
|
|
||||||
final List<DistributionSetTag> tags = createDsSetsWithTags();
|
final List<DistributionSetTag> tags = createDsSetsWithTags();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
|
|||||||
final TargetTag targTagC = tagManagement.createTargetTag(new TargetTag("TargTag-C"));
|
final TargetTag targTagC = tagManagement.createTargetTag(new TargetTag("TargTag-C"));
|
||||||
final TargetTag targTagD = tagManagement.createTargetTag(new TargetTag("TargTag-D"));
|
final TargetTag targTagD = tagManagement.createTargetTag(new TargetTag("TargTag-D"));
|
||||||
|
|
||||||
// TODO kzimmerm: test also installedDS (not only assignedDS)
|
// TODO kaizimmerm: test also installedDS (not only assignedDS)
|
||||||
|
|
||||||
final DistributionSet setA = TestDataUtil.generateDistributionSet("", softwareManagement,
|
final DistributionSet setA = TestDataUtil.generateDistributionSet("", softwareManagement,
|
||||||
distributionSetManagement);
|
distributionSetManagement);
|
||||||
@@ -90,7 +90,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
|
|||||||
final PageRequest pageReq = new PageRequest(0, 500);
|
final PageRequest pageReq = new PageRequest(0, 500);
|
||||||
// try to find several targets with different filter settings
|
// try to find several targets with different filter settings
|
||||||
|
|
||||||
// TODO kzimmerm: comment and check also the content itself, not only
|
// TODO kaizimmerm: comment and check also the content itself, not only
|
||||||
// the numbers
|
// the numbers
|
||||||
// (containsOnly)
|
// (containsOnly)
|
||||||
assertThat(targetManagement.countTargetsAll()).isEqualTo(400);
|
assertThat(targetManagement.countTargetsAll()).isEqualTo(400);
|
||||||
@@ -185,7 +185,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO kzimmerm: add filter tests
|
// TODO kaizimmerm: add filter tests
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests the correct order of targets based on selected distribution set. The system expects to have an order based on installed, assigned DS.")
|
@Description("Tests the correct order of targets based on selected distribution set. The system expects to have an order based on installed, assigned DS.")
|
||||||
public void targetSearchWithVariousFilterCombinationsAndOrderByDistributionSet() {
|
public void targetSearchWithVariousFilterCombinationsAndOrderByDistributionSet() {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter actions")
|
@Stories("RSQL filter actions")
|
||||||
public class RSQLActionFieldsTest extends AbstractIntegrationTest {
|
public class RSQLActionFieldsTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter distribution set")
|
@Stories("RSQL filter distribution set")
|
||||||
public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest {
|
public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter distribution set metadata")
|
@Stories("RSQL filter distribution set metadata")
|
||||||
public class RSQLDistributionSetMetadataFieldsTest extends AbstractIntegrationTest {
|
public class RSQLDistributionSetMetadataFieldsTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter rollout group")
|
@Stories("RSQL filter rollout group")
|
||||||
public class RSQLRolloutGroupFields extends AbstractIntegrationTest {
|
public class RSQLRolloutGroupFields extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter software module")
|
@Stories("RSQL filter software module")
|
||||||
public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest {
|
public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter software module metadata")
|
@Stories("RSQL filter software module metadata")
|
||||||
public class RSQLSoftwareModuleMetadataFieldsTest extends AbstractIntegrationTest {
|
public class RSQLSoftwareModuleMetadataFieldsTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter software module test type")
|
@Stories("RSQL filter software module test type")
|
||||||
public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest {
|
public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter target and distribution set tags")
|
@Stories("RSQL filter target and distribution set tags")
|
||||||
public class RSQLTagFieldsTest extends AbstractIntegrationTest {
|
public class RSQLTagFieldsTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import ru.yandex.qatools.allure.annotations.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL filter target")
|
@Stories("RSQL filter target")
|
||||||
public class RSQLTargetFieldTest extends AbstractIntegrationTest {
|
public class RSQLTargetFieldTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
@Features("Component Tests - RSQL filtering")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("RSQL search utility")
|
@Stories("RSQL search utility")
|
||||||
// TODO: fully document tests -> @Description for long text and reasonable
|
// TODO: fully document tests -> @Description for long text and reasonable
|
||||||
// method name as short text
|
// method name as short text
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.tenancy;
|
|||||||
|
|
||||||
import static org.fest.assertions.api.Assertions.assertThat;
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.WithSpringAuthorityRule;
|
import org.eclipse.hawkbit.WithSpringAuthorityRule;
|
||||||
import org.eclipse.hawkbit.WithUser;
|
import org.eclipse.hawkbit.WithUser;
|
||||||
@@ -31,9 +29,6 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
* CRUD-Operations are tenant aware and cannot access or delete entities not
|
* CRUD-Operations are tenant aware and cannot access or delete entities not
|
||||||
* belonging to the current tenant.
|
* belonging to the current tenant.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Repository")
|
@Features("Component Tests - Repository")
|
||||||
@Stories("Multi Tenancy")
|
@Stories("Multi Tenancy")
|
||||||
@@ -97,13 +92,9 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
|
|||||||
// check that the cache is not getting in the way, i.e. "bumlux" results
|
// check that the cache is not getting in the way, i.e. "bumlux" results
|
||||||
// in bumlux and not
|
// in bumlux and not
|
||||||
// mytenant
|
// mytenant
|
||||||
assertThat(
|
assertThat(securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"),
|
||||||
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", "bumlux"), new Callable<String>() {
|
() -> systemManagement.getTenantMetadata().getTenant().toUpperCase()))
|
||||||
@Override
|
.isEqualTo("bumlux".toUpperCase());
|
||||||
public String call() throws Exception {
|
|
||||||
return systemManagement.getTenantMetadata().getTenant().toUpperCase();
|
|
||||||
}
|
|
||||||
})).isEqualTo("bumlux".toUpperCase());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -154,59 +145,38 @@ public class MultiTenancyEntityTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Target createTargetForTenant(final String controllerId, final String tenant) throws Exception {
|
private Target createTargetForTenant(final String controllerId, final String tenant) throws Exception {
|
||||||
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Target>() {
|
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
||||||
@Override
|
() -> targetManagement.createTarget(new Target(controllerId)));
|
||||||
public Target call() throws Exception {
|
|
||||||
return targetManagement.createTarget(new Target(controllerId));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Slice<Target> findTargetsForTenant(final String tenant) throws Exception {
|
private Slice<Target> findTargetsForTenant(final String tenant) throws Exception {
|
||||||
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
||||||
new Callable<Slice<Target>>() {
|
() -> targetManagement.findTargetsAll(pageReq));
|
||||||
@Override
|
|
||||||
public Slice<Target> call() throws Exception {
|
|
||||||
return targetManagement.findTargetsAll(pageReq);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteTargetsForTenant(final String tenant, final Long... targetIds) throws Exception {
|
private void deleteTargetsForTenant(final String tenant, final Long... targetIds) throws Exception {
|
||||||
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), new Callable<Void>() {
|
securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
|
||||||
@Override
|
targetManagement.deleteTargets(targetIds);
|
||||||
public Void call() throws Exception {
|
return null;
|
||||||
targetManagement.deleteTargets(targetIds);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private DistributionSet createDistributionSetForTenant(final String name, final String version, final String tenant)
|
private DistributionSet createDistributionSetForTenant(final String name, final String version, final String tenant)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant), () -> {
|
||||||
new Callable<DistributionSet>() {
|
final DistributionSet ds = new DistributionSet();
|
||||||
@Override
|
ds.setName(name);
|
||||||
public DistributionSet call() throws Exception {
|
ds.setTenant(tenant);
|
||||||
final DistributionSet ds = new DistributionSet();
|
ds.setVersion(version);
|
||||||
ds.setName(name);
|
ds.setType(distributionSetManagement
|
||||||
ds.setTenant(tenant);
|
.createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
|
||||||
ds.setVersion(version);
|
return distributionSetManagement.createDistributionSet(ds);
|
||||||
ds.setType(distributionSetManagement
|
});
|
||||||
.createDistributionSetType(new DistributionSetType("typetest", "test", "foobar")));
|
|
||||||
return distributionSetManagement.createDistributionSet(ds);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
|
private Page<DistributionSet> findDistributionSetForTenant(final String tenant) throws Exception {
|
||||||
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
return securityRule.runAs(WithSpringAuthorityRule.withUserAndTenant("user", tenant),
|
||||||
new Callable<Page<DistributionSet>>() {
|
() -> distributionSetManagement.findDistributionSetsAll(pageReq, false, false));
|
||||||
@Override
|
|
||||||
public Page<DistributionSet> call() throws Exception {
|
|
||||||
return distributionSetManagement.findDistributionSetsAll(pageReq, false, false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -427,8 +427,6 @@ public class RootController {
|
|||||||
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
||||||
targetid, feedback.getStatus().getExecution());
|
targetid, feedback.getStatus().getExecution());
|
||||||
actionStatus.setStatus(Status.RUNNING);
|
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());
|
actionStatus.addMessage("Controller reported: " + feedback.getStatus().getExecution());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Controller RESTful API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Artifact Download Resource")
|
@Stories("Artifact Download Resource")
|
||||||
public class ArtifactDownloadTest extends AbstractIntegrationTestWithMongoDB {
|
public class ArtifactDownloadTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Controller RESTful API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Cancel Action Resource")
|
@Stories("Cancel Action Resource")
|
||||||
public class CancelActionTest extends AbstractIntegrationTest {
|
public class CancelActionTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Controller RESTful API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Config Data Resource")
|
@Stories("Config Data Resource")
|
||||||
public class ConfigDataTest extends AbstractIntegrationTest {
|
public class ConfigDataTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Controller RESTful API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Deployment Action Resource")
|
@Stories("Deployment Action Resource")
|
||||||
public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
|
public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
|
|||||||
@@ -45,13 +45,11 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@ActiveProfiles({ "im", "test" })
|
@ActiveProfiles({ "im", "test" })
|
||||||
@Features("Component Tests - Controller RESTful API")
|
@Features("Component Tests - Direct Device Integration API")
|
||||||
@Stories("Root Poll Resource")
|
@Stories("Root Poll Resource")
|
||||||
// TODO: fully document tests -> @Description for long text and reasonable
|
|
||||||
// method name as short text
|
|
||||||
public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
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.")
|
@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)
|
@WithUser(tenantId = "tenantDoesNotExists", allSpPermissions = true, authorities = "ROLE_CONTROLLER", autoCreateTenant = false)
|
||||||
public void targetCannotBeRegisteredIfTenantDoesNotExistsButWhenExists() throws Exception {
|
public void targetCannotBeRegisteredIfTenantDoesNotExistsButWhenExists() throws Exception {
|
||||||
@@ -73,6 +71,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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,
|
@WithUser(principal = "knownPrincipal", authorities = { SpPermission.READ_TARGET, SpPermission.UPDATE_TARGET,
|
||||||
SpPermission.CREATE_TARGET })
|
SpPermission.CREATE_TARGET })
|
||||||
public void targetPollDoesNotModifyAuditData() throws Exception {
|
public void targetPollDoesNotModifyAuditData() throws Exception {
|
||||||
@@ -104,11 +103,13 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that server returns a not found response in case of empty controlloer ID.")
|
||||||
public void rootRsWithoutId() throws Exception {
|
public void rootRsWithoutId() throws Exception {
|
||||||
mvc.perform(get("/controller/v1/")).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
mvc.perform(get("/controller/v1/")).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void rootRsPlugAndPlay() throws Exception {
|
||||||
|
|
||||||
final long current = System.currentTimeMillis();
|
final long current = System.currentTimeMillis();
|
||||||
@@ -133,6 +134,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void rootRsNotModified() throws Exception {
|
||||||
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
final String etag = mvc.perform(get("/{tenant}/controller/v1/4711", tenantAware.getCurrentTenant()))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
||||||
@@ -197,6 +199,8 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void rootRsPrecommissioned() throws Exception {
|
||||||
final Target target = new Target("4711");
|
final Target target = new Target("4711");
|
||||||
targetManagement.createTarget(target);
|
targetManagement.createTarget(target);
|
||||||
@@ -219,6 +223,7 @@ public class RootControllerTest extends AbstractIntegrationTestWithMongoDB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that the source IP address of the polling target is correctly stored in repository")
|
||||||
public void rootRsPlugAndPlayIpAddress() throws Exception {
|
public void rootRsPlugAndPlayIpAddress() throws Exception {
|
||||||
// test
|
// test
|
||||||
final String knownControllerId1 = "0815";
|
final String knownControllerId1 = "0815";
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ import org.eclipse.hawkbit.repository.model.Target;
|
|||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.context.annotation.Description;
|
import org.springframework.context.annotation.Description;
|
||||||
import org.springframework.http.MediaType;
|
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.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
/**
|
@Features("Component Tests - Management API")
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Features("Component Tests - Management RESTful API")
|
|
||||||
@Stories("Distribution Set Resource")
|
@Stories("Distribution Set Resource")
|
||||||
// TODO: fully document tests -> @Description for long text and reasonable
|
|
||||||
// method name as short text
|
|
||||||
public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -235,6 +227,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that multi target assignment through API is reflected by the repository.")
|
||||||
public void assignMultipleTargetsToDistributionSet() throws Exception {
|
public void assignMultipleTargetsToDistributionSet() throws Exception {
|
||||||
// prepare distribution set
|
// prepare distribution set
|
||||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
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(status().isOk()).andExpect(jsonPath("$.assigned", equalTo(knownTargetIds.length - 1)))
|
||||||
.andExpect(jsonPath("$.alreadyAssigned", equalTo(1)))
|
.andExpect(jsonPath("$.alreadyAssigned", equalTo(1)))
|
||||||
.andExpect(jsonPath("$.total", equalTo(knownTargetIds.length)));
|
.andExpect(jsonPath("$.total", equalTo(knownTargetIds.length)));
|
||||||
|
|
||||||
|
assertThat(targetManagement.findTargetByAssignedDistributionSet(createdDs.getId(), pageReq).getContent())
|
||||||
|
.as("Five targets in repository have DS assigned").hasSize(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that assigned targets of DS are returned as reflected by the repository.")
|
||||||
public void getAssignedTargetsOfDistributionSet() throws Exception {
|
public void getAssignedTargetsOfDistributionSet() throws Exception {
|
||||||
// prepare distribution set
|
// prepare distribution set
|
||||||
final String knownTargetId = "knownTargetId1";
|
final String knownTargetId = "knownTargetId1";
|
||||||
@@ -273,6 +270,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that assigned targets of DS are returned as persisted in the repository.")
|
||||||
public void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
public void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
||||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||||
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
|
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
|
||||||
@@ -283,6 +281,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that installed targets of DS are returned as persisted in the repository.")
|
||||||
public void getInstalledTargetsOfDistributionSet() throws Exception {
|
public void getInstalledTargetsOfDistributionSet() throws Exception {
|
||||||
// prepare distribution set
|
// prepare distribution set
|
||||||
final String knownTargetId = "knownTargetId1";
|
final String knownTargetId = "knownTargetId1";
|
||||||
@@ -305,46 +304,50 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that DS in repository are listed with proper paging properties.")
|
||||||
public void getDistributionSetsWithoutAddtionalRequestParameters() throws Exception {
|
public void getDistributionSetsWithoutAddtionalRequestParameters() throws Exception {
|
||||||
final int modules = 5;
|
final int sets = 5;
|
||||||
createDistributionSetsAlphabetical(modules);
|
createDistributionSetsAlphabetical(sets);
|
||||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
|
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
|
||||||
.andExpect(status().isOk())
|
.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(modules)))
|
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(sets)))
|
||||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(modules)));
|
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(sets)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that DS in repository are listed with proper paging results with paging limit parameter.")
|
||||||
public void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
public void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
||||||
final int modules = 5;
|
final int sets = 5;
|
||||||
final int limitSize = 1;
|
final int limitSize = 1;
|
||||||
createDistributionSetsAlphabetical(modules);
|
createDistributionSetsAlphabetical(sets);
|
||||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
.param(RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
|
.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_SIZE, equalTo(limitSize)))
|
||||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)));
|
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.")
|
||||||
public void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
public void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||||
final int modules = 5;
|
final int sets = 5;
|
||||||
final int offsetParam = 2;
|
final int offsetParam = 2;
|
||||||
final int expectedSize = modules - offsetParam;
|
final int expectedSize = sets - offsetParam;
|
||||||
createDistributionSetsAlphabetical(modules);
|
createDistributionSetsAlphabetical(sets);
|
||||||
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
mvc.perform(get(RestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||||
.param(RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
.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())
|
.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_SIZE, equalTo(expectedSize)))
|
||||||
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)));
|
.andExpect(jsonPath(TargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
|
@Description("Ensures that multiple DS requested are listed with expected payload.")
|
||||||
public void getDistributionSets() throws Exception {
|
public void getDistributionSets() throws Exception {
|
||||||
// prepare test data
|
// prepare test data
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||||
@@ -389,6 +392,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
|
@Description("Ensures that single DS requested by ID is listed with expected payload.")
|
||||||
public void getDistributionSet() throws Exception {
|
public void getDistributionSet() throws Exception {
|
||||||
final DistributionSet set = createTestDistributionSet(softwareManagement, distributionSetManagement);
|
final DistributionSet set = createTestDistributionSet(softwareManagement, distributionSetManagement);
|
||||||
|
|
||||||
@@ -420,6 +424,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
|
@Description("Ensures that multipe DS posted to API are created in the repository.")
|
||||||
public void createDistributionSets() throws JSONException, Exception {
|
public void createDistributionSets() throws JSONException, Exception {
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||||
|
|
||||||
@@ -534,7 +539,8 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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
|
// prepare test data
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||||
|
|
||||||
@@ -553,7 +559,8 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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
|
// prepare test data
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(0);
|
||||||
|
|
||||||
@@ -574,6 +581,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that DS property update request to API is reflected by the repository.")
|
||||||
public void updateDistributionSet() throws Exception {
|
public void updateDistributionSet() throws Exception {
|
||||||
|
|
||||||
// prepare test data
|
// prepare test data
|
||||||
@@ -601,6 +609,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.")
|
||||||
public void invalidRequestsOnDistributionSetsResource() throws Exception {
|
public void invalidRequestsOnDistributionSetsResource() throws Exception {
|
||||||
final DistributionSet set = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
final DistributionSet set = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
||||||
distributionSetManagement);
|
distributionSetManagement);
|
||||||
@@ -642,6 +651,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that the metadata creation through API is reflected by the repository.")
|
||||||
public void createMetadata() throws Exception {
|
public void createMetadata() throws Exception {
|
||||||
final DistributionSet testDS = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
final DistributionSet testDS = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
||||||
distributionSetManagement);
|
distributionSetManagement);
|
||||||
@@ -674,6 +684,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a metadata update through API is reflected by the repository.")
|
||||||
public void updateMetadata() throws Exception {
|
public void updateMetadata() throws Exception {
|
||||||
// prepare and create metadata for update
|
// prepare and create metadata for update
|
||||||
final String knownKey = "knownKey";
|
final String knownKey = "knownKey";
|
||||||
@@ -700,6 +711,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a metadata entry deletion through API is reflected by the repository.")
|
||||||
public void deleteMetadata() throws Exception {
|
public void deleteMetadata() throws Exception {
|
||||||
// prepare and create metadata for deletion
|
// prepare and create metadata for deletion
|
||||||
final String knownKey = "knownKey";
|
final String knownKey = "knownKey";
|
||||||
@@ -722,6 +734,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a metadata entry selection through API reflectes the repository content.")
|
||||||
public void getSingleMetadata() throws Exception {
|
public void getSingleMetadata() throws Exception {
|
||||||
// prepare and create metadata
|
// prepare and create metadata
|
||||||
final String knownKey = "knownKey";
|
final String knownKey = "knownKey";
|
||||||
@@ -737,6 +750,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a metadata entry paged list selection through API reflectes the repository content.")
|
||||||
public void getPagedListofMetadata() throws Exception {
|
public void getPagedListofMetadata() throws Exception {
|
||||||
|
|
||||||
final int totalMetadata = 10;
|
final int totalMetadata = 10;
|
||||||
@@ -760,6 +774,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a DS search with query parameters returns the expected result.")
|
||||||
public void searchDistributionSetRsql() throws Exception {
|
public void searchDistributionSetRsql() throws Exception {
|
||||||
final String dsSuffix = "test";
|
final String dsSuffix = "test";
|
||||||
final int amount = 10;
|
final int amount = 10;
|
||||||
@@ -776,11 +791,13 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@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 {
|
public void filterDistributionSetComplete() throws Exception {
|
||||||
final int amount = 10;
|
final int amount = 10;
|
||||||
TestDataUtil.generateDistributionSets(amount, softwareManagement, distributionSetManagement);
|
TestDataUtil.generateDistributionSets(amount, softwareManagement, distributionSetManagement);
|
||||||
|
distributionSetManagement.createDistributionSet(new DistributionSet("incomplete", "2", "incomplete",
|
||||||
|
distributionSetManagement.findDistributionSetTypeByKey("ecl_os"), null));
|
||||||
|
|
||||||
final String rsqlFindLikeDs1OrDs2 = "complete==" + Boolean.TRUE;
|
final String rsqlFindLikeDs1OrDs2 = "complete==" + Boolean.TRUE;
|
||||||
|
|
||||||
@@ -790,6 +807,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void searchDistributionSetAssignedTargetsRsql() throws Exception {
|
||||||
// prepare distribution set
|
// prepare distribution set
|
||||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||||
@@ -815,6 +833,7 @@ public class DistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void searchDistributionSetMetadataRsql() throws Exception {
|
||||||
final int totalMetadata = 10;
|
final int totalMetadata = 10;
|
||||||
final String knownKeyPrefix = "knownKey";
|
final String knownKeyPrefix = "knownKey";
|
||||||
|
|||||||
@@ -46,11 +46,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
/**
|
/**
|
||||||
* Test for {@link DistributionSetTypeResource}.
|
* Test for {@link DistributionSetTypeResource}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management RESTful API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Distribution Set Type Resource")
|
@Stories("Distribution Set Type Resource")
|
||||||
public class DistributionSetTypeResourceTest extends AbstractIntegrationTest {
|
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.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
/**
|
@Features("Component Tests - Management API")
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Features("Component Tests- Download Restful API")
|
|
||||||
@Stories("Download Resource")
|
@Stories("Download Resource")
|
||||||
public class DownloadResourceTest extends AbstractIntegrationTestWithMongoDB {
|
public class DownloadResourceTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
/**
|
/**
|
||||||
* Tests for covering the {@link RolloutResource}.
|
* Tests for covering the {@link RolloutResource}.
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management RESTful API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Rollout Resource")
|
@Stories("Rollout Resource")
|
||||||
public class RolloutResourceTest extends AbstractIntegrationTest {
|
public class RolloutResourceTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
|
|||||||
.andReturn();
|
.andReturn();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Description("TODO")
|
@Description("Ensures that the repository refuses to create rollout without a defined target filter set.")
|
||||||
public void missingTargetFilterQueryInRollout() throws Exception {
|
public void missingTargetFilterQueryInRollout() throws Exception {
|
||||||
|
|
||||||
final String targetFilterQuery = null;
|
final String targetFilterQuery = null;
|
||||||
@@ -435,7 +435,6 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
|
|||||||
.andExpect(jsonPath("$content", hasSize(5))).andExpect(jsonPath("$total", equalTo(5)));
|
.andExpect(jsonPath("$content", hasSize(5))).andExpect(jsonPath("$total", equalTo(5)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Start the rollout in async mode")
|
@Description("Start the rollout in async mode")
|
||||||
public void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
|
public void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
|
||||||
@@ -528,7 +527,6 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO copied code from sp-bic-test
|
|
||||||
protected <T> T doWithTimeout(final Callable<T> callable, final SuccessCondition<T> successCondition,
|
protected <T> T doWithTimeout(final Callable<T> callable, final SuccessCondition<T> successCondition,
|
||||||
final long timeout, final long pollInterval) throws Exception // NOPMD
|
final long timeout, final long pollInterval) throws Exception // NOPMD
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,13 +23,16 @@ import org.junit.Test;
|
|||||||
import org.springframework.mock.web.MockMultipartFile;
|
import org.springframework.mock.web.MockMultipartFile;
|
||||||
import org.springframework.test.web.servlet.MvcResult;
|
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.
|
* Tests {@link SoftwareModuleResource} in case of missing MongoDB connection.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Features("Component Tests - Management API")
|
||||||
|
@Stories("Download Resource")
|
||||||
public class SMRessourceMisingMongoDbConnectionTest extends AbstractIntegrationTest {
|
public class SMRessourceMisingMongoDbConnectionTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
@@ -40,7 +43,8 @@ public class SMRessourceMisingMongoDbConnectionTest extends AbstractIntegrationT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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(softwareManagement.findSoftwareModulesAll(pageReq)).hasSize(0);
|
||||||
assertThat(artifactRepository.findAll()).hasSize(0);
|
assertThat(artifactRepository.findAll()).hasSize(0);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
* Tests for {@link SoftwareModuleResource} {@link RestController}.
|
* Tests for {@link SoftwareModuleResource} {@link RestController}.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management RESTful API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Software Module Resource")
|
@Stories("Software Module Resource")
|
||||||
public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongoDB {
|
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
|
@Test
|
||||||
@Description("Tests the uppload of an artifact binary. The upload is executed and the content checked in the repository for completenes.")
|
@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 {
|
public void uploadArtifact() throws Exception {
|
||||||
|
|||||||
@@ -43,11 +43,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
/**
|
/**
|
||||||
* Test for {@link SoftwareModuleTypeResource}.
|
* Test for {@link SoftwareModuleTypeResource}.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management RESTful API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Software Module Type Resource")
|
@Stories("Software Module Type Resource")
|
||||||
public class SoftwareModuleTypeResourceTest extends AbstractIntegrationTest {
|
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")
|
@Stories("Sorting parameter")
|
||||||
public class SortUtilityTest {
|
public class SortUtilityTest {
|
||||||
private static final String SORT_PARAM_1 = "NAME:ASC";
|
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")
|
@Stories("System Management Resource")
|
||||||
public class SystemManagementResourceTest extends AbstractIntegrationTestWithMongoDB {
|
public class SystemManagementResourceTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
|
|||||||
@@ -68,16 +68,11 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Spring MVC Tests against the TargetResource.
|
* Spring MVC Tests against the TargetResource.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Features("Component Tests - Management RESTful API")
|
@Features("Component Tests - Management API")
|
||||||
@Stories("Target Resource")
|
@Stories("Target Resource")
|
||||||
// TODO: fully document tests -> @Description for long text and reasonable
|
|
||||||
// method name as short text
|
|
||||||
public class TargetResourceTest extends AbstractIntegrationTest {
|
public class TargetResourceTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
private static final String TARGET_DESCRIPTION_TEST = "created in test";
|
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_CONTROLLERID = JSON_PATH_ROOT + JSON_PATH_FIELD_CONTROLLERID;
|
||||||
private static final String JSON_PATH_DESCRIPTION = JSON_PATH_ROOT + JSON_PATH_FIELD_DESCRIPTION;
|
private static final String JSON_PATH_DESCRIPTION = JSON_PATH_ROOT + JSON_PATH_FIELD_DESCRIPTION;
|
||||||
|
|
||||||
// TODO kzimmerm: test *modified after entity change
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// MECS-1064
|
@Description("Ensures that actions list is in exptected order.")
|
||||||
public void getActionStatusReturnsCorrectType() throws Exception {
|
public void getActionStatusReturnsCorrectType() throws Exception {
|
||||||
final int limitSize = 2;
|
final int limitSize = 2;
|
||||||
final String knownTargetId = "targetId";
|
final String knownTargetId = "targetId";
|
||||||
@@ -140,6 +133,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 })
|
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
|
||||||
public void securityTokenIsNotInResponseIfMissingPermission() throws Exception {
|
public void securityTokenIsNotInResponseIfMissingPermission() throws Exception {
|
||||||
|
|
||||||
@@ -151,6 +145,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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,
|
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
|
||||||
SpPermission.READ_TARGET_SEC_TOKEN })
|
SpPermission.READ_TARGET_SEC_TOKEN })
|
||||||
public void securityTokenIsInResponseWithCorrectPermission() throws Exception {
|
public void securityTokenIsInResponseWithCorrectPermission() throws Exception {
|
||||||
@@ -163,6 +158,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that that IP address is in result as stored in the repository.")
|
||||||
public void addressAndIpAddressInTargetResult() throws Exception {
|
public void addressAndIpAddressInTargetResult() throws Exception {
|
||||||
// prepare targets with IP
|
// prepare targets with IP
|
||||||
final String knownControllerId1 = "0815";
|
final String knownControllerId1 = "0815";
|
||||||
@@ -194,6 +190,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that actions history is returned as defined by filter status==pending,status==finished.")
|
||||||
public void searchActionsRsql() throws Exception {
|
public void searchActionsRsql() throws Exception {
|
||||||
|
|
||||||
// prepare test
|
// prepare test
|
||||||
@@ -226,6 +223,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that a deletion of an active action results in cancelation triggered.")
|
||||||
public void cancelActionOK() throws Exception {
|
public void cancelActionOK() throws Exception {
|
||||||
// prepare test
|
// prepare test
|
||||||
final Target tA = createTargetAndStartAction();
|
final Target tA = createTargetAndStartAction();
|
||||||
@@ -249,7 +247,8 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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
|
// prepare test
|
||||||
final Target tA = createTargetAndStartAction();
|
final Target tA = createTargetAndStartAction();
|
||||||
|
|
||||||
@@ -301,6 +300,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that deletion is executed if permitted.")
|
||||||
public void deleteTargetReturnsOK() throws Exception {
|
public void deleteTargetReturnsOK() throws Exception {
|
||||||
final String knownControllerId = "knownControllerIdDelete";
|
final String knownControllerId = "knownControllerIdDelete";
|
||||||
targetManagement.createTarget(new Target(knownControllerId));
|
targetManagement.createTarget(new Target(knownControllerId));
|
||||||
@@ -313,6 +313,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that deletion is refused with not found if target does not exist.")
|
||||||
public void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
public void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||||
final String knownControllerId = "knownControllerIdDelete";
|
final String knownControllerId = "knownControllerIdDelete";
|
||||||
|
|
||||||
@@ -321,6 +322,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that update is refused with not found if target does not exist.")
|
||||||
public void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
public void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||||
final String knownControllerId = "knownControllerIdUpdate";
|
final String knownControllerId = "knownControllerIdUpdate";
|
||||||
mvc.perform(put(RestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId).content("{}")
|
mvc.perform(put(RestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId).content("{}")
|
||||||
@@ -329,6 +331,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that target update request is reflected by repository.")
|
||||||
public void updateTargetDescription() throws Exception {
|
public void updateTargetDescription() throws Exception {
|
||||||
final String knownControllerId = "123";
|
final String knownControllerId = "123";
|
||||||
final String knownNewDescription = "a new desc updated over rest";
|
final String knownNewDescription = "a new desc updated over rest";
|
||||||
@@ -353,6 +356,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Ensures that target query returns list of targets in defined format.")
|
||||||
public void getTargetWithoutAddtionalRequestParameters() throws Exception {
|
public void getTargetWithoutAddtionalRequestParameters() throws Exception {
|
||||||
final int knownTargetAmount = 3;
|
final int knownTargetAmount = 3;
|
||||||
final String idA = "a";
|
final String idA = "a";
|
||||||
@@ -392,6 +396,7 @@ public class TargetResourceTest extends AbstractIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||||
final int knownTargetAmount = 3;
|
final int knownTargetAmount = 3;
|
||||||
final int limitSize = 1;
|
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].controllerId", equalTo(idA)))
|
||||||
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].createdBy", equalTo("bumlux")))
|
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].createdBy", equalTo("bumlux")))
|
||||||
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].updateStatus", equalTo("unknown")));
|
.andExpect(jsonPath("$content.[?(@.name==" + idA + ")][0].updateStatus", equalTo("unknown")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@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 {
|
public void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||||
final int knownTargetAmount = 5;
|
final int knownTargetAmount = 5;
|
||||||
final int offsetParam = 2;
|
final int offsetParam = 2;
|
||||||
|
|||||||
@@ -15,10 +15,17 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.junit.Test;
|
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 {
|
public class ExceptionInfoTest {
|
||||||
|
|
||||||
@Test
|
@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 knownExceptionClass = "hawkbit.test.exception.Class";
|
||||||
final String knownErrorCode = "hawkbit.error.code.Known";
|
final String knownErrorCode = "hawkbit.error.code.Known";
|
||||||
final String knownMessage = "a known message";
|
final String knownMessage = "a known message";
|
||||||
|
|||||||
@@ -15,14 +15,22 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.junit.Test;
|
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 {
|
public class PagedListTest {
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test(expected = NullPointerException.class)
|
||||||
|
@Description("Ensures that a null payload entitiy throws an exception.")
|
||||||
public void createListWithNullContentThrowsException() {
|
public void createListWithNullContentThrowsException() {
|
||||||
new PagedList<>(null, 0);
|
new PagedList<>(null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Create list with payload and verify content.")
|
||||||
public void createListWithContent() {
|
public void createListWithContent() {
|
||||||
final long knownTotal = 2;
|
final long knownTotal = 2;
|
||||||
final List<String> knownContentList = new ArrayList<>();
|
final List<String> knownContentList = new ArrayList<>();
|
||||||
@@ -39,6 +47,7 @@ public class PagedListTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Description("Create list with payload and verify size values.")
|
||||||
public void createListWithSmallerTotalThanContentSizeIsOk() {
|
public void createListWithSmallerTotalThanContentSizeIsOk() {
|
||||||
final long knownTotal = 0;
|
final long knownTotal = 0;
|
||||||
final List<String> knownContentList = new ArrayList<>();
|
final List<String> knownContentList = new ArrayList<>();
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
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)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class ExcludePathAwareShallowETagFilterTest {
|
public class ExcludePathAwareShallowETagFilterTest {
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,14 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
|
@Features("Unit Tests - Security")
|
||||||
|
@Stories("SecurityToken Generator Test")
|
||||||
public class SecurityTokenGeneratorTest {
|
public class SecurityTokenGeneratorTest {
|
||||||
|
|
||||||
|
// FIXME: figure what is this all about??
|
||||||
@Test
|
@Test
|
||||||
public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException {
|
public void test() throws NoSuchAlgorithmException, UnsupportedEncodingException {
|
||||||
final SecurityTokenGenerator securityTokenGenerator = new SecurityTokenGenerator();
|
final SecurityTokenGenerator securityTokenGenerator = new SecurityTokenGenerator();
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ import ru.yandex.qatools.allure.annotations.Features;
|
|||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
@Features("IpUtil Test")
|
@Features("Unit Tests - Security")
|
||||||
@Stories("Tests the created uris")
|
@Stories("IP Util Test")
|
||||||
public class IpUtilTest {
|
public class IpUtilTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-test-report</artifactId>
|
<artifactId>hawkbit-test-report</artifactId>
|
||||||
<name>Hawkbit :: Test Report</name>
|
<name>hawkBit :: Test Report</name>
|
||||||
|
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
@@ -75,8 +75,7 @@
|
|||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
@@ -84,8 +84,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
|
|||||||
gatewayTokenNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
gatewayTokenNameTextField = SPUIComponentProvider.getTextField("", ValoTheme.TEXTFIELD_TINY, false, null, "",
|
||||||
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
|
||||||
gatewayTokenNameTextField.setImmediate(true);
|
gatewayTokenNameTextField.setImmediate(true);
|
||||||
// hide text field until we support multiple gateway tokens for a tenant
|
// hide text field until we support multiple gateway tokens for a tenan
|
||||||
// MECS-830
|
|
||||||
gatewayTokenNameTextField.setVisible(false);
|
gatewayTokenNameTextField.setVisible(false);
|
||||||
gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged());
|
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.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
|
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)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
// TODO: create description annotations
|
||||||
public class SpringSecurityAtmosphereInterceptorTest {
|
public class SpringSecurityAtmosphereInterceptorTest {
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import org.springframework.context.annotation.Description;
|
|||||||
import ru.yandex.qatools.allure.annotations.Features;
|
import ru.yandex.qatools.allure.annotations.Features;
|
||||||
import ru.yandex.qatools.allure.annotations.Stories;
|
import ru.yandex.qatools.allure.annotations.Stories;
|
||||||
|
|
||||||
@Features("Component Tests - UI")
|
@Features("Unit Tests - Management UI")
|
||||||
@Stories("Threads with NamingThreadFactory")
|
@Stories("Threads with NamingThreadFactory")
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class NamingThreadFactoryTest {
|
public class NamingThreadFactoryTest {
|
||||||
|
|||||||
@@ -19,12 +19,15 @@ import com.vaadin.shared.ui.label.ContentMode;
|
|||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
import com.vaadin.ui.Label;
|
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.
|
* Unit Test block for UI Component provider. Dynamic Factory Testing.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
@Features("Unit Tests - Management UI")
|
||||||
|
@Stories("UI components")
|
||||||
public class SPUIComponentProviderTest {
|
public class SPUIComponentProviderTest {
|
||||||
/**
|
/**
|
||||||
* Test case for check button factory.
|
* Test case for check button factory.
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -86,7 +86,7 @@
|
|||||||
<!-- Misc libraries versions - START -->
|
<!-- Misc libraries versions - START -->
|
||||||
<fest-assert.version>1.4</fest-assert.version>
|
<fest-assert.version>1.4</fest-assert.version>
|
||||||
<org.easytesting.version>2.0M10</org.easytesting.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>
|
<eclipselink.version>2.6.2</eclipselink.version>
|
||||||
<org.powermock.version>1.5.4</org.powermock.version>
|
<org.powermock.version>1.5.4</org.powermock.version>
|
||||||
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
||||||
|
|||||||
Reference in New Issue
Block a user