blob: a53bde4c5fc3eda056eccf807b18c5e1c9c5f4ec [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.TemplateComponent;
import org.eclipse.mdm.api.dflt.model.TemplateRoot;
import org.eclipse.mdm.businessobjects.utils.ServiceUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
/**
* Test class for TemplateComponentResource for TestEquipment
* {@link ContextType}.
*
* @author Alexander Nehmer, science+computing AG Tuebingen (Atos SE)
* @see EntityResourceIntegrationTest
*
*/
public class TemplateComponentTEQResourceIntegrationTest extends EntityResourceIntegrationTest {
@BeforeClass
public static void prepareTestData() {
getLogger().debug("Preparing TemplateComponentTEQResourceIntegrationTest");
// prepare test data for creating the CatalogComponent
CatalogComponentTEQResourceIntegrationTest.prepareTestData();
CatalogComponentTEQResourceIntegrationTest.createEntity();
// prepare test data for creating the TemplateRoot
TemplateRootTEQResourceIntegrationTest.prepareTestData();
TemplateRootTEQResourceIntegrationTest.createEntity();
// set up test data
setContextClass(TemplateComponentTEQResourceIntegrationTest.class);
putTestDataValue(TESTDATA_RESOURCE_URI, "/tplroots/testequipment/"
+ getTestDataValue(TemplateRootTEQResourceIntegrationTest.class, TESTDATA_ENTITY_ID) + "/tplcomps");
putTestDataValue(TESTDATA_ENTITY_NAME, "testTplCompTEQ");
putTestDataValue(TESTDATA_ENTITY_TYPE, "TemplateComponent");
CatalogComponent catComp = ENTITY_FACTORY.createCatalogComponent(ContextType.TESTEQUIPMENT ,
getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_NAME));
ServiceUtils.getCore(catComp)
.setID(getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_ID));
TemplateRoot tplRoot = ENTITY_FACTORY.createTemplateRoot(ContextType.TESTEQUIPMENT,
getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_NAME));
ServiceUtils.getCore(tplRoot)
.setID(getTestDataValue(CatalogComponentTEQResourceIntegrationTest.class, TESTDATA_ENTITY_ID));
TemplateComponent tplComp = ENTITY_FACTORY.createTemplateComponent(getTestDataValue(TESTDATA_ENTITY_NAME),
tplRoot, catComp);
putTestDataValue(TESTDATA_CREATE_JSON_BODY, toJson(tplComp));
}
@AfterClass
public static void tearDownAfterClass() {
setContextClass(TemplateRootTEQResourceIntegrationTest.class);
TemplateRootTEQResourceIntegrationTest.deleteEntity();
setContextClass(CatalogComponentTEQResourceIntegrationTest.class);
CatalogComponentTEQResourceIntegrationTest.deleteEntity();
}
}