Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9e0780ef6a656299547778df5794c04d578dec31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*******************************************************************************
 * Copyright (c) 2012 Wind River Systems, Inc. and others. 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
 *
 * Contributors:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.tests.tcf.model;

import junit.framework.Test;
import junit.framework.TestSuite;

import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel;
import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelService;
import org.eclipse.tcf.te.tests.CoreTestCase;

/**
 * TCF model test cases.
 */
@SuppressWarnings("restriction")
public class ModelTestCase extends CoreTestCase {

	/**
	 * Provides a test suite to the caller which combines all single
	 * test bundled within this category.
	 *
	 * @return Test suite containing all test for this test category.
	 */
	public static Test getTestSuite() {
		TestSuite testSuite = new TestSuite("Test TCF model framework"); //$NON-NLS-1$

			// add ourself to the test suite
			testSuite.addTestSuite(ModelTestCase.class);

		return testSuite;
	}

	//***** BEGIN SECTION: Single test methods *****
	//NOTE: All method which represents a single test case must
	//      start with 'test'!

    public void testModel() {
		// Create the TCF test model instance
		IModel model = new TestModel();
		assertNotNull("Failed to create test model instance", model); //$NON-NLS-1$
		assertFalse("ModelManager is disposed but should not", model.isDisposed()); //$NON-NLS-1$

		// Get the test model service
		IModelService service = model.getService(TestModelService.class);
		assertNotNull("Failed to access test model service instance", service); //$NON-NLS-1$
		assertSame("Test service instance is associated with a different model instance", model, service.getModel()); //$NON-NLS-1$

		// Dispose the model
		model.dispose();
		assertTrue("ModelManager is not disposed but should", model.isDisposed()); //$NON-NLS-1$

		org.eclipse.tcf.te.tcf.core.model.activator.CoreBundleActivator.getContext();
		org.eclipse.tcf.te.tcf.core.model.activator.CoreBundleActivator.getUniqueIdentifier();
	}

	//***** END SECTION: Single test methods *****

}

Back to the top