-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sébastien GLON
committed
Aug 26, 2016
1 parent
74f9d04
commit e2e2f82
Showing
7 changed files
with
115 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
package goavro | ||
|
||
package main | ||
import ( | ||
"testing" | ||
"github.com/sebglon/goavro" | ||
"net" | ||
"log" | ||
|
||
) | ||
|
||
func TestRequestor(t *testing.T) { | ||
func main() { | ||
//t.SkipNow() | ||
rAddr, err := net.ResolveTCPAddr("tcp", "10.98.80.113:63001") | ||
conn, err := net.DialTCP("tcp", nil, rAddr) | ||
if err != nil { | ||
t.Fatal(err) | ||
log.Fatal(err) | ||
} | ||
defer conn.Close() | ||
|
||
transceiver := NewNettyTransceiver(conn) | ||
protocol, err := NewProtocol() | ||
transceiver := goavro.NewNettyTransceiver(conn) | ||
protocol, err := goavro.NewProtocol() | ||
if err != nil { | ||
t.Fatal(err) | ||
log.Fatal(err) | ||
} | ||
|
||
flumeRecord, errFlume := protocol.NewRecord("AvroFlumeEvent") | ||
if errFlume != nil { | ||
t.Fatal(errFlume) | ||
log.Fatal(errFlume) | ||
} | ||
headers := make(map[string]interface{}) | ||
headers["host_header"] = "127.0.0.1" | ||
flumeRecord.Set("headers", headers) | ||
flumeRecord.Set("body", []byte("2016-08-02 14:45:38|flume.composantTechnique_IS_UNDEFINED|flume.application_IS_UNDEFINED|flume.client_IS_UNDEFINED|flume.plateforme_IS_UNDEFINED|instance_IS_UNDEFINED|logname_IS_UNDEFINED|WARN |test.LogGenerator|test !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")) | ||
requestor := NewRequestor(protocol, transceiver) | ||
requestor := goavro.NewRequestor(protocol, transceiver) | ||
err = requestor.Request("append", flumeRecord) | ||
|
||
if err != nil { | ||
t.Fatal("Request: ", err) | ||
log.Fatal("Request: ", err) | ||
} | ||
|
||
err = requestor.Request("append", flumeRecord) | ||
|
||
if err != nil { | ||
t.Fatal("Request: ", err) | ||
log.Fatal("Request: ", err) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.