You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by gr...@apache.org on 2010/11/29 15:29:24 UTC
svn commit: r1040122 [3/4] - in /incubator/etch/trunk: ./ binding-go/
binding-go/compiler/ binding-go/compiler/src/ binding-go/compiler/src/main/
binding-go/compiler/src/main/java/ binding-go/compiler/src/main/java/org/
binding-go/compiler/src/main/jav...
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/SessionTransport.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/SessionTransport.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/SessionTransport.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/SessionTransport.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "net"
+
+type DeliveryService interface {
+ SessionMessage
+ TransportMessage
+ BeginCall(msg *Message) Mailbox
+ EndCall(mb Mailbox, ty *Type) interface{}
+}
+
+type MailboxManager interface {
+ SessionMessage
+ TransportMessage
+ TransportCall(recipient interface{}, msg *Message) Mailbox
+ Unregister(mb Mailbox)
+ Redeliver(sender interface{}, msg *Message)
+}
+
+type ServerFactory interface {
+ Session
+ Transport
+ NewServer(conn *TcpConnection)
+}
+
+type SessionListener interface {
+ Session
+ SessionAccepted(conn *net.TCPConn) bool
+}
+
+type SessionMessage interface {
+ Session
+ SessionMessage(sender interface{}, msg *Message) bool
+}
+
+type SessionPacket interface {
+ Session
+ SessionPacket(sender interface{}, buf *FlexBuffer)
+}
+
+type SessionData interface {
+ Session
+ SessionData(sender interface{}, buf *FlexBuffer)
+}
+
+type TransportMessage interface {
+ Transport
+ TransportMessage(recipient interface{}, msg *Message)
+}
+
+type TransportPacket interface {
+ Transport
+ TransportPacket(recipient interface{}, buf *FlexBuffer)
+}
+
+type TransportData interface {
+ Transport
+ TransportData(recipient interface{}, buf *FlexBuffer)
+}
+
+type Session interface {
+ SessionQuery(obj interface{}) interface{}
+ SessionControl(ctrl interface{}, value interface{}) interface{}
+ SessionNotify(obj interface{})
+}
+
+type Transport interface {
+ GetSession() Session
+ SetSession(sess Session)
+ TransportQuery(obj interface{}) interface{}
+ TransportControl(ctrl interface{}, value interface{})
+ TransportNotify(value interface{})
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/StructValue.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/StructValue.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/StructValue.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/StructValue.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+
+type StructValueIntf interface {
+ Put(field *Field, value interface{})
+ GetType() *Type
+ GetFields() *map[*Field]interface{}
+ Size() int
+}
+
+type StructValue struct {
+ Ty *Type
+ Vf ValueFactory
+ Length int
+ Fields map[*Field]interface{}
+}
+
+func NewStructValue(ty *Type, vf ValueFactory, length int) *StructValue {
+ return &StructValue{ty, vf, length, map[*Field]interface{}{}}
+}
+
+func (sv *StructValue) Size() int {
+ return sv.Length
+}
+
+func (sv *StructValue) GetType() *Type {
+ return sv.Ty
+}
+
+func (sv *StructValue) GetFields() *map[*Field]interface{} {
+ return &(sv.Fields)
+}
+
+func (sv *StructValue) Put(field *Field, value interface{}) {
+ if value == nil {
+ sv.Fields[field] = nil
+ return
+ }
+ val := sv.Ty.Validators[field.Id]
+ if val != nil && val.Validate(value) {
+ sv.Fields[field] = value
+ }
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataInput.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataInput.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataInput.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataInput.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+type TaggedDataInput interface {
+ ReadMessage(buf *FlexBuffer) *Message
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataOutput.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataOutput.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataOutput.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TaggedDataOutput.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+
+type TaggedDataOutput interface {
+ WriteMessage(msg *Message, buf *FlexBuffer)
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpConnection.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpConnection.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpConnection.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpConnection.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "net"
+import "os"
+import "fmt"
+
+type Connection interface {
+ openSocket() bool
+ readSocket()
+ closeSocket()
+ TransportData
+}
+
+//we do not distinguish between TcpConnection and TcpTransport like Java does...
+type TcpConnection struct {
+ address string
+ session SessionData
+ status int
+ isServer bool
+ connection *net.TCPConn
+ buf *FlexBuffer
+}
+
+func NewTcpConnection(address string, isServer bool, session SessionData, socket *net.TCPConn) *TcpConnection {
+ return &TcpConnection{address, session, DOWN, isServer, socket, NewFlexBuffer()}
+}
+
+
+func (tcpc *TcpConnection) openSocket() bool {
+ var er os.Error = nil
+ if tcpc.isServer {
+ if tcpc.connection != nil {
+ Log("SERVER CONNECTION, GOING UP DIRECTLY\n")
+ tcpc.status = UP
+ return true
+ }
+ } else {
+ addr, _ := net.ResolveTCPAddr(tcpc.address)
+
+ tcpc.connection, er = net.DialTCP("tcp", nil, addr)
+ tcpc.connection.SetLinger(0)
+ if er != nil {
+ Log("TcpConnection: error with client socket " + fmt.Sprint(er) + "\n")
+ return false
+ }
+ Log("TcpConnection: open socket client success, before notify, connection is " + fmt.Sprint(tcpc.connection) + " \n")
+ tcpc.status = UP
+ tcpc.GetSession().SessionNotify(UP)
+ Log("TcpConnection: open socket client success\n")
+ }
+
+ return true
+}
+
+
+func (tcpc *TcpConnection) readSocket() {
+ buffer := make([]byte, 8192)
+ for tcpc.status != DOWN {
+ Log("TcpConnection in readSocket\n")
+ n, er := tcpc.connection.Read(buffer)
+ Log("TcpConnection in after readSocket: " + fmt.Sprint(n) + "\n")
+ if er != nil {
+ Log("TcpConnection readSocket error: " + fmt.Sprint(er) + "\n")
+ tcpc.status = DOWN
+ }
+
+ tcpc.buf.PutBytes(buffer[0:n])
+ tcpc.buf.Index = 0
+ Log("TcpConnection: got " + fmt.Sprint(n) + " bytes data " + fmt.Sprint(tcpc.buf.avail()) + " " + fmt.Sprint(tcpc.buf) + "\n")
+ tcpc.GetSession().(SessionData).SessionData(nil, tcpc.buf)
+ tcpc.buf.Index = 0
+ tcpc.buf.Length = 0
+ }
+}
+
+func (tcpc *TcpConnection) closeSocket() {
+ Log("TcpConnection CLOSING SOCKET\n")
+ tcpc.connection.Close()
+ tcpc.GetSession().SessionNotify(DOWN)
+ Log("TcpConnection CLOSING SOCKET DOWN, session notify sent\n")
+}
+
+
+func (tcpc *TcpConnection) GetSession() Session {
+ return tcpc.session
+}
+
+func (tcpc *TcpConnection) SetSession(sess Session) {
+ tcpc.session = sess.(SessionData)
+}
+
+func (tcpc *TcpConnection) TransportData(recipient interface{}, buf *FlexBuffer) {
+ Log("TcpConnection sending data\n")
+ avail := buf.avail()
+ bytes := make([]byte, buf.avail())
+ buf.ReadBytes(&bytes)
+ Log("TcpConnection: sending: #" + fmt.Sprint(len(bytes)) + " " + fmt.Sprint(bytes) + "\n")
+ n, er := tcpc.connection.Write(bytes)
+ if er != nil || n != int(avail) {
+ Log("TcpConnection " + fmt.Sprint(tcpc.isServer) + " : error while sending with " + fmt.Sprint(tcpc.connection) +
+ " Error was: " + fmt.Sprint(er) + ", sent " + fmt.Sprint(n) + "/" + fmt.Sprint(avail) + " bytes\n")
+ }
+}
+
+func (tcpc *TcpConnection) TransportQuery(obj interface{}) interface{} {
+ //nothing to do (java binding allow query of addresses, TODO)
+ return nil
+}
+
+func (tcpc *TcpConnection) TransportControl(ctrl interface{}, value interface{}) {
+ Log("TcpConnection: transportControl: " + fmt.Sprint(ctrl) + "\n")
+
+ if ctrl == START {
+ Log("TcpConnection: transportControl: " + fmt.Sprint(ctrl) + "\n")
+ go tcpc.start()
+ } else if ctrl == STOP {
+ tcpc.stop()
+ }
+}
+
+func (tcpc *TcpConnection) TransportNotify(value interface{}) {
+ //nothing to do
+}
+
+func (tcpc *TcpConnection) start() {
+ ok := tcpc.openSocket()
+ if ok == false {
+ return
+ }
+ tcpc.readSocket()
+}
+
+func (tcpc *TcpConnection) stop() {
+ Log("TcpConnection: stopping\n")
+ tcpc.closeSocket()
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpListener.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpListener.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpListener.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TcpListener.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "net"
+import "os"
+import "fmt"
+
+type TcpListener struct {
+ address string
+ session SessionListener
+ status int
+ listener *net.TCPListener
+}
+
+func NewTcpListener(address string) *TcpListener {
+ return &TcpListener{address, nil, DOWN, nil}
+}
+
+func (tcpl *TcpListener) openSocket() bool {
+ var er os.Error = nil
+ addr, _ := net.ResolveTCPAddr(tcpl.address)
+ tcpl.listener, er = net.ListenTCP("tcp", addr)
+ if er != nil {
+ tcpl.status = DOWN
+ return false
+ }
+
+ return true
+}
+
+func (tcpl *TcpListener) readSocket() {
+ tcpl.GetSession().SessionNotify(UP)
+ for tcpl.status != DOWN {
+ Log("TcpListener before accept\n")
+ connection, er := tcpl.listener.AcceptTCP()
+ connection.SetLinger(0)
+ if er != nil {
+ Log("TcpListener DOWN\n")
+ tcpl.status = DOWN
+ break
+ } else {
+ tcpl.session.SessionAccepted(connection)
+ }
+ }
+}
+
+func (tcpl *TcpListener) closeSocket() {
+ tcpl.listener.Close()
+ tcpl.GetSession().SessionNotify(DOWN)
+}
+
+func (tcpl *TcpListener) GetSession() Session {
+ return tcpl.session
+}
+
+func (tcpl *TcpListener) SetSession(sess Session) {
+ tcpl.session = sess.(SessionListener)
+}
+
+func (tcpl *TcpListener) TransportQuery(obj interface{}) interface{} {
+ //nothing to do (java binding allow query of addresses, TODO)
+ return nil
+}
+
+
+func (tcpl *TcpListener) TransportControl(ctrl interface{}, value interface{}) {
+ Log("TcpListener: transportControl: " + fmt.Sprint(ctrl) + "\n")
+ if ctrl == START {
+ go tcpl.start()
+ } else if ctrl == STOP {
+ tcpl.stop()
+ }
+}
+
+func (tcpl *TcpListener) TransportNotify(value interface{}) {
+ //nothing to do
+}
+
+func (tcpl *TcpListener) start() {
+ ok := tcpl.openSocket()
+ if ok == false {
+ Log("TcpListener error opening listener socket\n")
+ return
+ }
+ tcpl.status = UP
+ tcpl.readSocket()
+}
+
+func (tcpl *TcpListener) stop() {
+ tcpl.closeSocket()
+}
+
+//************************************************************************
+
+type DefaultSessionListener struct {
+ transport Transport
+ session ServerFactory
+ status chan interface{}
+}
+
+func NewDefaultSessionListener(trans Transport) *DefaultSessionListener {
+ return &DefaultSessionListener{trans, nil, make(chan interface{}, 1)}
+}
+
+func (dsl *DefaultSessionListener) waitUntil(value int, timeout int) {
+ WaitOnChannel(value, timeout, dsl.status)
+}
+
+func (dsl *DefaultSessionListener) SessionAccepted(conn *net.TCPConn) bool {
+ Log("DefaultSessionListener: SessionAccepted\n")
+ connection := NewTcpConnection("", true, nil, conn)
+ dsl.session.NewServer(connection)
+ return true
+}
+
+func (dsl *DefaultSessionListener) SessionQuery(obj interface{}) interface{} {
+ return dsl.session.SessionQuery(obj)
+}
+
+func (dsl *DefaultSessionListener) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return dsl.session.SessionControl(ctrl, value)
+}
+
+func (dsl *DefaultSessionListener) SessionNotify(obj interface{}) {
+ defer EtchRecoverAll()
+ if obj.(int) == UP {
+ dsl.status <- UP
+ } else if obj.(int) == DOWN {
+ dsl.status <- DOWN
+ }
+ dsl.session.SessionNotify(obj)
+}
+
+func (dsl *DefaultSessionListener) GetSession() Session {
+ return dsl.session
+}
+
+func (dsl *DefaultSessionListener) SetSession(sess Session) {
+ dsl.session = sess.(ServerFactory)
+}
+
+func (dsl *DefaultSessionListener) TransportQuery(obj interface{}) interface{} {
+ return dsl.transport.TransportQuery(obj)
+}
+
+func (dsl *DefaultSessionListener) TransportControl(ctrl interface{}, value interface{}) {
+ Log("DefaultSessionListener transportcontrol\n")
+ if ctrl.(int) == START_AND_WAIT_UP {
+ Log("DefaultSessionListener: transportControl: START_AND_WAIT_UP\n")
+ dsl.transport.TransportControl(START, nil)
+ dsl.waitUntil(UP, value.(int))
+ } else if ctrl.(int) == STOP_AND_WAIT_DOWN {
+ dsl.transport.TransportControl(STOP, nil)
+ dsl.waitUntil(DOWN, value.(int))
+ } else {
+ dsl.transport.TransportControl(ctrl, value)
+ }
+}
+
+func (dsl *DefaultSessionListener) TransportNotify(value interface{}) {
+ dsl.transport.TransportNotify(value)
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Type.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Type.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Type.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Type.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+const (
+ QUEUED int = 0
+ FREE int = 0
+ MODE_NONE int = 1
+)
+
+type Type struct {
+ Id int32
+ Name string
+ Validators map[int32]Validator
+ Fields map[int32]*Field
+ RType *Type
+ Helper ImportExportHelper
+ StubHelper interface{}
+ Timeout int
+ ResponseField *Field
+ SuperType *Type
+ Direction Direction
+ AsyncMode int
+ NewArray func(length int32) interface{}
+}
+
+func NewTypeByName(Name string) *Type {
+ return NewType(hash(Name), Name)
+}
+
+func NewType(Id int32, Name string) *Type {
+ return &Type{Id, Name, map[int32]Validator{}, map[int32]*Field{}, nil, nil, nil, 1, nil, nil, BOTH, MODE_NONE, nil}
+}
+
+func (ty *Type) PutValidator(field *Field, vldtr Validator) {
+ exf := ty.Fields[field.Id]
+ if exf == nil {
+ ty.Fields[field.Id] = field
+ }
+ exv := ty.Validators[field.Id]
+ if exv != nil {
+ //ty.Validators[field] = newComboValidator(exv, vldtr)
+ ty.Validators[field.Id] = vldtr
+ }
+ if exv == nil {
+ ty.Validators[field.Id] = vldtr
+ }
+}
+
+func (ty *Type) ClearValidator(field *Field) {
+ ty.Validators[field.Id] = nil, false
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TypeMap.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TypeMap.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TypeMap.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/TypeMap.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "fmt"
+
+type TypeMap struct {
+ byId map[int32]*Type
+ byName map[string]*Type
+}
+
+func NewTypeMap() *TypeMap {
+ return &TypeMap{map[int32]*Type{}, map[string]*Type{}}
+}
+
+func (tm *TypeMap) GetById(id int32) *Type {
+ Log("TypeMap GetById " + fmt.Sprint(id) + " in: " + fmt.Sprint(tm.byId) + "\n")
+ val := tm.byId[id]
+ return val
+}
+
+func (tm *TypeMap) GetByName(name string) *Type {
+ //Log("TypeMap GetByName " + name + " in: " + fmt.Sprint(tm.byName) + "\n")
+
+ val := tm.byName[name]
+ if val == nil {
+ Log("TypeMap adding new Type " + name + "\n")
+ val, _ = tm.Add(tm.MakeNew(name))
+ }
+ return val
+}
+
+func (tm *TypeMap) GetByNameNoAdd(name string) *Type {
+ return tm.byName[name]
+}
+
+
+func (tm *TypeMap) Add(value *Type) (*Type, string) {
+ if tm.byId[value.Id] != nil {
+ return nil, "id collision"
+ }
+ if tm.byName[value.Name] != nil {
+ return nil, "name collision"
+ }
+
+ Log("TypeMap adding " + fmt.Sprint(value.Id) + " " + value.Name + "\n")
+ tm.byId[value.Id] = value
+ tm.byName[value.Name] = value
+ return value, "ok"
+}
+
+func (tm *TypeMap) MakeNew(name string) *Type {
+ return NewType(hash(name), name)
+}
+
+func (tm *TypeMap) GetAll() []*Type {
+ ret := make([]*Type, len(tm.byId))
+ i := 0
+ for _, v := range tm.byId {
+ ret[i] = v
+ i++
+ }
+ return ret
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Util.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Util.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Util.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Util.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "time"
+
+func WaitOnChannel(value interface{}, timeout int, channel chan interface{}) interface{} {
+ timeoutchan := make(chan bool, 1)
+ go func() {
+ time.Sleep(1e6 * int64(timeout)) // one second
+ timeoutchan <- true
+ }()
+ var channelValue interface{} = nil
+ if value == nil {
+ select {
+ case channelValue = <-channel:
+ return channelValue
+ case <-timeoutchan:
+ return nil
+ }
+ } else { //wait for a specific value
+ for channelValue != value {
+ select {
+ case channelValue = <-channel:
+ case <-timeoutchan:
+ return nil
+ }
+ }
+ return channelValue
+ }
+ return nil
+}
+
+func EtchRecoverAll() {
+ recover()
+}
+
+
+
+
+func Toint8(val interface{}) int8 {
+ switch val.(type) {
+ case int:
+ return int8(val.(int))
+ case int8:
+ return val.(int8)
+ case int16:
+ return int8(val.(int16))
+ case int32:
+ return int8(val.(int32))
+ case int64:
+ return int8(val.(int64))
+ }
+ return 0
+}
+
+func Toint16(val interface{}) int16 {
+ switch val.(type) {
+ case int:
+ return int16(val.(int))
+ case int8:
+ return int16(val.(int8))
+ case int16:
+ return int16(val.(int16))
+ case int32:
+ return int16(val.(int32))
+ case int64:
+ return int16(val.(int64))
+ }
+ return 0
+}
+
+func Toint32(val interface{}) int32 {
+ switch val.(type) {
+ case int:
+ return int32(val.(int))
+ case int8:
+ return int32(val.(int8))
+ case int16:
+ return int32(val.(int16))
+ case int32:
+ return int32(val.(int32))
+ case int64:
+ return int32(val.(int64))
+ }
+ return 0
+}
+
+func Toint64(val interface{}) int64 {
+ switch val.(type) {
+ case int:
+ return int64(val.(int))
+ case int8:
+ return int64(val.(int8))
+ case int16:
+ return int64(val.(int16))
+ case int32:
+ return int64(val.(int32))
+ case int64:
+ return int64(val.(int64))
+ }
+ return 0
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Validator.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Validator.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Validator.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/Validator.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+type Validator interface {
+ Validate(value interface{}) bool
+ ValidateValue(value interface{}) interface{}
+}
Added: incubator/etch/trunk/binding-go/runtime/src/main/go/etch/ValueFactory.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/main/go/etch/ValueFactory.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/main/go/etch/ValueFactory.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/main/go/etch/ValueFactory.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package etch
+
+import "reflect"
+
+type ValueFactory interface {
+ GetTypeById(id int32) *Type
+ GetTypeByName(name string) *Type
+ AddField(field *Field)
+ GetFieldByName(name string) *Field
+ GetClass2type() *map[reflect.Type]*Type
+ AddType(ty *Type)
+ GetTypes() []*Type
+ GetMessageId(msg *Message) int64
+ SetMessageId(msg *Message, msgId int64)
+ GetInReplyTo(msg *Message) int64
+ SetInReplyTo(msg *Message, msgId int64)
+ ExportCustomValue(value interface{}) *StructValue
+ ImportCustomValue(value *StructValue) interface{}
+ GetCustomStructType(obj reflect.Type) *Type
+ GetDefaultResponseField() *Field
+ GetDefaultInReplyToField() *Field
+ GetDefaultMessageIdField() *Field
+ NewArrayForType(typeCode int8, cTy *Type, length int32) interface{}
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Arrayvalue_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Arrayvalue_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Arrayvalue_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Arrayvalue_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+
+type dummyStruct struct {
+ x int
+}
+
+func TestArrayValue() {
+
+ Log("*************************************************\n")
+ ar := []byte{1,2,3}
+ av := NewArrayValueWith(ar, 42, nil)
+ Log(fmt.Sprint(av) + "\n")
+ Log(fmt.Sprint(av.ArrayVal) + "\n")
+
+ fav := FromArrayValue(av)
+ Log(fmt.Sprint(fav) + "\n")
+
+ switch fav.(type) {
+ case []byte: Log("BYTE ARRAY\n")
+ default: Error("Wrong type of array \n")
+ }
+
+
+ Log("*************************************************\n")
+
+ iarray := make([]interface{}, 3)
+ nav := NewArrayValueWith(iarray, 42, nil)
+ nav.Set(0, int(1))
+ nav.Set(1, int(2))
+ nav.Set(2, int(3))
+ nfav := FromArrayValue(nav)
+ Log(fmt.Sprint(nfav) + "\n")
+
+ Log(fmt.Sprint(nfav.([]interface{})[1]) + "\n")
+
+ switch nfav.(type) {
+ case []interface{}: Log("INTERFACE ARRAY\n")
+ default: Error("Wrong type of array \n")
+ }
+
+ Log("*************************************************\n")
+ iarray2 := make([]*dummyStruct, 3)
+
+ nav2 := NewArrayValueWith(iarray2, 42, nil)
+ nav2.Set(0, &dummyStruct{42})
+ nav2.Set(1, &dummyStruct{43})
+ nav2.Set(2, &dummyStruct{44})
+
+ nfav2 := FromArrayValue(nav2)
+ Log(fmt.Sprint(nav2) + "\n")
+ Log(fmt.Sprint(nav2.Get(1)) + "\n")
+ Log(fmt.Sprint(nfav2) + "\n")
+
+ switch nfav2.(type) {
+ case []*dummyStruct: Log("DUMMY ARRAY\n")
+ default: Error("Wrong type of array \n")
+ }
+ Log("*************************************************\n")
+ Log("Arrayvalue test done\n")
+}
\ No newline at end of file
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataInput_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataInput_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataInput_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataInput_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+
+func TestBinaryTaggedDataInput() {
+ bys := []int8{3, -122, 15, 55, -87, 114, 2, -122, -10, -53, -14, -99, 56, -122, -10, -53, -14, -100, 55, -127}
+
+ buf := NewFlexBuffer()
+ buf.Put(bys)
+
+ dvf := NewDefaultValueFactory()
+ ty := dvf.GetTypeByName("type1")
+ f1 := NewField("field1")
+ f2 := NewField("field2")
+
+ dv1 := new(dummyVal)
+ dv2 := new(dummyVal)
+ ty.PutValidator(f1, dv1)
+ ty.PutValidator(f2, dv2)
+
+ btdi := NewBinaryTaggedDataInput(dvf)
+
+ buf.Index = 0
+ // test written message
+ msg := btdi.ReadMessage(buf)
+
+ if msg.GetType().Id != ty.Id {
+ Error("BTDI Error with msg id")
+ }
+
+ if msg.Length != 2 {
+ Error("BTDI Error with msg length")
+ }
+
+ if msg.Fields[f1].(int8) != 55 {
+ Error("BTDI Error with f1: " + fmt.Sprint(msg.Fields[f1]) + "\n")
+ }
+
+ if msg.Fields[f2].(int8) != 56 {
+ Error("BTDI Error with f2: " + fmt.Sprint(msg.Fields[f2]) + "\n")
+ }
+
+ Log(fmt.Sprint(msg) + "\n")
+
+ Log("TestBinaryTaggedDataInput done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataOutput_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataOutput_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataOutput_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/BinaryTaggedDataOutput_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+
+func TestBinaryTaggedDataOutput() {
+
+ btdo := NewBinaryTaggedDataOutput(nil)
+
+ ty := NewTypeByName("type1")
+
+ f1 := NewField("field1")
+ f2 := NewField("field2")
+
+ dv1 := new(dummyVal)
+ dv2 := new(dummyVal)
+
+ ty.PutValidator(f1, dv1)
+ ty.PutValidator(f2, dv2)
+
+ msg := NewMessage(ty, nil, 2)
+ msg.Put(f1, int8(55))
+ msg.Put(f2, int8(56))
+
+ buf := NewFlexBuffer()
+
+ btdo.WriteMessage(msg, buf)
+
+ // test written message
+
+
+ buf.Index = 0
+ buf.Length = 20
+ retBytes := make([]int8, 20)
+ buf.ReadSBytes(&retBytes)
+
+ if retBytes[0] != 3 ||
+ retBytes[1] != -122 ||
+ retBytes[2] != 15 {
+ Error("Error in BTDO")
+ }
+ Log(fmt.Sprint(retBytes) + "\n")
+
+ Log("TestBinaryTaggedDataOutput done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultDeliveryService_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultDeliveryService_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultDeliveryService_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultDeliveryService_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+
+func TestDefaultDeliveryService() {
+
+ Log("TestDefaultDeliveryService done.\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultValueFactory_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultValueFactory_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultValueFactory_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/DefaultValueFactory_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+
+func TestDefaultValueFactory() {
+ dvf := NewDefaultValueFactory()
+
+ ty1 := dvf.Types.GetByName(MSG_FIELD_NAME)
+
+ if ty1.Id != 0x2de1755c {
+ Error("wrong hash for msg")
+ }
+ Log("TestDefaultValueFactory done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/EtchStub_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/EtchStub_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/EtchStub_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/EtchStub_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+
+func TestEtchStub() {
+ stub := NewEtchStub(nil, nil)
+ stub.SessionControl(5, 2)
+
+ Log("TestEtchStub done.\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Flexbuffer_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Flexbuffer_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Flexbuffer_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Flexbuffer_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+
+import . "etch"
+import "fmt"
+
+func TestFlexBuffer() {
+ fb := NewFlexBuffer()
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutInt(42)
+
+ fb.Index = 0
+ if fb.Avail() != 4 {
+ Error("Error in Flexbuffer avail int " + fmt.Sprint(fb.Avail()) + "\n")
+ }
+ resInt := fb.ReadInt()
+ if resInt != 42 {
+ Error("Error in Flexbuffer int " + fmt.Sprint(resInt) + "\n")
+ }
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutShort(int16(42))
+
+ fb.Index = 0
+ if fb.Avail() != 2 {
+ Error("Error in Flexbuffer avail short " + fmt.Sprint(fb.Avail()) + "\n")
+ }
+ resShort := fb.ReadShort()
+ if resShort != int16(42) {
+ Error("Error in Flexbuffer short")
+ }
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutLong(int64(42))
+
+ fb.Index = 0
+ if fb.Avail() != 8 {
+ Error("Error in Flexbuffer avail long " + fmt.Sprint(fb.Avail()) + "\n")
+ }
+ resLong := fb.ReadLong()
+ if resLong != int64(42) {
+ Error("Error in Flexbuffer long")
+ }
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutFloat(float32(42.0))
+
+
+ fb.Index = 0
+ if fb.Avail() != 4 {
+ Error("Error in Flexbuffer avail float " + fmt.Sprint(fb.Avail()) + "\n")
+ }
+ resFloat := fb.ReadFloat()
+ if resFloat != float32(42.0) {
+ Error("Error in Flexbuffer float")
+ }
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutDouble(float64(42.0))
+
+
+ fb.Index = 0
+ if fb.Avail() != 8 {
+ Error("Error in Flexbuffer avail double" + fmt.Sprint(fb.Avail()) + "\n")
+ }
+ resDouble := fb.ReadDouble()
+ if resDouble != float64(42.0) {
+ Error("Error in Flexbuffer double")
+ }
+
+ fb.Index = 0
+ fb.Length = 0
+ fb.PutBytes([]uint8{1, 2, 3})
+
+ fb.Index = 0
+ if fb.Avail() != 3 {
+ Error("Error in Flexbuffer avail bytes " + fmt.Sprint(fb.Avail()) + "\n")
+ }
+
+ retBytes := make([]uint8, 3)
+ fb.ReadBytes(&retBytes)
+ if retBytes[0] != 1 ||
+ retBytes[1] != 2 ||
+ retBytes[2] != 3 {
+ Error("Error in Flexbuffer bytes")
+ }
+
+// fb.Index = 0
+// for i := 0; i < 2048; i++ {
+// fb.PutByte(int8(i))
+// }
+//
+// fb.Index = 0
+// if fb.Avail() != 2048 {
+// Error("Error in Flexbuffer avail " + fmt.Sprint(fb.Avail()) + "\n")
+// }
+// for i := 0; i < 2048; i++ {
+// res := fb.ReadByte()
+// if res != int8(i) {
+// Error("Error in Flexbuffer: " + fmt.Sprint(i) + ": " + fmt.Sprint(res) + "\n")
+// }
+//
+// }
+//
+ Log("TestFlexBuffer done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Integration_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Integration_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Integration_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Integration_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+import "time"
+
+type dummyValueFactory struct {
+ ValueFactory
+ Mf_f1 *Field
+ Mf_f2 *Field
+}
+
+func NewDummyValueFactory() *dummyValueFactory {
+ ret := &dummyValueFactory{NewDefaultValueFactory(), nil, nil}
+
+ var ty *Type = NewTypeByName("type1")
+ var rty *Type = NewTypeByName("returntype1")
+
+ ret.Mf_f1 = NewField("field1")
+ ret.Mf_f2 = NewField("field2")
+
+ dv2 := new(dummyVal)
+ ty.PutValidator(ret.Mf_f1, dv2)
+ ty.PutValidator(ret.Mf_f2, dv2)
+ ty.PutValidator(ret.GetDefaultMessageIdField(), dv2)
+ ty.RType = rty
+
+ rty.ResponseField = ret.GetDefaultResponseField()
+ rty.PutValidator(ret.GetDefaultResponseField(), dv2)
+ rty.PutValidator(ret.GetDefaultInReplyToField(), dv2)
+ rty.PutValidator(ret.GetDefaultMessageIdField(), dv2)
+
+ ret.AddType(ty)
+ ret.AddType(rty)
+
+ return ret
+}
+
+//*****************************************************************************************
+
+type dummyServerFactory struct {
+ session Session
+ transport Transport
+}
+
+func NewDummyServerFactory(transport Transport) *dummyServerFactory {
+ val := &dummyServerFactory{nil, transport}
+ return val
+}
+
+
+func (dsf *dummyServerFactory) NewServer(connection *TcpConnection) {
+ Log("dummyServerFactory: newServer\n")
+ ptzr := NewPacketizer(connection, 10*1024)
+ connection.SetSession(ptzr)
+ dvf := NewDummyValueFactory()
+ msgzr := NewMessagizer(dvf, ptzr)
+ ptzr.SetSession(msgzr)
+ mbm := NewPlainMailboxManager(nil, msgzr)
+ msgzr.SetSession(mbm)
+ dsvc := NewDefaultDeliveryService(mbm, nil)
+ mbm.SetSession(dsvc)
+ stub := NewEtchStub(dsvc, nil)
+ dsvc.SetSession(stub)
+ stub.Impl = new(dummyImpl)
+
+ dvf.GetTypeByName("type1").StubHelper = new(dummyHelper)
+
+ Log("dummyServerFactory: STARTING TRANSPORT CONTROL\n")
+ //no wait up on server
+ dsvc.TransportControl(START, 4000)
+}
+
+
+func (dsf *dummyServerFactory) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dsf *dummyServerFactory) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+func (dsf *dummyServerFactory) SessionNotify(obj interface{}) {
+ Log("dummyServerFactory sessionnotify\n")
+}
+
+func (dsf *dummyServerFactory) GetSession() Session {
+ return nil
+}
+
+func (dsf *dummyServerFactory) SetSession(sess Session) {
+
+}
+
+func (dsf *dummyServerFactory) TransportQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dsf *dummyServerFactory) TransportControl(ctrl interface{}, value interface{}) {
+ Log("dummyServerFactory transportcontrol\n")
+ dsf.transport.TransportControl(ctrl, value)
+}
+
+func (dsf *dummyServerFactory) TransportNotify(value interface{}) {
+
+}
+
+//****************************************************
+
+
+type dummyHelper struct{}
+
+func toInteger(val interface{}) int32 {
+ switch val.(type) {
+ case int:
+ return int32(val.(int))
+ case int8:
+ return int32(val.(int8))
+ case int16:
+ return int32(val.(int16))
+ case int32:
+ return int32(val.(int32))
+ case int64:
+ return int32(val.(int64))
+ }
+ return 0
+}
+
+
+func (dh *dummyHelper) run(svc DeliveryService, impl interface{}, sender interface{}, msg *Message) {
+ Log("dummyHelper got message: " + fmt.Sprint(msg) + "\n")
+ rmsg := msg.Reply()
+ di := impl.(*dummyImpl)
+ f1 := msg.Vf.(*dummyValueFactory).Mf_f1
+ f2 := msg.Vf.(*dummyValueFactory).Mf_f2
+
+ ret := di.dummyFunc(toInteger(msg.Fields[f1]), toInteger(msg.Fields[f2]))
+ rmsg.Put(msg.Vf.GetDefaultResponseField(), ret)
+ svc.TransportMessage(sender, rmsg)
+}
+
+type dummyImpl struct{}
+
+func (di *dummyImpl) dummyFunc(param1 int32, param2 int32) int32 {
+ Log("HEUREKA, this is the call\n")
+ return param1 + param2
+}
+
+
+func TestIntegration() {
+ //start server
+ Log("****************************************************** STARTING SERVER\n")
+ tl := NewTcpListener("127.0.0.1:4001")
+ dsl := NewDefaultSessionListener(tl)
+ tl.SetSession(dsl)
+ sf := NewDummyServerFactory(dsl)
+ dsl.SetSession(sf)
+ sf.TransportControl(START_AND_WAIT_UP, 4000)
+ Log("****************************************************** STARTING SERVER DONE\n")
+ Log("****************************************************** INITIALIZING CLIENT\n")
+
+ //start client
+ tcpClientConn := NewTcpConnection("127.0.0.1:4001", false, nil, nil)
+ _, cdvf, cdsvc := buildStack(tcpClientConn)
+ Log("****************************************************** STARTING CLIENT TRANSPORT CONTROL WAITUP\n")
+ cdsvc.TransportControl(START_AND_WAIT_UP, 4000)
+ Log("****************************************************** STARTING CLIENT TRANSPORT CONTROL WAITUP DONE\n")
+ msg := NewMessage(cdvf.GetTypeByName("type1"), cdvf, 2)
+ msg.Put(cdvf.(*dummyValueFactory).Mf_f1, int8(55))
+ msg.Put(cdvf.(*dummyValueFactory).Mf_f2, int8(56))
+
+ start := time.Nanoseconds()
+ for i := 0; i < 10; i++ {
+ doCall(msg, cdsvc, cdvf.GetTypeByName("returntype1"), i)
+ }
+ end := time.Nanoseconds()
+ fmt.Printf("10 calls took " + fmt.Sprint((end-start)/1e6) + " ms\n")
+ Log("Integration Test done\n")
+}
+
+
+func doCall(msg *Message, cdsvc DeliveryService, rty *Type, i int) {
+ Log("****************************************************** " + fmt.Sprint(i) + " CLIENT BEGIN CALL\n")
+ mb := cdsvc.BeginCall(msg)
+
+ if mb == nil {
+ Error("IntegrationTest: BeginCall gives null mailbox\n")
+ }
+
+ Log("****************************************************** " + fmt.Sprint(i) + " CLIENT END CALL\n")
+ retVal := cdsvc.EndCall(mb, rty)
+ Log("****************************************************** " + fmt.Sprint(i) + " CLIENT END CALL DONE\n")
+ if retVal != int8(111) {
+ Error("IntegrationTest: Answer was wrong " + fmt.Sprint(retVal) + "\n")
+ } else {
+ Log("****************************************************** " + fmt.Sprint(i) + " CALL SUCCESS\n")
+ }
+}
+
+func buildStack(conn *TcpConnection) (*EtchStub, ValueFactory, DeliveryService) {
+ ptzr := NewPacketizer(conn, 10*1024)
+ conn.SetSession(ptzr)
+ dvf := NewDummyValueFactory()
+ msgzr := NewMessagizer(dvf, ptzr)
+ ptzr.SetSession(msgzr)
+ mbm := NewPlainMailboxManager(nil, msgzr)
+ msgzr.SetSession(mbm)
+ dsvc := NewDefaultDeliveryService(mbm, nil)
+ mbm.SetSession(dsvc)
+ stub := NewEtchStub(dsvc, nil)
+ dsvc.SetSession(stub)
+ return stub, dvf, dsvc
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Makefile
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Makefile?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Makefile (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Makefile Mon Nov 29 14:29:21 2010
@@ -0,0 +1,40 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+TESTFILES= \
+ Arrayvalue_test.go\
+ DefaultValueFactory_test.go\
+ Type_test.go\
+ StructValue_test.go\
+ PlainMailBox_test.go\
+ Flexbuffer_test.go\
+ BinaryTaggedDataOutput_test.go\
+ BinaryTaggedDataInput_test.go\
+ Packetizer_test.go\
+ EtchStub_test.go\
+ PlainMailBoxManager_test.go\
+ DefaultDeliveryService_test.go\
+ Integration_test.go\
+
+all: testfiles
+ 8g -o test.8 -I ../../main/go/etch -I . testmain.go
+ 8l -L ../../main/go/etch -L . -o test test.8
+
+
+testfiles: ${TESTFILES}
+ 8g -o goetchtest.8 -I ../../main/go/etch -I . ${TESTFILES}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Packetizer_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Packetizer_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Packetizer_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Packetizer_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+import "bytes"
+
+func TestPacketizer() {
+ dt := new(dummyTransport)
+ ds := new(dummySessionPacket)
+
+ ptzr := NewPacketizer(dt, 10*1024)
+ ptzr.SetSession(ds)
+ fb := NewFlexBuffer()
+ //skip header
+ fb.Index = 8
+ fb.PutBytes([]uint8{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
+ fb.Index = 0
+ ptzr.TransportPacket(1, fb)
+
+ dt.Buf.Index = 0
+ retBytes := make([]uint8, 18)
+ dt.Buf.ReadBytes(&retBytes)
+ Log("bytes from Packetizer->Transport: " + fmt.Sprint(retBytes) + "\n")
+
+ if bytes.Compare(retBytes[0:4], []uint8{0xde, 0xad, 0xbe, 0xef}) != 0 {
+ Error("Error in Packetizer: wrong sig\n")
+ }
+
+ if bytes.Compare(retBytes[4:8], []uint8{0, 0, 0, 10}) != 0 {
+ Error("Error in Packetizer: wrong length " + fmt.Sprint(retBytes[4:8]) +"\n")
+ }
+
+ fbs := NewFlexBuffer()
+ fbs.PutSBytes([]int8{-34, -83, -66, -17, 0, 0, 0, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
+ fbs.Index = 0
+ ptzr.SessionData(1, fbs)
+
+ retBytes2 := make([]uint8, 10)
+ ds.Buf.ReadBytes(&retBytes2)
+ //{-34,-83,-66,-17,0,0,0,10,1,2,3,4,5,6,7,8,9,10}
+ Log("bytes from Packetizer->Session: " + fmt.Sprint(retBytes2) + "\n")
+
+ if bytes.Compare(retBytes2[0:10], []uint8{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) != 0 {
+ Error("Error in Packetizer: wrong packet\n")
+ }
+
+}
+
+type dummySessionPacket struct {
+ Buf *FlexBuffer
+}
+
+func (ds *dummySessionPacket) SessionPacket(sender interface{}, buf *FlexBuffer) {
+ ds.Buf = buf
+}
+
+func (ds *dummySessionPacket) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (ds *dummySessionPacket) SessionNotify(obj interface{}) {
+}
+
+func (ds *dummySessionPacket) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+
+type dummyTransport struct {
+ Buf *FlexBuffer
+}
+
+
+func (dt *dummyTransport) TransportData(recipient interface{}, buf *FlexBuffer) {
+ Log("DummyTransport TransportData\n")
+ dt.Buf = buf
+}
+
+func (dt *dummyTransport) GetSession() Session {
+ return nil
+}
+
+func (dt *dummyTransport) SetSession(sess Session) {
+}
+
+func (dt *dummyTransport) TransportQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dt *dummyTransport) TransportControl(ctrl interface{}, value interface{}) {
+}
+
+func (dt *dummyTransport) TransportNotify(value interface{}) {
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBoxManager_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBoxManager_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBoxManager_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBoxManager_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+import "fmt"
+
+
+func TestPlainMailBoxManager() {
+ dt := new(dummyTransportMessage)
+ ds := new(dummySessionMessage)
+
+ mbm := NewPlainMailboxManager(ds, dt)
+
+ dvf := NewDefaultValueFactory()
+ ty := NewTypeByName("type1")
+ f1 := NewField("field1")
+ f2 := NewField("field2")
+ dv1 := new(dummyVal)
+ dv2 := new(dummyVal)
+ ty.PutValidator(f1, dv1)
+ ty.PutValidator(f2, dv2)
+ msg := NewMessage(ty, dvf, 2)
+ msg.Put(f1, int8(55))
+ msg.Put(f2, int8(56))
+
+ mb := mbm.TransportCall(23, msg)
+
+ if mb == nil {
+ Error("PlainMailboxManager: Got null mailbox on transportcall\n")
+ }
+
+ msgIDmb := mb.GetMessageId()
+ msgIDmsg := msg.Vf.GetMessageId(msg)
+
+ //this relies on this test being the first one to call nextId...
+ if msgIDmb != msgIDmsg || msgIDmb != 43 {
+ Error("PlainMailboxManager: Got wrong message id in transportcall, " + fmt.Sprint(msgIDmb) + " vs. " + fmt.Sprint(msgIDmsg) + "\n")
+ }
+
+ msg2 := msg.Reply()
+ mbm.SessionMessage(44, msg2)
+
+ elem := mb.Read()
+
+ if elem.Msg != msg2 {
+ Error("PlainMailboxManager: Got wrong reply\n")
+ }
+
+ Log("TestPlainMailBoxManager done. \n")
+}
+
+
+type dummySessionMessage struct {
+ msg *Message
+}
+
+func (ds *dummySessionMessage) SessionMessage(sender interface{}, msg *Message) bool {
+ Log("dummySessionMessage sessionmessage\n")
+ ds.msg = msg
+ return true
+}
+
+func (ds *dummySessionMessage) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (ds *dummySessionMessage) SessionNotify(obj interface{}) {
+}
+
+func (ds *dummySessionMessage) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+
+type dummyTransportMessage struct{}
+
+func (dt *dummyTransportMessage) GetSession() Session {
+ return nil
+}
+
+func (dt *dummyTransportMessage) SetSession(sess Session) {
+}
+
+
+func (dt *dummyTransportMessage) TransportMessage(recipient interface{}, msg *Message) {
+
+}
+
+func (dt *dummyTransportMessage) TransportQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dt *dummyTransportMessage) TransportControl(ctrl interface{}, value interface{}) {
+}
+
+func (dt *dummyTransportMessage) TransportNotify(value interface{}) {
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBox_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBox_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBox_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/PlainMailBox_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import . "etch"
+
+func TestPlainMailBox() {
+ mb := NewPlainMailBox(42)
+
+ if mb.GetMessageId() != 42 {
+ Error("Mailbox has wrong ID\n")
+ }
+
+ msg := new(Message)
+
+ sender := 23
+
+ go TestPut(mb, msg, sender)
+
+ elem := mb.Read()
+
+ if elem == nil {
+ Error("got nil elem from Mailbox\n")
+ } else {
+ if elem.Msg != msg {
+ Error("got wrong elem from Mailbox\n")
+ }
+
+ if elem.Who != 23 {
+ Error("got wrong sender from Mailbox\n")
+ }
+ }
+
+ // enable this for build to take 4 seconds longer :)
+ //Log("Waiting for Timeout...\n")
+ //elem = mb.Read()
+
+ //if elem != nil {
+ // Error("got an elem, but I expected nil\n")
+ //}
+
+ Log("TestPlainMailBox done\n")
+}
+
+
+func TestPut(mb Mailbox, msg *Message, sender interface{}) {
+ mb.Message(sender, msg)
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/StructValue_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/StructValue_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/StructValue_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/StructValue_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import "fmt"
+import . "etch"
+
+func TestStructValue() {
+ t1 := NewType(1, "type1")
+ f1 := &Field{IdName{1, "field1"}}
+ f2 := &Field{IdName{2, "field2"}}
+ dv := new(dummyVal)
+ t1.PutValidator(f1, dv)
+ sv := NewStructValue(t1, nil, 1)
+ sv.Put(f1, "Hallo Welt\n")
+ sv.Put(f2, "Hallo Welt2\n")
+
+ if fmt.Sprint(sv.Fields[f1]) != "Hallo Welt\n" {
+ Error("wrong value in field")
+ }
+ if sv.Fields[f2] != nil {
+ Error("wrong value in field2")
+ }
+ Log("TestStructValue done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/Type_test.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/Type_test.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/Type_test.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/Type_test.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package goetchtest
+
+import "fmt"
+import . "etch"
+
+type dummyVal struct{}
+
+func (dv *dummyVal) Validate(value interface{}) bool {
+ return true
+}
+func (dv *dummyVal) ValidateValue(value interface{}) interface{} {
+ return value
+}
+
+func TestType() {
+ t1 := NewType(1, "type1")
+ f1 := &Field{IdName{1, "field1"}}
+ f2 := &Field{IdName{2, "field2"}}
+ dv1 := new(dummyVal)
+ dv2 := new(dummyVal)
+ dv3 := new(dummyVal)
+
+ t1.PutValidator(f1, dv1)
+ t1.PutValidator(f2, dv2)
+ t1.PutValidator(f2, dv3)
+
+ i := int32(1)
+ for k, v := range t1.Fields {
+ if k != i {
+ Error("got wrong key")
+ }
+ if v.Id != i {
+ Error("got wrong value")
+ }
+ i = i + 1
+ }
+
+ if i != 3 {
+ Error("wrong number of Validators: " + fmt.Sprint(i))
+ }
+
+ t1.ClearValidator(f1)
+ v := t1.Validators[f1.Id]
+ if v != nil {
+ Error("clear Validator not working")
+ }
+
+ v2 := t1.Validators[f2.Id]
+ if v2 == nil {
+ Error("Validator for f2 erased")
+ }
+ if v2 != dv3 {
+ Error("wrong Validator for f2")
+ }
+ Log("TestType done\n")
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/HelloWorld.etch
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/HelloWorld.etch?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/HelloWorld.etch (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/HelloWorld.etch Mon Nov 29 14:29:21 2010
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+module org.apache.etch.examples.helloworld
+
+service HelloWorld {
+ struct user (
+ int id,
+ string name
+ )
+
+ exception UserUnknownException (
+ string mes
+ )
+
+ @Direction(Server)
+ @AsyncReceiver(QUEUED)
+ string say_hello(user to_whom) throws UserUnknownException
+
+ @Direction(Client)
+ int f(int x)
+
+ @Direction(Server)
+ @Oneway
+ void oneway()
+
+ @Direction(Server)
+ void twoway()
+
+ @Direction(Server)
+ void simpleArrayTest(int[] ints)
+
+ @Direction(Server)
+ void structArrayTest(user[] users)
+
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/.gitignore
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/.gitignore?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/.gitignore (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/.gitignore Mon Nov 29 14:29:21 2010
@@ -0,0 +1,3 @@
+*.8
+HelloWorldClient
+HelloWorldServer
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldClient.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldClient.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldClient.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldClient.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,47 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+// Re-implement these methods by overriding them in ImplHelloWorldClient.
+
+package org_apache_etch_examples_helloworld
+
+type HelloWorldClient_base struct {
+}
+
+func (base *HelloWorldClient_base) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (base *HelloWorldClient_base) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+func (base *HelloWorldClient_base) SessionNotify(obj interface{}) {
+
+}
+
+
+func (base *HelloWorldClient_base) f (x int32) int32 {
+ panic("not implemented")
+}
+
+
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldServer.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldServer.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldServer.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/BaseHelloWorldServer.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,64 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+// Re-implement these methods by overriding them in ImplHelloWorldServer.
+
+package org_apache_etch_examples_helloworld
+
+type HelloWorldServer_base struct {
+ TheClient *RemoteHelloWorldClient
+}
+
+func (base *HelloWorldServer_base) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (base *HelloWorldServer_base) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+func (base *HelloWorldServer_base) SessionNotify(obj interface{}) {
+
+}
+
+
+func (base *HelloWorldServer_base) say_hello (to_whom *User) string {
+ panic("not implemented")
+}
+
+func (base *HelloWorldServer_base) oneway () {
+ panic("not implemented")
+}
+
+func (base *HelloWorldServer_base) twoway () {
+ panic("not implemented")
+}
+
+func (base *HelloWorldServer_base) simpleArrayTest (ints []int32) {
+ panic("not implemented")
+}
+
+func (base *HelloWorldServer_base) structArrayTest (users []*User) {
+ panic("not implemented")
+}
+
+
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorld.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorld.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorld.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorld.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,35 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+
+package org_apache_etch_examples_helloworld
+
+type HelloWorld interface {
+}
+
+type User struct {
+ Id int32
+ Name string
+}
+type UserUnknownException struct {
+ Mes string
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldClient.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldClient.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldClient.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldClient.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,30 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+
+package org_apache_etch_examples_helloworld
+
+type HelloWorldClient interface {
+ HelloWorld
+ f ( x int32 ) int32
+}
+
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldHelper.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldHelper.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldHelper.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldHelper.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,123 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+
+package org_apache_etch_examples_helloworld
+
+import "etch"
+
+
+type HelloWorldServerFactory struct {
+ session etch.Session
+ transport etch.Transport
+}
+
+func NewHelloWorldServerFactory(transport etch.Transport) *HelloWorldServerFactory {
+ val := &HelloWorldServerFactory{nil, transport}
+ return val
+}
+
+func NewListener(addr string) etch.Transport{
+ tl := etch.NewTcpListener(addr)
+ dsl := etch.NewDefaultSessionListener(tl)
+ tl.SetSession(dsl)
+ sf := NewHelloWorldServerFactory(dsl)
+ dsl.SetSession(sf)
+ return sf
+}
+
+func (dsf *HelloWorldServerFactory) NewServer(connection *etch.TcpConnection) {
+ ptzr := etch.NewPacketizer(connection, 10*1024)
+ connection.SetSession(ptzr)
+ dvf := NewValueFactoryHelloWorld()
+ msgzr := etch.NewMessagizer(dvf, ptzr)
+ ptzr.SetSession(msgzr)
+ mbm := etch.NewPlainMailboxManager(nil, msgzr)
+ msgzr.SetSession(mbm)
+ dsvc := etch.NewDefaultDeliveryService(mbm, nil)
+ mbm.SetSession(dsvc)
+ impl := new(ImplHelloWorldServer)
+
+ stub := etch.NewEtchStub(dsvc, impl)
+ dsvc.SetSession(stub)
+
+ impl.TheClient = NewRemoteHelloWorldClient(dsvc, dvf)
+ SetStubHelpers_StubHelloWorldServer(dvf)
+
+ dsvc.TransportControl(etch.START, 4000)
+}
+
+
+func (dsf *HelloWorldServerFactory) SessionQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dsf *HelloWorldServerFactory) SessionControl(ctrl interface{}, value interface{}) interface{} {
+ return nil
+}
+
+func (dsf *HelloWorldServerFactory) SessionNotify(obj interface{}) {
+
+}
+
+func (dsf *HelloWorldServerFactory) GetSession() etch.Session {
+ return nil
+}
+
+func (dsf *HelloWorldServerFactory) SetSession(sess etch.Session) {
+
+}
+
+func (dsf *HelloWorldServerFactory) TransportQuery(obj interface{}) interface{} {
+ return nil
+}
+
+func (dsf *HelloWorldServerFactory) TransportControl(ctrl interface{}, value interface{}) {
+ dsf.transport.TransportControl(ctrl, value)
+}
+
+func (dsf *HelloWorldServerFactory) TransportNotify(value interface{}) {
+
+}
+
+func NewRemoteServer(addr string) *RemoteHelloWorldServer{
+ tcpClientConn := etch.NewTcpConnection(addr, false, nil, nil)
+ cdsvc, vf := buildStack(tcpClientConn)
+ return NewRemoteHelloWorldServer(cdsvc, vf)
+}
+
+func buildStack(conn *etch.TcpConnection) (etch.DeliveryService, etch.ValueFactory) {
+ ptzr := etch.NewPacketizer(conn, 10*1024)
+ conn.SetSession(ptzr)
+ dvf := NewValueFactoryHelloWorld()
+ msgzr := etch.NewMessagizer(dvf, ptzr)
+ ptzr.SetSession(msgzr)
+ mbm := etch.NewPlainMailboxManager(nil, msgzr)
+ msgzr.SetSession(mbm)
+ dsvc := etch.NewDefaultDeliveryService(mbm, nil)
+ mbm.SetSession(dsvc)
+ stub := etch.NewEtchStub(dsvc, new(ImplHelloWorldClient))
+ dsvc.SetSession(stub)
+
+ SetStubHelpers_StubHelloWorldClient(dvf)
+ return dsvc, dvf
+}
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldServer.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldServer.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldServer.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/HelloWorldServer.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,34 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Thu Nov 18 15:39:28 CET 2010
+// This file is automatically created and should not be edited!
+
+package org_apache_etch_examples_helloworld
+
+type HelloWorldServer interface {
+ HelloWorld
+ say_hello ( to_whom *User ) string
+ oneway ( )
+ twoway ( )
+ simpleArrayTest ( ints []int32 )
+ structArrayTest ( users []*User )
+}
+
Added: incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/ImplHelloWorldClient.go
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/ImplHelloWorldClient.go?rev=1040122&view=auto
==============================================================================
--- incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/ImplHelloWorldClient.go (added)
+++ incubator/etch/trunk/binding-go/runtime/src/test/go/example/generated/ImplHelloWorldClient.go Mon Nov 29 14:29:21 2010
@@ -0,0 +1,36 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+// This file automatically generated by:
+// Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0)
+// Tue Nov 16 15:40:18 CET 2010
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+
+package org_apache_etch_examples_helloworld
+
+type ImplHelloWorldClient struct {
+ HelloWorldClient_base
+}
+
+
+func (base *ImplHelloWorldClient) f (x int32) int32 {
+ return x + 4
+}
+