]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/scratch/org/simantics/databoard/tests/Jotakin4.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / scratch / org / simantics / databoard / tests / Jotakin4.java
1 /*******************************************************************************
2  * Copyright (c) 2010- Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  * 
9  * Contributors:
10  *    VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.tests;
13
14 import java.io.File;
15
16 import org.simantics.databoard.Bindings;
17 import org.simantics.databoard.Datatypes;
18 import org.simantics.databoard.Files;
19 import org.simantics.databoard.binding.Binding;
20 import org.simantics.databoard.type.Datatype;
21
22 public class Jotakin4 {
23
24         
25         
26         /**
27          * @param args
28          */
29         public static void main(String[] args) throws Exception {
30                 //Binding b = Bindings.getBinding(MapEntryAdded.class);
31                 
32                 
33                 Datatype type = Datatypes.getDatatype("RecordingSessionHeader");
34                 Binding binding = Bindings.getMutableBinding(type);
35                 Object value = binding.createDefault();
36                 File file = new File("D:/temp/file.txt");
37                 Files.createTextFile(file, binding, value);
38                 
39                 value = Files.readTextFile(file, binding);
40                 System.out.println(binding.printValueDefinition(value, false));
41                 
42                 /*
43                 MutableByte b = new MutableByte();
44                 Accessor a = Accessors.getAccessor(MutableByteBinding.INSTANCE, b);
45                 WireServer wireServer = new WireServer(a);
46                 Server server = new Server(0, wireServer.getMethodInterface());
47                 WireClient wireClient = new WireClient();
48                 Client client = new Client(InetAddress.getByName("localhost"), server.getPort(), wireClient.getClientMethodInterface());
49                 wireClient.setServerMethodInterface(client.getConnection().getRemoteMethodInterface());
50                 ByteAccessor ba = (ByteAccessor) wireClient.getAccessor(null);
51                 b.value = 5;
52                 
53                 assertEquals(b.value, ba.getValue());           
54                 System.out.println( ba.getValue() );
55                 
56                 ba.setValue( (byte)10 );
57                 assertEquals(b.value, ba.getValue());           
58                 System.out.println(b.byteValue());              
59 */              
60         }
61
62 }
63