/*
 * ProActive Parallel Suite(TM):
 * The Open Source library for parallel and distributed
 * Workflows & Scheduling, Orchestration, Cloud Automation
 * and Big Data Analysis on Enterprise Grids & Clouds.
 *
 * Copyright (c) 2007 - 2017 ActiveEon
 * Contact: contact@activeeon.com
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Affero General Public License
 * as published by the Free Software Foundation: version 3 of
 * the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * If needed, contact us to obtain a release under GPL Version 2 or 3
 * or a different license than the AGPL.
 */
package org.ow2.proactive.workflow_catalog.rest.controller;

import static com.jayway.restassured.RestAssured.when;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;

import org.apache.http.HttpStatus;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ow2.proactive.workflow_catalog.rest.Application;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


/**
 * @author ActiveEon Team
 */
@ActiveProfiles("mem")
@DirtiesContext(classMode = AFTER_EACH_TEST_METHOD)
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = { Application.class })
@WebIntegrationTest(randomPort = true)
public class DefaultConfigurationIntegrationTest extends AbstractRestAssuredTest {

    private static final String BUCKETS_RESOURCE = "/buckets";

    @Test
    public void defaultBucketsShouldBeCreatedBasedOnApplicationConfigurationProperty() {
        when().get(BUCKETS_RESOURCE)
              .then()
              .assertThat()
              .statusCode(HttpStatus.SC_OK)
              .body("_embedded.bucketMetadataList", hasSize(2))
              .body("_embedded.bucketMetadataList[0].name", is("Examples"))
              .body("_embedded.bucketMetadataList[1].name", is("Cloud-automation"))
              .body("_embedded.bucketMetadataList[2].name", is("Application"))
              .body("page.totalElements", is(2));
    }

}

@@ -1081,248 +1081,8 @@
 r;%0A%0A
-import static com.jayway.restassured.RestAssured.when;%0Aimport static org.hamcrest.Matchers.hasSize;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;%0A%0A
 impo
@@ -1112,16 +1112,16 @@
 Status;%0A
+
 import o
@@ -1542,16 +1542,256 @@
 unner;%0A%0A
+import static com.jayway.restassured.RestAssured.when;%0Aimport static org.hamcrest.Matchers.hasSize;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.springframework.test.annotation.DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD;%0A%0A
 %0A/**%0A * 
@@ -2474,17 +2474,17 @@
 hasSize(
-2
+3
 ))%0A     
@@ -2762,17 +2762,17 @@
 ts%22, is(
-2
+3
 ));%0A    

update configuration test total element from 2 to 3