blob: eb0856eebb3e7f70d316c955d39ef69531ed778d [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2015-2018 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
package org.eclipse.mdm.businessobjects.boundary.integrationtest;
import org.eclipse.mdm.api.base.model.ContextType;
import org.eclipse.mdm.api.dflt.model.CatalogComponent;
import org.eclipse.mdm.api.dflt.model.CatalogSensor;
import org.eclipse.mdm.businessobjects.utils.ServiceUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
* Test class for CatalogSensorResource
*
* @author Alexander Nehmer, science+computing AG Tuebingen (Atos SE)
* @see EntityResourceIntegrationTest
*
*/
public class CatalogSensorResourceIntegrationTest extends EntityResourceIntegrationTest {
@BeforeClass
public static void prepareTestData() {
getLogger().debug("Preparing CatalogSensorResourceIntegrationTest");
// prepare test data for creating the CatalogComponent
CatalogComponentTEQResourceIntegrationTest.prepareTestData();
CatalogComponentTEQResourceIntegrationTest.createEntity();
// set up test data
setContextClass(CatalogSensorResourceIntegrationTest.class);
putTestDataValue(TESTDATA_RESOURCE_URI,
"/catcomps/testequipment/"
+ getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_ID)
+ "/catsensors");
putTestDataValue(TESTDATA_ENTITY_NAME, "testCatSensor");
putTestDataValue(TESTDATA_ENTITY_TYPE, "CatalogSensor");
CatalogComponent catComp = ENTITY_FACTORY.createCatalogComponent(ContextType.TESTEQUIPMENT,
getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_NAME));
ServiceUtils.getCore(catComp)
.setID(getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_ID));
CatalogSensor catSensor = ENTITY_FACTORY.createCatalogSensor(getTestDataValue(TESTDATA_ENTITY_NAME), catComp);
putTestDataValue(TESTDATA_CREATE_JSON_BODY, toJson(catSensor));
}
@AfterClass
public static void tearDownAfterClass() {
setContextClass(CatalogComponentTEQResourceIntegrationTest.class);
CatalogComponentTEQResourceIntegrationTest.deleteEntity();
}
}