/*******************************************************************************
* This file is protected by Copyright.
* Please refer to the COPYRIGHT file distributed with this source distribution.
*
* This file is part of REDHAWK IDE.
*
* All rights reserved. This program and the accompanying materials are made available under
* the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
// BEGIN GENERATED CODE
package gov.redhawk.model.sca.tests;
import gov.redhawk.model.sca.RefreshDepth;
import gov.redhawk.model.sca.ScaComponent;
import gov.redhawk.model.sca.ScaPort;
import gov.redhawk.model.sca.ScaProvidesPort;
import gov.redhawk.model.sca.ScaWaveform;
import gov.redhawk.model.sca.commands.ScaModelCommand;
import gov.redhawk.model.sca.tests.stubs.ScaTestConstaints;
import junit.textui.TestRunner;
import org.junit.Assert;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Provides Port</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class ScaProvidesPortTest extends ScaPortTest {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(ScaProvidesPortTest.class);
}
/**
* Constructs a new Provides Port test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ScaProvidesPortTest(String name) {
super(name);
}
/**
* Returns the fixture for this Provides Port test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected ScaProvidesPort getFixture() {
return (ScaProvidesPort) fixture;
}
private TestEnvirornment env;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated NOT
*/
@Override
protected void setUp() throws Exception {
this.env = TestEnvirornment.getInstance();
final ScaWaveform waveform = this.env.getDomMgr().getWaveformFactories().get(0).createWaveform(null, "testWave", null, null);
Assert.assertNotNull(waveform);
waveform.refresh(null, RefreshDepth.FULL);
this.env.validateStartState();
ScaModelCommand.execute(waveform, new ScaModelCommand() {
@Override
public void execute() {
final ScaComponent kitchenSinkComp = waveform.findComponent(ScaTestConstaints.DCE_KITCHEN_SINK_COMPONENT);
if (kitchenSinkComp == null && ScaTestsUtil.DEBUG.enabled) {
ScaTestsUtil.DEBUG.message("Invalid Object State: {0}", waveform);
}
if (kitchenSinkComp == null) {
return;
}
final ScaPort< ? , ? > port = kitchenSinkComp.getScaPort("inDouble");
if (port == null && ScaTestsUtil.DEBUG.enabled) {
ScaTestsUtil.DEBUG.message("Invalid Object State: {0}", kitchenSinkComp);
}
setFixture(port);
}
});
Assert.assertNotNull(getFixture());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated NOT
*/
@Override
protected void tearDown() throws Exception {
this.env = null;
setFixture(null);
}
@Override
protected String getRepId() {
return null;
}
} // ScaProvidesPortTest