// Path: dashboard/src/test/java/eu/seaclouds/platform/dashboard/utils/TestFixtures.java
// public interface TestFixtures {
//     String APPLICATION_ID = "DUkgr9Vb";
//     // Deployer fixtures
//     String TOSCA_DAM_PATH = "fixtures/tosca-dam.yml";
//     String APPLICATION_PATH = "fixtures/application.json";
//     String TASK_SUMMARY_DEPLOY_PATH = "fixtures/task-summary-deploy.json";
//     String TASK_SUMMARY_DELETE_PATH = "fixtures/task-summary-delete.json";
//     String ENTITIES_PATH = "fixtures/entities.json";
//     String SENSORS_SUMMARIES_PATH = "fixtures/sensors.json";
// 
// 
//     // SLA fixtures
//     String AGREEMENT_PATH_JSON = "fixtures/agreement.json";
//     String AGREEMENT_STATUS_PATH_JSON = "fixtures/agreement-status.json";
//     String VIOLATIONS_JSON_PATH = "fixtures/violations.json";
//     String PENALTIES_JSON_PATH = "fixtures/penalties.json";
// 
//     // Monitor fixtures
//     String MONITORING_RULES_PATH = "fixtures/monitoring-rules.xml";
// 
//     // Planner fixtures
//     String ADPS_PATH = "fixtures/adps.json";
//     String ADP_PATH = "fixtures/adp.yml";
//     String AAM_PATH = "fixtures/aam.yml";
//     String DESIGNER_TOPOLOGY = "fixtures/designer-topology.json";
//     String APPLICATION_TREE = "fixtures/application-tree.json";
// }


import com.fasterxml.jackson.databind.JsonNode;
import eu.atos.sla.parser.data.GuaranteeTermsStatus;
import eu.atos.sla.parser.data.Penalty;
import eu.atos.sla.parser.data.Violation;
import eu.atos.sla.parser.data.wsag.Agreement;
import eu.atos.sla.parser.data.wsag.GuaranteeTerm;
import eu.seaclouds.platform.dashboard.model.SeaCloudsApplicationDataStorage;
import eu.seaclouds.platform.dashboard.proxy.*;
import eu.seaclouds.platform.dashboard.util.ObjectMapperHelpers;
import eu.seaclouds.platform.dashboard.utils.TestFixtures;
import eu.seaclouds.platform.dashboard.utils.TestUtils;
import it.polimi.tower4clouds.rules.MonitoringRules;
import org.apache.brooklyn.rest.domain.ApplicationSummary;
import org.apache.brooklyn.rest.domain.EntitySummary;
import org.apache.brooklyn.rest.domain.SensorSummary;
import org.apache.brooklyn.rest.domain.TaskSummary;
import org.mockito.Matchers;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/*
 *  Copyright 2014 SeaClouds
 *  Contact: SeaClouds
 *
 *      Licensed under the Apache License, Version 2.0 (the "License");
 *      you may not use this file except in compliance with the License.
 *      You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *      Unless required by applicable law or agreed to in writing, software
 *      distributed under the License is distributed on an "AS IS" BASIS,
 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *      See the License for the specific language governing permissions and
 *      limitations under the License.
 */

package eu.seaclouds.platform.dashboard.rest;







public abstract class AbstractResourceTest<T extends Resource> {
    protected static final String RANDOM_STRING = UUID.randomUUID().toString();
    private static final String DEPLOYER_ENDPOINT = "http://localhost:8081";
    private static final String MONITOR_ENDPOINT = "http://localhost:8170";
    private static final String GRAFANA_ENDPOINT = "http://localhost:3000";
    private static final String PLANNER_ENDPOINT = "http://localhost:1234";
    private static final String SLA_ENDPOINT = "http://localhost:8080";

    private ApplicationSummary applicationSummary;
    private JsonNode applicationTree;
    private TaskSummary taskSummaryDeploy;
    private TaskSummary taskSummaryDelete;
    private List<SensorSummary> sensorSummaries;
    private List<EntitySummary> entitySummaries;
    private Agreement agreement;
    private GuaranteeTermsStatus agreementStatus;
    private List<Violation> agreementTermViolations;
    private List<Penalty> agreementTermPenalties;
    private MonitoringRules monitoringRules;
    private String topology;
    private String adp;
    private String adps;
    private String aam;
    private String dam;

    private final DeployerProxy deployerProxy = mock(DeployerProxy.class);
    private final PlannerProxy plannerProxy = mock(PlannerProxy.class);
    private final SlaProxy slaProxy = mock(SlaProxy.class);
    private final GrafanaProxy grafanaProxy = mock(GrafanaProxy.class);

    private void initObjects() throws IOException, JAXBException {
        applicationSummary = ObjectMapperHelpers.JsonToObject(
// Path: dashboard/src/test/java/eu/seaclouds/platform/dashboard/utils/TestFixtures.java
// public interface TestFixtures {
//     String APPLICATION_ID = "DUkgr9Vb";
//     // Deployer fixtures
//     String TOSCA_DAM_PATH = "fixtures/tosca-dam.yml";
//     String APPLICATION_PATH = "fixtures/application.json";
//     String TASK_SUMMARY_DEPLOY_PATH = "fixtures/task-summary-deploy.json";
//     String TASK_SUMMARY_DELETE_PATH = "fixtures/task-summary-delete.json";
//     String ENTITIES_PATH = "fixtures/entities.json";
//     String SENSORS_SUMMARIES_PATH = "fixtures/sensors.json";
// 
// 
//     // SLA fixtures
//     String AGREEMENT_PATH_JSON = "fixtures/agreement.json";
//     String AGREEMENT_STATUS_PATH_JSON = "fixtures/agreement-status.json";
//     String VIOLATIONS_JSON_PATH = "fixtures/violations.json";
//     String PENALTIES_JSON_PATH = "fixtures/penalties.json";
// 
//     // Monitor fixtures
//     String MONITORING_RULES_PATH = "fixtures/monitoring-rules.xml";
// 
//     // Planner fixtures
//     String ADPS_PATH = "fixtures/adps.json";
//     String ADP_PATH = "fixtures/adp.yml";
//     String AAM_PATH = "fixtures/aam.yml";
//     String DESIGNER_TOPOLOGY = "fixtures/designer-topology.json";
//     String APPLICATION_TREE = "fixtures/application-tree.json";
// }


// Path: dashboard/src/test/java/eu/seaclouds/platform/dashboard/rest/AbstractResourceTest.java
import com.fasterxml.jackson.databind.JsonNode;
import eu.atos.sla.parser.data.GuaranteeTermsStatus;
import eu.atos.sla.parser.data.Penalty;
import eu.atos.sla.parser.data.Violation;
import eu.atos.sla.parser.data.wsag.Agreement;
import eu.atos.sla.parser.data.wsag.GuaranteeTerm;
import eu.seaclouds.platform.dashboard.model.SeaCloudsApplicationDataStorage;
import eu.seaclouds.platform.dashboard.proxy.*;
import eu.seaclouds.platform.dashboard.util.ObjectMapperHelpers;
import eu.seaclouds.platform.dashboard.utils.TestFixtures;
import eu.seaclouds.platform.dashboard.utils.TestUtils;
import it.polimi.tower4clouds.rules.MonitoringRules;
import org.apache.brooklyn.rest.domain.ApplicationSummary;
import org.apache.brooklyn.rest.domain.EntitySummary;
import org.apache.brooklyn.rest.domain.SensorSummary;
import org.apache.brooklyn.rest.domain.TaskSummary;
import org.mockito.Matchers;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import javax.xml.bind.JAXBException;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/*
 *  Copyright 2014 SeaClouds
 *  Contact: SeaClouds
 *
 *      Licensed under the Apache License, Version 2.0 (the "License");
 *      you may not use this file except in compliance with the License.
 *      You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *      Unless required by applicable law or agreed to in writing, software
 *      distributed under the License is distributed on an "AS IS" BASIS,
 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *      See the License for the specific language governing permissions and
 *      limitations under the License.
 */

package eu.seaclouds.platform.dashboard.rest;







public abstract class AbstractResourceTest<T extends Resource> {
    protected static final String RANDOM_STRING = UUID.randomUUID().toString();
    private static final String DEPLOYER_ENDPOINT = "http://localhost:8081";
    private static final String MONITOR_ENDPOINT = "http://localhost:8170";
    private static final String GRAFANA_ENDPOINT = "http://localhost:3000";
    private static final String PLANNER_ENDPOINT = "http://localhost:1234";
    private static final String SLA_ENDPOINT = "http://localhost:8080";

    private ApplicationSummary applicationSummary;
    private JsonNode applicationTree;
    private TaskSummary taskSummaryDeploy;
    private TaskSummary taskSummaryDelete;
    private List<SensorSummary> sensorSummaries;
    private List<EntitySummary> entitySummaries;
    private Agreement agreement;
    private GuaranteeTermsStatus agreementStatus;
    private List<Violation> agreementTermViolations;
    private List<Penalty> agreementTermPenalties;
    private MonitoringRules monitoringRules;
    private String topology;
    private String adp;
    private String adps;
    private String aam;
    private String dam;

    private final DeployerProxy deployerProxy = mock(DeployerProxy.class);
    private final PlannerProxy plannerProxy = mock(PlannerProxy.class);
    private final SlaProxy slaProxy = mock(SlaProxy.class);
    private final GrafanaProxy grafanaProxy = mock(GrafanaProxy.class);

    private void initObjects() throws IOException, JAXBException {
        applicationSummary = ObjectMapperHelpers.JsonToObject(
                TestUtils.getStringFromPath(TestFixtures.APPLICATION_PATH), ApplicationSummary.class);