]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph/tests/org/simantics/graph/tests/TestTGResourceUtil.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graph / tests / org / simantics / graph / tests / TestTGResourceUtil.java
index 9bb53d3fbb45ae9e376b4fa3cd320791f30793bf..cf648fdae2761414e97fdd9e82c787332fa8c6d8 100644 (file)
@@ -1,88 +1,88 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.graph.tests;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.junit.Test;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.databoard.annotations.Union;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.databoard.binding.RecordBinding;\r
-import org.simantics.graph.tests._RVI._RVIPart;\r
-import org.simantics.graph.tests._RVI._ResourceRVIPart;\r
-import org.simantics.graph.tests._RVI._Role;\r
-import org.simantics.graph.tests._RVI._StringRVIPart;\r
-import org.simantics.graph.utils.TGResourceUtil;\r
-\r
-public class TestTGResourceUtil {\r
-       \r
-       \r
-       public @Test void test() throws Exception {\r
-               \r
-               _ResourceRVIPart part1 = new _ResourceRVIPart();\r
-               part1.resource = 5;\r
-               part1.role = _Role.CHILD;\r
-               \r
-               _StringRVIPart part2 = new _StringRVIPart();\r
-               part2.string = "Value";\r
-               part2.role = _Role.PROPERTY;\r
-               \r
-               _RVI rvi = new _RVI();\r
-               rvi.parts = new _RVIPart[] { part1, part2 };\r
-               rvi.variant = 3L;\r
-               \r
-               Binding b1 = Bindings.getBinding( _RVI.class );\r
-               RecordBinding b2 = Bindings.getBinding( _ResourceRVIPart.class );\r
-               b2.componentBindings[1].type().metadata.put("resource", "true");\r
-               \r
-               TGResourceUtil util = new TGResourceUtil();\r
-               util.addType( b1.type() );\r
-               \r
-               List<Long> resources = new ArrayList<Long>();\r
-               util.findResources(b1, rvi, resources);\r
-               for (Long l : resources) System.out.println("Found resource: "+l);\r
-               \r
-               // adapt resources\r
-               TGResourceUtil.LongAdapter la = new TGResourceUtil.LongAdapter() {\r
-                       @Override\r
-                       public long adapt(long in) {\r
-                               return in;\r
-                       }\r
-               };\r
-               util.adaptValue(b1, rvi, la);\r
-               \r
-               System.out.println("rvi = "+b1.toString(rvi));          \r
-       }\r
-       \r
-       \r
-\r
-}\r
-\r
-class _RVI {\r
-       \r
-       static enum _Role { CHILD, PROPERTY }   \r
-       public _RVIPart[] parts;\r
-       @Union({_ResourceRVIPart.class, _StringRVIPart.class})\r
-       interface _RVIPart {}\r
-       static class _ResourceRVIPart implements _RVIPart {\r
-               public _Role role;\r
-               public long resource;\r
-       }\r
-       static class _StringRVIPart implements _RVIPart {\r
-               public _Role role;\r
-               public String string;\r
-       }       \r
-       public Object variant;\r
-\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * 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:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.graph.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.simantics.databoard.Bindings;
+import org.simantics.databoard.annotations.Union;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.databoard.binding.RecordBinding;
+import org.simantics.graph.tests._RVI._RVIPart;
+import org.simantics.graph.tests._RVI._ResourceRVIPart;
+import org.simantics.graph.tests._RVI._Role;
+import org.simantics.graph.tests._RVI._StringRVIPart;
+import org.simantics.graph.utils.TGResourceUtil;
+
+public class TestTGResourceUtil {
+       
+       
+       public @Test void test() throws Exception {
+               
+               _ResourceRVIPart part1 = new _ResourceRVIPart();
+               part1.resource = 5;
+               part1.role = _Role.CHILD;
+               
+               _StringRVIPart part2 = new _StringRVIPart();
+               part2.string = "Value";
+               part2.role = _Role.PROPERTY;
+               
+               _RVI rvi = new _RVI();
+               rvi.parts = new _RVIPart[] { part1, part2 };
+               rvi.variant = 3L;
+               
+               Binding b1 = Bindings.getBinding( _RVI.class );
+               RecordBinding b2 = Bindings.getBinding( _ResourceRVIPart.class );
+               b2.componentBindings[1].type().metadata.put("resource", "true");
+               
+               TGResourceUtil util = new TGResourceUtil();
+               util.addType( b1.type() );
+               
+               List<Long> resources = new ArrayList<Long>();
+               util.findResources(b1, rvi, resources);
+               for (Long l : resources) System.out.println("Found resource: "+l);
+               
+               // adapt resources
+               TGResourceUtil.LongAdapter la = new TGResourceUtil.LongAdapter() {
+                       @Override
+                       public long adapt(long in) {
+                               return in;
+                       }
+               };
+               util.adaptValue(b1, rvi, la);
+               
+               System.out.println("rvi = "+b1.toString(rvi));          
+       }
+       
+       
+
+}
+
+class _RVI {
+       
+       static enum _Role { CHILD, PROPERTY }   
+       public _RVIPart[] parts;
+       @Union({_ResourceRVIPart.class, _StringRVIPart.class})
+       interface _RVIPart {}
+       static class _ResourceRVIPart implements _RVIPart {
+               public _Role role;
+               public long resource;
+       }
+       static class _StringRVIPart implements _RVIPart {
+               public _Role role;
+               public String string;
+       }       
+       public Object variant;
+
 }
\ No newline at end of file