Search in sources :

Example 6 with SubscriptionVo

use of org.ligoj.app.resource.subscription.SubscriptionVo in project ligoj-api by ligoj.

the class ProjectResourceTest method findByIdWithSubscription.

/**
 * test {@link ProjectResource#findById(int)}
 */
@Test
public void findByIdWithSubscription() throws IOException {
    final Project byName = repository.findByName("gStack");
    persistEntities("csv", new Class[] { Event.class }, StandardCharsets.UTF_8.name());
    initSpringSecurityContext("alongchu");
    final ProjectVo project = resource.findById(byName.getId());
    // Check subscription
    Assertions.assertTrue(project.getSubscriptions().size() >= 6);
    for (final SubscriptionVo subscription : project.getSubscriptions()) {
        if (subscription.getStatus() != null) {
            return;
        }
    }
    Assertions.fail("Subscriptions status was expected.");
}
Also used : Project(org.ligoj.app.model.Project) SubscriptionVo(org.ligoj.app.resource.subscription.SubscriptionVo) AbstractOrgTest(org.ligoj.app.resource.AbstractOrgTest) Test(org.junit.jupiter.api.Test)

Aggregations

SubscriptionVo (org.ligoj.app.resource.subscription.SubscriptionVo)6 Test (org.junit.jupiter.api.Test)3 Project (org.ligoj.app.model.Project)3 Subscription (org.ligoj.app.model.Subscription)3 EventVo (org.ligoj.app.resource.node.EventVo)3 HashMap (java.util.HashMap)2 NodeVo (org.ligoj.app.api.NodeVo)2 ParameterValue (org.ligoj.app.model.ParameterValue)2 AbstractOrgTest (org.ligoj.app.resource.AbstractOrgTest)2 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 Date (java.util.Date)1 List (java.util.List)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 NodeStatus (org.ligoj.app.api.NodeStatus)1 IUserRepository (org.ligoj.app.iam.IUserRepository)1 IamConfiguration (org.ligoj.app.iam.IamConfiguration)1