1 /*******************************************************************************
2 * Copyright (c) 2010- Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.tests;
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;
22 public class Jotakin4 {
29 public static void main(String[] args) throws Exception {
30 //Binding b = Bindings.getBinding(MapEntryAdded.class);
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);
39 value = Files.readTextFile(file, binding);
40 System.out.println(binding.printValueDefinition(value, false));
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);
53 assertEquals(b.value, ba.getValue());
54 System.out.println( ba.getValue() );
56 ba.setValue( (byte)10 );
57 assertEquals(b.value, ba.getValue());
58 System.out.println(b.byteValue());