Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b5cb7ad39cf86cc70ba41a5ccd238d71b3c96667 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
package org.eclipse.osgi.tests.resolver;

import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateObjectFactory;
import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
import org.osgi.framework.BundleException;



public class TestGenerated_001 extends AbstractStateTest {
	public TestGenerated_001(String testName) {
		super(testName);
	}

	BundleDescription bundle_1 = null;
	BundleDescription bundle_2 = null;
	BundleDescription bundle_3 = null;
	BundleDescription bundle_4 = null;
	BundleDescription bundle_5 = null;
	BundleDescription bundle_6 = null;
	BundleDescription bundle_7 = null;
	BundleDescription bundle_8 = null;
	BundleDescription bundle_9 = null;
	BundleDescription bundle_10 = null;

	public void testTest_001() {
		State state = buildEmptyState();
		StateObjectFactory sof = platformAdmin.getFactory();

		bundle_1 = create_bundle_1(sof);
		bundle_2 = create_bundle_2(sof);
		bundle_3 = create_bundle_3(sof);
		bundle_4 = create_bundle_4(sof);
		bundle_5 = create_bundle_5(sof);
		bundle_6 = create_bundle_6(sof);
		bundle_7 = create_bundle_7(sof);
		bundle_8 = create_bundle_8(sof);
		bundle_9 = create_bundle_9(sof);
		bundle_10 = create_bundle_10(sof);
		//***************************************************
		// stage a
		// expect to pass =true
		//***************************************************
		addBundlesToState_a(state);
		//***************************************************
		try {
			state.resolve();
		} catch (Throwable t) {
			fail("unexpected exception class=" + t.getClass().getName()
					+ " message=" + t.getMessage());
			return;
		}
		checkBundlesResolved_a();
		checkWiring_a();
	} // end of method

	public void checkWiringState_1() {
	} // end method

	public void checkWiringState_2() {
	} // end method

	public void checkWiringState_3() {
		ExportPackageDescription[] exports = null;
		exports = null;
		exports = bundle_3.getResolvedImports();
		assertNotNull("export array is unexpectedly null", exports);
		assertTrue("export array is unexpectedly empty", exports.length > 0);
		for (int i = 0; i < exports.length; i++) {
			ExportPackageDescription exp = exports[i];
			String exportPackageName = exp.getName();
			assertNotNull("package name is null", exportPackageName);
			if (exportPackageName.equals("a2")) {
				assertNotNull("Package [a2] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a2] is  wired incorrectly ", exp.getExporter(), bundle_8);
			} else if (exportPackageName.equals("a1")) {
				assertNotNull("Package [a1] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a1] is  wired incorrectly ", exp.getExporter(), bundle_3);
			} else if (exportPackageName.equals("a3")) {
				assertNotNull("Package [a3] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a3] is  wired incorrectly ", exp.getExporter(), bundle_6);
			}
		} // end for
	} // end method

	public void checkWiringState_4() {
	} // end method

	public void checkWiringState_5() {
	} // end method

	public void checkWiringState_6() {
		ExportPackageDescription[] exports = null;
		exports = null;
		exports = bundle_6.getResolvedImports();
		assertNotNull("export array is unexpectedly null", exports);
		assertTrue("export array is unexpectedly empty", exports.length > 0);
		for (int i = 0; i < exports.length; i++) {
			ExportPackageDescription exp = exports[i];
			String exportPackageName = exp.getName();
			assertNotNull("package name is null", exportPackageName);
			if (exportPackageName.equals("a2")) {
				assertNotNull("Package [a2] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a2] is  wired incorrectly ", exp.getExporter(), bundle_8);
			} else if (exportPackageName.equals("a1")) {
				assertNotNull("Package [a1] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a1] is  wired incorrectly ", exp.getExporter(), bundle_3);
			} else if (exportPackageName.equals("a3")) {
				assertNotNull("Package [a3] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a3] is  wired incorrectly ", exp.getExporter(), bundle_6);
			}
		} // end for
	} // end method

	public void checkWiringState_7() {
		ExportPackageDescription[] exports = null;
		exports = null;
		exports = bundle_7.getResolvedImports();
		assertNotNull("export array is unexpectedly null", exports);
		assertTrue("export array is unexpectedly empty", exports.length > 0);
		for (int i = 0; i < exports.length; i++) {
			ExportPackageDescription exp = exports[i];
			String exportPackageName = exp.getName();
			assertNotNull("package name is null", exportPackageName);
			if (exportPackageName.equals("a2")) {
				assertNotNull("Package [a2] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a2] is  wired incorrectly ", exp.getExporter(), bundle_8);
			} else if (exportPackageName.equals("a1")) {
				assertNotNull("Package [a1] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a1] is  wired incorrectly ", exp.getExporter(), bundle_3);
			} else if (exportPackageName.equals("a3")) {
				assertNotNull("Package [a3] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a3] is  wired incorrectly ", exp.getExporter(), bundle_6);
			}
		} // end for
	} // end method

	public void checkWiringState_8() {
		ExportPackageDescription[] exports = null;
		exports = null;
		exports = bundle_8.getResolvedImports();
		assertNotNull("export array is unexpectedly null", exports);
		assertTrue("export array is unexpectedly empty", exports.length > 0);
		for (int i = 0; i < exports.length; i++) {
			ExportPackageDescription exp = exports[i];
			String exportPackageName = exp.getName();
			assertNotNull("package name is null", exportPackageName);
			if (exportPackageName.equals("a2")) {
				assertNotNull("Package [a2] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a2] is  wired incorrectly ", exp.getExporter(), bundle_8);
			} else if (exportPackageName.equals("a1")) {
				assertNotNull("Package [a1] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a1] is  wired incorrectly ", exp.getExporter(), bundle_3);
			} else if (exportPackageName.equals("a3")) {
				assertNotNull("Package [a3] is not wired when it should  be ", exp.getExporter());
				assertEquals("Package [a3] is  wired incorrectly ", exp.getExporter(), bundle_6);
			}
		} // end for
	} // end method

	public void checkWiringState_9() {
	} // end method

	public void checkWiringState_10() {
	} // end method

	public void checkWiring_a() {
		checkWiringState_1();
		checkWiringState_2();
		checkWiringState_3();
		checkWiringState_4();
		checkWiringState_5();
		checkWiringState_6();
		checkWiringState_7();
		checkWiringState_8();
		checkWiringState_9();
		checkWiringState_10();
	} // end method

	public void addBundlesToState_a(State state) {
		boolean added = false;
		added = state.addBundle(bundle_1);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_2);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_3);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_4);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_5);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_6);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_7);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_8);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_9);
		assertTrue("failed to add bundle ", added);
		added = state.addBundle(bundle_10);
		assertTrue("failed to add bundle ", added);
	} // end method

	public void checkBundlesResolved_a() {
		assertTrue("unexpected bundle resolution state", !bundle_1.isResolved());
		assertTrue("unexpected bundle resolution state", !bundle_2.isResolved());
		assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
		assertTrue("unexpected bundle resolution state", !bundle_4.isResolved());
		assertTrue("unexpected bundle resolution state", !bundle_5.isResolved());
		assertTrue("unexpected bundle resolution state", bundle_6.isResolved());
		assertTrue("unexpected bundle resolution state", bundle_7.isResolved());
		assertTrue("unexpected bundle resolution state", bundle_8.isResolved());
		assertTrue("unexpected bundle resolution state", !bundle_9.isResolved());
		assertTrue("unexpected bundle resolution state", !bundle_10.isResolved());
	} // end method

	public BundleDescription create_bundle_1(StateObjectFactory sof) {
		java.util.Dictionary dictionary_1 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_1.put("Bundle-ManifestVersion", "2");
		dictionary_1.put("Bundle-SymbolicName", "A");
		dictionary_1.put("Import-Package", "a1; version=\"[2, 3]\", a2; version=8, a3; version=\"[5, 13]\"");
		try {
			bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_2(StateObjectFactory sof) {
		java.util.Dictionary dictionary_2 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_2.put("Bundle-ManifestVersion", "2");
		dictionary_2.put("Bundle-SymbolicName", "B");
		dictionary_2.put("Import-Package", "a1; version=\"[3, 3.9]\", a2; version=\"[8, 8.9]\", a3; version=0");
		try {
			bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_3(StateObjectFactory sof) {
		java.util.Dictionary dictionary_3 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_3.put("Bundle-ManifestVersion", "2");
		dictionary_3.put("Bundle-SymbolicName", "C");
		dictionary_3.put("Export-Package", "a1; version=7");
		dictionary_3.put("Import-Package", "a1; version=3, a2; version=8, a3; version=0");
		try {
			bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_4(StateObjectFactory sof) {
		java.util.Dictionary dictionary_4 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_4.put("Bundle-ManifestVersion", "2");
		dictionary_4.put("Bundle-SymbolicName", "D");
		dictionary_4.put("Import-Package", "a1; version=\"[3, 3.9]\", a2; version=8, a3; version=5");
		try {
			bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_5(StateObjectFactory sof) {
		java.util.Dictionary dictionary_5 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_5.put("Bundle-ManifestVersion", "2");
		dictionary_5.put("Bundle-SymbolicName", "E");
		dictionary_5.put("Import-Package", "a1; version=7, a2; version=8, a3; version=5");
		try {
			bundle = sof.createBundleDescription(dictionary_5, "bundle_5", 5);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_6(StateObjectFactory sof) {
		java.util.Dictionary dictionary_6 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_6.put("Bundle-ManifestVersion", "2");
		dictionary_6.put("Bundle-SymbolicName", "F");
		dictionary_6.put("Export-Package", "a3; version=0");
		dictionary_6.put("Import-Package", "a1; version=7, a2; version=\"[7, 8]\", a3; version=\"[0, 0]\"");
		try {
			bundle = sof.createBundleDescription(dictionary_6, "bundle_6", 6);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_7(StateObjectFactory sof) {
		java.util.Dictionary dictionary_7 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_7.put("Bundle-ManifestVersion", "2");
		dictionary_7.put("Bundle-SymbolicName", "G");
		dictionary_7.put("Export-Package", "a1; version=3");
		dictionary_7.put("Import-Package", "a1; version=\"[7, 7.9]\", a2; version=8, a3; version=0");
		try {
			bundle = sof.createBundleDescription(dictionary_7, "bundle_7", 7);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_8(StateObjectFactory sof) {
		java.util.Dictionary dictionary_8 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_8.put("Bundle-ManifestVersion", "2");
		dictionary_8.put("Bundle-SymbolicName", "H");
		dictionary_8.put("Export-Package", "a2; version=8");
		dictionary_8.put("Import-Package", "a1; version=3, a2; version=8, a3; version=0");
		try {
			bundle = sof.createBundleDescription(dictionary_8, "bundle_8", 8);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_9(StateObjectFactory sof) {
		java.util.Dictionary dictionary_9 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_9.put("Bundle-ManifestVersion", "2");
		dictionary_9.put("Bundle-SymbolicName", "I");
		dictionary_9.put("Export-Package", "a3; version=5");
		dictionary_9.put("Import-Package", "a1; version=\"[3, 3.9]\", a2; version=\"[8, 16]\", a3; version=5");
		try {
			bundle = sof.createBundleDescription(dictionary_9, "bundle_9", 9);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method

	public BundleDescription create_bundle_10(StateObjectFactory sof) {
		java.util.Dictionary dictionary_10 = new java.util.Properties();
		BundleDescription bundle = null;
		dictionary_10.put("Bundle-ManifestVersion", "2");
		dictionary_10.put("Bundle-SymbolicName", "J");
		dictionary_10.put("Import-Package", "a1; version=7, a2; version=\"[7, 8]\", a3; version=5");
		try {
			bundle = sof.createBundleDescription(dictionary_10, "bundle_10", 10);
		} catch (BundleException be) {
			fail(be.getMessage());
		}
		return bundle;
	} // end of method
} // end of testcase

Back to the top