1 | /* |
---|
2 | * This file is part of Modelica Development Tooling. |
---|
3 | * |
---|
4 | * Copyright (c) 2005, Linköpings universitet, Department of |
---|
5 | * Computer and Information Science, PELAB |
---|
6 | * |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * (The new BSD license, see also |
---|
10 | * http://www.opensource.org/licenses/bsd-license.php) |
---|
11 | * |
---|
12 | * |
---|
13 | * Redistribution and use in source and binary forms, with or without |
---|
14 | * modification, are permitted provided that the following conditions are |
---|
15 | * met: |
---|
16 | * |
---|
17 | * * Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * |
---|
20 | * * Redistributions in binary form must reproduce the above copyright |
---|
21 | * notice, this list of conditions and the following disclaimer in |
---|
22 | * the documentation and/or other materials provided with the |
---|
23 | * distribution. |
---|
24 | * |
---|
25 | * * Neither the name of Linköpings universitet nor the names of its |
---|
26 | * contributors may be used to endorse or promote products derived from |
---|
27 | * this software without specific prior written permission. |
---|
28 | * |
---|
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
40 | */ |
---|
41 | |
---|
42 | package org.modelica.mdt.test; |
---|
43 | |
---|
44 | import java.util.Collections; |
---|
45 | import java.util.Vector; |
---|
46 | |
---|
47 | import org.modelica.mdt.internal.omcproxy.CompilerException; |
---|
48 | import org.modelica.mdt.internal.omcproxy.OMCProxy; |
---|
49 | |
---|
50 | import junit.framework.TestCase; |
---|
51 | |
---|
52 | public class TestOMCProxy extends TestCase |
---|
53 | { |
---|
54 | private Vector<String> modelicaLibraryPackages = new Vector<String>(12); |
---|
55 | |
---|
56 | protected void setUp() |
---|
57 | { |
---|
58 | assertTrue(Collections.addAll(modelicaLibraryPackages, |
---|
59 | "UsersGuide", |
---|
60 | "Media", |
---|
61 | "Utilities", |
---|
62 | "Mechanics", |
---|
63 | "Electrical", |
---|
64 | "Math", |
---|
65 | "Blocks", |
---|
66 | "Thermal", |
---|
67 | "Icons", |
---|
68 | "Constants", |
---|
69 | "SIunits", |
---|
70 | "StateGraph")); |
---|
71 | } |
---|
72 | public void testGetPackages() |
---|
73 | { |
---|
74 | try |
---|
75 | { |
---|
76 | OMCProxy.loadSystemLibrary(); |
---|
77 | String[] str = OMCProxy.getPackages("Modelica"); |
---|
78 | |
---|
79 | assertNotNull("Could not fetch Modelica package", str); |
---|
80 | |
---|
81 | Vector<String> packages = new Vector<String>(); |
---|
82 | for(String s : str) |
---|
83 | { |
---|
84 | packages.addElement(s); |
---|
85 | } |
---|
86 | |
---|
87 | assertTrue(packages.containsAll(modelicaLibraryPackages)); |
---|
88 | } |
---|
89 | catch(CompilerException e) |
---|
90 | { |
---|
91 | fail(e.getMessage()); |
---|
92 | } |
---|
93 | } |
---|
94 | } |
---|