You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by emma58 <gi...@git.apache.org> on 2015/07/25 00:48:10 UTC

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

GitHub user emma58 opened a pull request:

    https://github.com/apache/thrift/pull/562

    Thrift 3265--servers for pipe applications (stdin, stdout)

    Adds server classes to C#, Python, and Java libraries for server/client communication over stdin and stdout.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/emma58/thrift Thrift-3265

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/562.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #562
    
----
commit 8eed8a09734abb6d69d8d7fd5887f2280674c2c2
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-06-18T23:03:14Z

    working stream server. comments in other files.

commit 849884b2d8def0fa4aa042bebf88a9f508dfbf3c
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-06-22T14:38:21Z

    cleaned up comments and old not-working code.

commit 35b1f256e32949ab755dfbcf8baac0677a506f45
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-06-25T22:53:02Z

    added java stream server

commit 1a8e5b336a5e221213449d4b18ed2553747ac8a8
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-07-01T21:44:38Z

    added python iostream transport and server

commit f471f3387cd46cd39433e179dcece979ea2fdfdf
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-07-06T22:30:02Z

    adds TestStreamServer project to create server executable and adds TestIOStreamClient class which tests the TStreamServer by having the client spawn the server and use stream transport

commit e406e8efc8b5ad077693983c774c65e58e94f156
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-07-07T15:45:05Z

    changes default protocol to binary protocol in TStreamServer, cleans up tests

commit 4a12a7f94e0aaf21a270fa781d1d2ba623fb6179
Author: unknown <es...@s975643.srn.sandia.gov>
Date:   2015-07-07T18:52:17Z

    adds travis CI sudo: required

commit bd0f604c5311d8e570471274452ec4a42a6aa51f
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-08T14:23:52Z

    Merge remote-tracking branch 'upstream/master'

commit 490382aa13780e9d8da969405dbb6b39c67c3ec3
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-08T14:27:38Z

    adds unfinished java tests for stream server and syncs with upstream repo

commit 222534b197715b930666fb4cabbe34a06177fd97
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-08T23:07:19Z

    finishes java tests for stream server, makes the java stream server also have binary protocol as the default

commit eecb23f7cefa24dc0fa2d9f8317da87833c509cc
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-09T22:59:14Z

    Adds the former tests as examples in tutorial section

commit 1e37a16b2cdd2548f718d3c979a96e3d04426927
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T15:11:29Z

    try running csharp tests

commit 9a0f4f208533b7101b1363d22524397513c851d0
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T16:34:32Z

    adds makefile for stream server test, modifies makefiles in hopes ThriftTest will compile

commit dc417bb0fae84dfb3268eef2bf23d55e0650a361
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T17:18:38Z

    reverts the attempt at the csharp tests in lib/csharp/Makefile.am

commit 204a2857b84c3cdc2096db7a04fb0cfdc7c7fbe0
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T19:08:59Z

    attempts to solve no public key available warning

commit a55d0eb4e3f3df82da64d7604f86f0aa30412029
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T20:31:48Z

    adds python tests

commit b98d29df10965c74cfded7e1491c4c9369c3b2d1
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T20:33:46Z

    fixes no public key available error

commit e5d1cdc10b5fbba34948e77d44007e242088bffb
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T21:52:54Z

    adds check target to ThriftTest makefile

commit 5deb1897d1cc7c9c6249a04556a494caaf3c22d1
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-10T22:20:03Z

    adds rule for all target in TestStreamServer makefile

commit d146b29dd1815ba622435cd64f423c2fa54420ca
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-14T16:41:08Z

    adds python stream server tests with JSON Protocol

commit dc317f85131fae1ee24d4af54c86b0e27581980e
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-14T20:25:48Z

    tests binary protocol with stream server

commit 2e72b70ebccfb0eca1b44e91ab151027eedfbb40
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-14T20:26:36Z

    forgot this file on previous commit

commit 62365a2b12e399176dd4964ab29402a997360036
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-15T17:37:59Z

    modifies stream client and server tests to work with binary protocol

commit d889da5f38d68fcd834ff0ddaea03ee168557e42
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-15T19:12:28Z

    stream server tests now pass with any protocol

commit faf8e012ebb9c18d1f8c1db0c15bd9d3a6fb4396
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-15T20:18:57Z

    Adds iostream client/server tests to RunClientServer.py

commit aa80ccc48feb0570fd768dc730902bb684289b87
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-16T23:06:32Z

    adds java unit tests, and makes csharp tests runable with any protocol

commit 4aba96514dcaafc0a1855f540788a3e180a042b2
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-17T19:06:42Z

    adds tests for insanity and nested map

commit 1f39e3c301a468e9b9f71e9ee2d93d25e6a2ffb1
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-20T16:32:20Z

    adds script to test iostream client and server

commit 9b2cb0c5d071ee0906d4bdacf8ac310fc35ae0e3
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-20T19:54:25Z

    adds comment about TException protocol, won't run that part of exception test

commit 45d36edb9df8b7c62037da94ed7718977888f9f2
Author: Emma <es...@s975643.srn.sandia.gov>
Date:   2015-07-20T20:05:21Z

    attempts to add stream client/server compilation and testing to original makefile and script

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

Posted by emma58 <gi...@git.apache.org>.
Github user emma58 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/562#discussion_r35544759
  
    --- Diff: lib/csharp/test/TestIOStreamServer/Properties/AssemblyInfo.cs ---
    @@ -0,0 +1,55 @@
    +/*
    + * 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.
    + */
    +
    +using System.Reflection;
    +using System.Runtime.CompilerServices;
    +using System.Runtime.InteropServices;
    +
    +// General Information about an assembly is controlled through the following 
    +// set of attributes. Change these attribute values to modify the information
    +// associated with an assembly.
    +[assembly: AssemblyTitle("TestIOStreamServer")]
    +[assembly: AssemblyDescription("")]
    +[assembly: AssemblyConfiguration("")]
    +[assembly: AssemblyCompany("Sandia National Laboratories")]
    +[assembly: AssemblyProduct("TestIOStreamServer")]
    +[assembly: AssemblyCopyright("Copyright © Sandia National Laboratories 2015")]
    --- End diff --
    
    That is a good catch... I am not sure that we can contribute it, and I am working to find out. I will probably take it off github for the time being because I should have thought of this sooner!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

Posted by Jens-G <gi...@git.apache.org>.
Github user Jens-G commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/562#discussion_r35482999
  
    --- Diff: lib/csharp/test/TestIOStreamServer/TestIOStreamClient.cs ---
    @@ -0,0 +1,425 @@
    +/*
    + * 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.
    + */
    +
    +using System;
    +using Microsoft.VisualStudio.TestTools.UnitTesting;
    +using System.Diagnostics;
    +using System.Collections.Generic;
    +using Thrift;
    +using Thrift.Collections;
    +using Thrift.Transport;
    +using Thrift.Protocol;
    +using Thrift.Test;
    +using Test;
    +
    +namespace TestIOStreamClient
    +{
    +    [TestClass]
    +    public class TestIOStreamClient
    +    {
    +        private static string serverFileName = "..\\..\\..\\TestStreamServer\\bin\\Debug\\TestStreamServer.exe";
    +        private static string protocolName = "binary";
    +        private static TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
    +        private static TStreamTransport transport;
    +        private static Process other;
    +        private static ThriftTest.Client client;
    +
    +        [TestInitialize]
    +        public void setUp()
    +        {
    +            var server = new ProcessStartInfo();
    +            server.FileName = serverFileName;
    +            server.Arguments = "--" + protocolName;
    +            server.UseShellExecute = false;
    +            server.RedirectStandardInput = true;
    +            server.RedirectStandardOutput = true;
    +
    +            other = Process.Start(server);
    +
    +            Console.SetIn(other.StandardOutput);
    +            Console.SetOut(other.StandardInput);
    +
    +            transport = new TStreamTransport(other.StandardOutput.BaseStream, other.StandardInput.BaseStream);
    +            TProtocol protocol = protocolFactory.GetProtocol(transport);
    +            client = new ThriftTest.Client(protocol);
    +
    +            transport.Open();
    +        }
    +
    +        [TestCleanup]
    +        public void tearDown()
    +        {
    +            transport.Close();
    +            //close server
    +            other.Kill();//kills process
    +            other.Close();//cleans up
    +        }
    +
    +        [TestMethod]
    +        public void testVoid()
    +        {
    +            client.testVoid();
    +        }
    +
    +        [TestMethod]
    +        public void testString()
    +        {
    +            string s = client.testString("Test");
    +            Assert.AreEqual("Test", s);
    +        }
    +
    +        [TestMethod]
    +        public void testByte()
    +        {
    +            sbyte b = client.testByte((sbyte)1);
    +            Assert.AreEqual(1, b);
    +        }
    +
    +        [TestMethod]
    +        public void testI32()
    +        {
    +            int i = client.testI32(-1);
    +            Assert.AreEqual(-1, i);
    +        }
    +
    +        [TestMethod]
    +        public void testI64()
    +        {
    +            long l = client.testI64(-34359738368);
    +            Assert.AreEqual(-34359738368, l);
    +        }
    +
    +        [TestMethod]
    +        public void testDouble()
    +        {
    +            double d = client.testDouble(5.325098235);
    +            Assert.AreEqual(5.325098235, d);
    +        }
    +
    +        [TestMethod]
    +        public void testBinary()
    +        {
    +            byte[] binOut = TestClient.PrepareTestData(true);
    +            byte[] binIn = client.testBinary(binOut);
    +            Assert.AreEqual(binOut.Length, binIn.Length);
    +            for (int ofs = 0; ofs < binIn.Length; ++ofs)
    +                Assert.AreEqual(binOut[ofs], binIn[ofs]);
    +        }
    +
    +        [TestMethod]
    +        public void testStruct()
    +        {
    +            Xtruct o = new Xtruct();
    +            o.String_thing = "Zero";
    +            o.Byte_thing = (sbyte)1;
    +            o.I32_thing = -3;
    +            o.I64_thing = -5;
    +            Xtruct i = client.testStruct(o);
    +            Assert.AreEqual(o.String_thing, i.String_thing);
    +            Assert.AreEqual(o.Byte_thing, i.Byte_thing);
    +            Assert.AreEqual(o.I32_thing, i.I32_thing);
    +            Assert.AreEqual(o.I64_thing, i.I64_thing);
    +        }
    +
    +        [TestMethod]
    +        public void testNest()
    +        {
    +            Xtruct o = new Xtruct();
    +            o.String_thing = "Zero";
    +            o.Byte_thing = (sbyte)1;
    +            o.I32_thing = -3;
    +            o.I64_thing = -5;
    +
    +            Xtruct2 o2 = new Xtruct2();
    +            o2.Byte_thing = (sbyte)1;
    +            o2.Struct_thing = o;
    +            o2.I32_thing = 5;
    +            Xtruct2 i2 = client.testNest(o2);
    +            Assert.AreEqual(o2.Byte_thing, i2.Byte_thing);
    +            Assert.AreEqual(o2.Struct_thing.String_thing, i2.Struct_thing.String_thing);
    +            Assert.AreEqual(o2.Struct_thing.Byte_thing, i2.Struct_thing.Byte_thing);
    +            Assert.AreEqual(o2.Struct_thing.I32_thing, i2.Struct_thing.I32_thing);
    +            Assert.AreEqual(o2.Struct_thing.I64_thing, i2.Struct_thing.I64_thing);
    +            Assert.AreEqual(o2.I32_thing, i2.I32_thing);
    +        }
    +
    +        [TestMethod]
    +        public void testMap()
    +        {
    +            Dictionary<int, int> mapout = new Dictionary<int, int>();
    +            for (int j = 0; j < 5; j++)
    +            {
    +                mapout[j] = j - 10;
    +            }
    +
    +            Dictionary<int, int> mapin = client.testMap(mapout);
    +            Assert.AreEqual(mapout.Count, mapin.Count);
    +            foreach (KeyValuePair<int, int> pair in mapout)
    +            {
    +                Assert.AreEqual(pair.Value, mapin[pair.Key]);
    +            }
    +        }
    +
    +        [TestMethod]
    +        public void testList()
    +        {
    +            List<int> listout = new List<int>();
    +            for (int j = -2; j < 3; j++)
    +            {
    +                listout.Add(j);
    +            }
    +
    +            List<int> listin = client.testList(listout);
    +
    +            Assert.AreEqual(listout.Count, listin.Count);
    +            foreach (int i in listout)
    +            {
    +                Assert.IsTrue(listin.Contains(i));
    +            }
    +        }
    +
    +        [TestMethod]
    +        public void testSet()
    +        {
    +            THashSet<int> setout = new THashSet<int>();
    +            for (int j = -2; j < 3; j++)
    +            {
    +                setout.Add(j);
    +            }
    +
    +            THashSet<int> setin = client.testSet(setout);
    +
    +            Assert.AreEqual(setout.Count, setin.Count);
    +            foreach (int i in setout)
    +            {
    +                Assert.IsTrue(setin.Contains(i));
    +            }
    +        }
    +
    +        [TestMethod]
    +        public void testEnum()
    +        {
    --- End diff --
    
    I'd rather like the test being included into the existing standard ThriftTest test client, instead of writing a duplicated one. Having two of them does not make much sense, do you agree?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/562#discussion_r35533996
  
    --- Diff: lib/java/test/org/apache/thrift/test/JavaBeansTest.java ---
    @@ -29,33 +29,32 @@ public static void main(String[] args) throws Exception {
         // Test isSet methods
    --- End diff --
    
    Included this file by mistake ? Only indentations are messed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

Posted by Jens-G <gi...@git.apache.org>.
Github user Jens-G commented on the pull request:

    https://github.com/apache/thrift/pull/562#issuecomment-124845859
  
    Hi, great Addition, but please clean it up before I take a look at it. For starters, all those "generated files" are not to be included.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request #562: Thrift 3265--servers for pipe applications (stdin,...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/thrift/pull/562


---

[GitHub] thrift pull request: Thrift 3265--servers for pipe applications (s...

Posted by Jens-G <gi...@git.apache.org>.
Github user Jens-G commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/562#discussion_r35482978
  
    --- Diff: lib/csharp/test/TestIOStreamServer/Properties/AssemblyInfo.cs ---
    @@ -0,0 +1,55 @@
    +/*
    + * 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.
    + */
    +
    +using System.Reflection;
    +using System.Runtime.CompilerServices;
    +using System.Runtime.InteropServices;
    +
    +// General Information about an assembly is controlled through the following 
    +// set of attributes. Change these attribute values to modify the information
    +// associated with an assembly.
    +[assembly: AssemblyTitle("TestIOStreamServer")]
    +[assembly: AssemblyDescription("")]
    +[assembly: AssemblyConfiguration("")]
    +[assembly: AssemblyCompany("Sandia National Laboratories")]
    +[assembly: AssemblyProduct("TestIOStreamServer")]
    +[assembly: AssemblyCopyright("Copyright © Sandia National Laboratories 2015")]
    --- End diff --
    
    Whats that copyright notice? Are you sure your are legally allowed to put that code into Open Source at all? How can we check that?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---