THRIFT-2491 unable to import generated ThriftTest service
Client: Go
Patch: Aleksey Pesternikov
This closes #105
commit f2e7186ca8d63f407dba0c56ee51afd6405926ba
Author: Aleksey Pesternikov <ap@alekseys-mbp.att.net>
Date: 2014-04-22T12:48:14Z
add _ to generated filename if it ends with _test.go
diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am
index 5499fb7..0be6cf7 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -47,11 +47,11 @@
check: gopath
GOPATH=`pwd`/gopath $(GO) build \
- IncludesTest \
- BinaryKeyTest \
- ServicesTest \
- TypedefFieldTest \
- RefAnnotationFieldsTest
+ includestest \
+ binarykeytest \
+ servicestest \
+ typedeffieldtest \
+ refannotationfieldstest
GOPATH=`pwd`/gopath $(GO) test thrift tests
clean-local:
diff --git a/lib/go/test/NamespacedTest.thrift b/lib/go/test/NamespacedTest.thrift
index 1bb2fc4..a910350 100644
--- a/lib/go/test/NamespacedTest.thrift
+++ b/lib/go/test/NamespacedTest.thrift
@@ -19,7 +19,7 @@
include "ThriftTest.thrift"
-namespace go lib.go.test.NamespacedTest
+namespace go lib.go.test.namespacedtest
enum Stuff {
ONE = 1,
diff --git a/lib/go/test/tests/binary_key_test.go b/lib/go/test/tests/binary_key_test.go
index 4cd3eb4..aa96193 100644
--- a/lib/go/test/tests/binary_key_test.go
+++ b/lib/go/test/tests/binary_key_test.go
@@ -20,12 +20,12 @@
package tests
import (
- "BinaryKeyTest"
+ "binarykeytest"
"testing"
)
func TestBinaryMapKeyGeneratesString(t *testing.T) {
- s := BinaryKeyTest.NewTestStruct()
+ s := binarykeytest.NewTestStruct()
//This will only compile if BinToString has type of map[string]string
s.BinToString = make(map[string]string)
}
diff --git a/lib/go/test/tests/multiplexed_protocol_test.go b/lib/go/test/tests/multiplexed_protocol_test.go
index 5b8a328..00669ef 100644
--- a/lib/go/test/tests/multiplexed_protocol_test.go
+++ b/lib/go/test/tests/multiplexed_protocol_test.go
@@ -20,7 +20,7 @@
package tests
import (
- "MultiplexedProtocolTest"
+ "multiplexedprotocoltest"
"net"
"testing"
"thrift"
@@ -61,37 +61,37 @@
}
server = thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
- firstProcessor := MultiplexedProtocolTest.NewFirstProcessor(&FirstImpl{})
+ firstProcessor := multiplexedprotocoltest.NewFirstProcessor(&FirstImpl{})
processor.RegisterProcessor("FirstService", firstProcessor)
- secondProcessor := MultiplexedProtocolTest.NewSecondProcessor(&SecondImpl{})
+ secondProcessor := multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{})
processor.RegisterProcessor("SecondService", secondProcessor)
go server.Serve()
}
-var firstClient *MultiplexedProtocolTest.FirstClient
+var firstClient *multiplexedprotocoltest.FirstClient
func TestInitClient1(t *testing.T) {
socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
transport := thrift.NewTFramedTransport(socket)
var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
protocol = thrift.NewTMultiplexedProtocol(protocol, "FirstService")
- firstClient = MultiplexedProtocolTest.NewFirstClientProtocol(transport, protocol, protocol)
+ firstClient = multiplexedprotocoltest.NewFirstClientProtocol(transport, protocol, protocol)
err := transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
}
}
-var secondClient *MultiplexedProtocolTest.SecondClient
+var secondClient *multiplexedprotocoltest.SecondClient
func TestInitClient2(t *testing.T) {
socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
transport := thrift.NewTFramedTransport(socket)
var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
protocol = thrift.NewTMultiplexedProtocol(protocol, "SecondService")
- secondClient = MultiplexedProtocolTest.NewSecondClientProtocol(transport, protocol, protocol)
+ secondClient = multiplexedprotocoltest.NewSecondClientProtocol(transport, protocol, protocol)
err := transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
@@ -99,11 +99,11 @@
}
//create client without service prefix
-func createLegacyClient(t *testing.T) *MultiplexedProtocolTest.SecondClient {
+func createLegacyClient(t *testing.T) *multiplexedprotocoltest.SecondClient {
socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
transport := thrift.NewTFramedTransport(socket)
var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
- legacyClient := MultiplexedProtocolTest.NewSecondClientProtocol(transport, protocol, protocol)
+ legacyClient := multiplexedprotocoltest.NewSecondClientProtocol(transport, protocol, protocol)
err := transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
@@ -139,7 +139,7 @@
t.Fatal("Expecting error")
}
//register default processor and call again
- processor.RegisterDefault(MultiplexedProtocolTest.NewSecondProcessor(&SecondImpl{}))
+ processor.RegisterDefault(multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{}))
legacyClient = createLegacyClient(t)
ret, err = legacyClient.ReturnTwo()
if err != nil {
diff --git a/lib/go/test/tests/one_way_test.go b/lib/go/test/tests/one_way_test.go
index 5ffbbfe..3ff025f 100644
--- a/lib/go/test/tests/one_way_test.go
+++ b/lib/go/test/tests/one_way_test.go
@@ -20,9 +20,9 @@
package tests
import (
- "OnewayTest"
"fmt"
"net"
+ "onewaytest"
"testing"
"thrift"
"time"
@@ -47,7 +47,7 @@
var addr net.Addr
var server *thrift.TSimpleServer
-var client *OnewayTest.OneWayClient
+var client *onewaytest.OneWayClient
func TestInitOneway(t *testing.T) {
var err error
@@ -56,7 +56,7 @@
if err != nil {
t.Fatal("Unable to create server socket", err)
}
- processor := OnewayTest.NewOneWayProcessor(&impl{})
+ processor := onewaytest.NewOneWayProcessor(&impl{})
server = thrift.NewTSimpleServer2(processor, serverTransport)
go server.Serve()
@@ -65,7 +65,7 @@
func TestInitOnewayClient(t *testing.T) {
transport := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
protocol := thrift.NewTBinaryProtocolTransport(transport)
- client = OnewayTest.NewOneWayClientProtocol(transport, protocol, protocol)
+ client = onewaytest.NewOneWayClientProtocol(transport, protocol, protocol)
err := transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
diff --git a/lib/go/test/tests/optional_fields_test.go b/lib/go/test/tests/optional_fields_test.go
index 4b0797c..324bf00 100644
--- a/lib/go/test/tests/optional_fields_test.go
+++ b/lib/go/test/tests/optional_fields_test.go
@@ -20,15 +20,15 @@
package tests
import (
- "OptionalFieldsTest"
"bytes"
gomock "code.google.com/p/gomock/gomock"
+ "optionalfieldstest"
"testing"
"thrift"
)
func TestIsSetReturnFalseOnCreation(t *testing.T) {
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
if ao.IsSetS() {
t.Errorf("Optional field S is set on initialization")
}
@@ -71,7 +71,7 @@
}
func TestDefaultValuesOnCreation(t *testing.T) {
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
if ao.GetS() != "DEFAULT" {
t.Errorf("Unexpected default value %#v for field S", ao.GetS())
}
@@ -112,7 +112,7 @@
}
func TestInitialValuesOnCreation(t *testing.T) {
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
if ao.S != "DEFAULT" {
t.Errorf("Unexpected initial value %#v for field S", ao.S)
}
@@ -152,11 +152,11 @@
}
func TestIsSetReturnTrueAfterUpdate(t *testing.T) {
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.S = "somevalue"
ao.I = 123
ao.B = true
- ao.Aa = OptionalFieldsTest.NewStructA()
+ ao.Aa = optionalfieldstest.NewStructA()
if !ao.IsSetS() {
t.Errorf("Field S should be set")
}
@@ -172,7 +172,7 @@
}
func TestListNotEmpty(t *testing.T) {
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.L = []int64{1, 2, 3}
if !ao.IsSetL() {
t.Errorf("Field L should be set")
@@ -189,7 +189,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.Write(proto)
}
@@ -202,7 +202,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.I = 42
ao.Write(proto)
}
@@ -220,7 +220,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.I = 123
ao.Write(proto)
}
@@ -240,7 +240,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.L = []int64{1, 2}
ao.Write(proto)
}
@@ -257,7 +257,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.Bin = []byte("somebytestring")
ao.Write(proto)
}
@@ -274,7 +274,7 @@
proto.EXPECT().WriteFieldStop().Return(nil),
proto.EXPECT().WriteStructEnd().Return(nil),
)
- ao := OptionalFieldsTest.NewAllOptional()
+ ao := optionalfieldstest.NewAllOptional()
ao.Bin = []byte{}
ao.Write(proto)
}