diff options
Diffstat (limited to 'contrib')
25 files changed, 231 insertions, 79 deletions
diff --git a/contrib/Vagrantfile b/contrib/Vagrantfile index 3bcc46a96..ff53316bb 100644 --- a/contrib/Vagrantfile +++ b/contrib/Vagrantfile @@ -43,7 +43,7 @@ sudo apt-get install -qq automake libtool flex bison pkg-config g++ libssl-dev m sudo apt-get install -qq libboost-dev libboost-test-dev libboost-program-options-dev libboost-filesystem-dev libboost-system-dev libevent-dev # Java dependencies -sudo apt-get install -qq ant openjdk-7-jdk maven +sudo apt-get install -qq ant openjdk-8-jdk maven # Python dependencies sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support python-six python3-six @@ -89,8 +89,8 @@ sudo apt-get install -qq xdg-utils dmd-bin # Customize the system # --- -# Default java to latest 1.7 version -update-java-alternatives -s java-1.7.0-openjdk-amd64 +# Default java to latest 1.8 version +update-java-alternatives -s java-1.8.0-openjdk-amd64 # PHPUnit package broken in ubuntu. see https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544 sudo apt-get upgrade pear diff --git a/contrib/fb303/cpp/FacebookBase.h b/contrib/fb303/cpp/FacebookBase.h index 2159c95fd..daa524644 100644 --- a/contrib/fb303/cpp/FacebookBase.h +++ b/contrib/fb303/cpp/FacebookBase.h @@ -22,6 +22,7 @@ #include "FacebookService.h" +#include <boost/shared_ptr.hpp> #include <thrift/server/TServer.h> #include <thrift/concurrency/Mutex.h> diff --git a/contrib/fb303/if/fb303.thrift b/contrib/fb303/if/fb303.thrift index 66c831527..89bd6eb7b 100644 --- a/contrib/fb303/if/fb303.thrift +++ b/contrib/fb303/if/fb303.thrift @@ -24,6 +24,7 @@ namespace java com.facebook.fb303 namespace cpp facebook.fb303 namespace perl Facebook.FB303 +namespace netcore Facebook.FB303.Test /** * Common status reporting mechanism across all services diff --git a/contrib/fb303/java/build.properties b/contrib/fb303/java/build.properties new file mode 100644 index 000000000..84636683c --- /dev/null +++ b/contrib/fb303/java/build.properties @@ -0,0 +1,5 @@ +# Maven Ant tasks Jar details +mvn.ant.task.version=2.1.3 +mvn.repo=http://repo1.maven.org/maven2 +mvn.ant.task.url=${mvn.repo}/org/apache/maven/maven-ant-tasks/${mvn.ant.task.version} +mvn.ant.task.jar=maven-ant-tasks-${mvn.ant.task.version}.jar diff --git a/contrib/fb303/java/build.xml b/contrib/fb303/java/build.xml index 8f2fa51c7..7a1b8f105 100755 --- a/contrib/fb303/java/build.xml +++ b/contrib/fb303/java/build.xml @@ -7,9 +7,9 @@ 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 @@ -26,20 +26,20 @@ <property name="interface.dir" value="${basedir}/../if"/> <property name="thrift.java.dir" location="${thrift.root}/lib/java"/> <property name="build.tools.dir" location="${thrift.java.dir}/build/tools/"/> - <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/> + <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/> + <property file="${basedir}/build.properties"/> <!-- inherit from the java build file for version and other properties --> - <property file="${thrift.java.dir}/build.properties" /> + <property file="${thrift.java.dir}/gradle.properties" /> <property environment="env"/> <condition property="version" value="${thrift.version}"> <isset property="release"/> </condition> - <property name="version" value="${thrift.version}-snapshot"/> + <property name="version" value="${thrift.version}-SNAPSHOT"/> <property name="fb303.final.name" value="${fb303.artifactid}-${version}"/> - <property name="thrift.java.libthrift" value="${thrift.java.dir}/build/libthrift-${version}.jar"/> <property name="src" value="${basedir}/src"/> <property name="gen" value="${basedir}/gen-java"/> @@ -74,8 +74,12 @@ <echo message="Building ${fb303.final.name}.jar"/> <javac destdir="${build.classes.dir}" debug="on"> <classpath> - <pathelement location="${thrift.java.libthrift}"/> - <fileset dir="${thrift.root}/lib/java/build/lib"> + <fileset dir="${thrift.java.dir}/build/libs"> + <include name="libthrift*.jar" /> + <exclude name="libthrift*javadoc.jar" /> + <exclude name="libthrift*sources.jar" /> + </fileset> + <fileset dir="${thrift.java.dir}/build/deps"> <include name="*.jar"/> </fileset> </classpath> @@ -120,21 +124,21 @@ <artifact:remoteRepository id="apache" url="${apache.repo}"/> <!-- Pom file information --> - <artifact:pom id="pom" - groupId="${thrift.groupid}" + <artifact:pom id="pom" + groupId="${thrift.groupid}" artifactId="${fb303.artifactid}" - version="${version}" + version="${version}" url="http://thrift.apache.org" name="Apache Thrift" description="Thrift is a software framework for scalable cross-language services development." - packaging="pom" + packaging="jar" > <remoteRepository refid="central"/> <remoteRepository refid="apache"/> <license name="The Apache Software License, Version 2.0" url="${license}"/> - <scm connection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git" - developerConnection="scm:git:https://git-wip-us.apache.org/repos/asf/thrift.git" - url="https://git-wip-us.apache.org/repos/asf?p=thrift.git" + <scm connection="scm:git:https://github.com/apache/thrift.git" + developerConnection="scm:git:https://github.com/apache/thrift.git" + url="https://github.com/apache/thrift" /> <!-- Thrift Developers --> <developer id="mcslee" name="Mark Slee"/> diff --git a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py index 4b1c25728..5c8f409c1 100644 --- a/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py +++ b/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python # # Licensed to the Apache Software Foundation (ASF) under one @@ -19,6 +19,7 @@ # under the License. # +from __future__ import print_function import sys import os from optparse import OptionParser @@ -57,24 +58,20 @@ def service_ctrl( msg = fb_status_string(status) if (len(status_details)): msg += " - %s" % status_details - print msg - - if (status == fb_status.ALIVE): - return 2 - else: - return 3 + print(msg) + return 2 if status == fb_status.ALIVE else 3 except: - print "Failed to get status" + print("Failed to get status") return 3 # scalar commands if command in ["version", "alive", "name"]: try: result = fb303_wrapper(command, port, trans_factory, prot_factory) - print result + print(result) return 0 except: - print "failed to get ", command + print("failed to get ", command) return 3 # counters @@ -82,10 +79,10 @@ def service_ctrl( try: counters = fb303_wrapper('counters', port, trans_factory, prot_factory) for counter in counters: - print "%s: %d" % (counter, counters[counter]) + print("%s: %d" % (counter.encode('utf-8'), counters[counter])) return 0 except: - print "failed to get counters" + print("failed to get counters") return 3 # Only root should be able to run the following commands @@ -96,19 +93,19 @@ def service_ctrl( fb303_wrapper(command, port, trans_factory, prot_factory) return 0 except: - print "failed to tell the service to ", command + print("failed to tell the service to ", command) return 3 else: if command in ["stop", "reload"]: - print "root privileges are required to stop or reload the service." + print("root privileges are required to stop or reload the service.") return 4 - print "The following commands are available:" + print("The following commands are available:") for command in ["counters", "name", "version", "alive", "status"]: - print "\t%s" % command - print "The following commands are available for users with root privileges:" + print("\t%s" % command) + print("The following commands are available for users with root privileges:") for command in ["stop", "reload"]: - print "\t%s" % command + print("\t%s" % command) return 0 diff --git a/contrib/fb303/py/setup.py b/contrib/fb303/py/setup.py index f5b9bb379..d27c2962f 100644 --- a/contrib/fb303/py/setup.py +++ b/contrib/fb303/py/setup.py @@ -26,9 +26,9 @@ except: from distutils.core import setup, Extension, Command setup(name='thrift_fb303', - version='0.10.0', + version='1.0.0', description='Python bindings for the Apache Thrift FB303', - author=['Thrift Developers'], + author=['Apache Thrift Developers'], author_email=['dev@thrift.apache.org'], url='http://thrift.apache.org', license='Apache License 2.0', @@ -37,7 +37,7 @@ setup(name='thrift_fb303', 'fb303_scripts', ], classifiers=[ - 'Development Status :: 5 - Production/Stable', + 'Development Status :: 7 - Inactive', 'Environment :: Console', 'Intended Audience :: Developers', 'Programming Language :: Python', diff --git a/contrib/thrift-maven-plugin/pom.xml b/contrib/thrift-maven-plugin/pom.xml index 7973e69cd..b65f6aa86 100644 --- a/contrib/thrift-maven-plugin/pom.xml +++ b/contrib/thrift-maven-plugin/pom.xml @@ -27,15 +27,15 @@ <artifactId>thrift-maven-plugin</artifactId> <packaging>maven-plugin</packaging> <name>thrift-maven-plugin</name> - <version>0.10.0</version> + <version>1.0.0</version> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <source>1.7</source> - <target>1.7</target> + <source>1.8</source> + <target>1.8</target> </configuration> </plugin> <plugin> @@ -77,6 +77,12 @@ <artifactId>plexus-utils</artifactId> <version>3.0.14</version> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <version>1.10.19</version> + <scope>test</scope> + </dependency> </dependencies> <properties> <thrift.root>${basedir}/../..</thrift.root> diff --git a/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java b/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java index 0913c77cd..869be95e4 100644 --- a/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java +++ b/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/AbstractThriftMojo.java @@ -117,7 +117,7 @@ abstract class AbstractThriftMojo extends AbstractMojo { * @parameter default-value="${localRepository}" * @required */ - private ArtifactRepository localRepository; + protected ArtifactRepository localRepository; /** * Set this to {@code false} to disable hashing of dependent jar paths. @@ -129,7 +129,7 @@ abstract class AbstractThriftMojo extends AbstractMojo { * @parameter default-value="true" * @required */ - private boolean hashDependentPaths; + protected boolean hashDependentPaths; /** * @parameter @@ -229,7 +229,7 @@ abstract class AbstractThriftMojo extends AbstractMojo { checkNotNull(generator, "generator"); final File thriftSourceRoot = getThriftSourceRoot(); checkNotNull(thriftSourceRoot); - checkArgument(!thriftSourceRoot.isFile(), "thriftSourceRoot is a file, not a diretory"); + checkArgument(!thriftSourceRoot.isFile(), "thriftSourceRoot is a file, not a directory"); checkNotNull(temporaryThriftFileDirectory, "temporaryThriftFileDirectory"); checkState(!temporaryThriftFileDirectory.isFile(), "temporaryThriftFileDirectory is a file, not a directory"); final File outputDirectory = getOutputDirectory(); @@ -268,7 +268,9 @@ abstract class AbstractThriftMojo extends AbstractMojo { if (temporaryThriftFileDirectory.exists()) { cleanDirectory(temporaryThriftFileDirectory); } + Set<File> thriftDirectories = newHashSet(); + for (File classpathElementFile : classpathElementFiles) { // for some reason under IAM, we receive poms as dependent files // I am excluding .xml rather than including .jar as there may be other extensions in use (sar, har, zip) @@ -283,18 +285,27 @@ abstract class AbstractThriftMojo extends AbstractMojo { throw new IllegalArgumentException(format( "%s was not a readable artifact", classpathElementFile)); } + + /** + * Copy each .thrift file found in the JAR into a temporary directory, preserving the + * directory path it had relative to its containing JAR. Add the resulting root directory + * (unique for each JAR processed) to the set of thrift include directories to use when + * compiling. + */ for (JarEntry jarEntry : list(classpathJar.entries())) { final String jarEntryName = jarEntry.getName(); if (jarEntry.getName().endsWith(THRIFT_FILE_SUFFIX)) { + final String truncatedJarPath = truncatePath(classpathJar.getName()); + final File thriftRootDirectory = new File(temporaryThriftFileDirectory, truncatedJarPath); final File uncompressedCopy = - new File(new File(temporaryThriftFileDirectory, - truncatePath(classpathJar.getName())), jarEntryName); + new File(thriftRootDirectory, jarEntryName); uncompressedCopy.getParentFile().mkdirs(); copyStreamToFile(new RawInputStreamFacade(classpathJar .getInputStream(jarEntry)), uncompressedCopy); - thriftDirectories.add(uncompressedCopy.getParentFile()); + thriftDirectories.add(thriftRootDirectory); } } + } else if (classpathElementFile.isDirectory()) { File[] thriftFiles = classpathElementFile.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { @@ -307,6 +318,7 @@ abstract class AbstractThriftMojo extends AbstractMojo { } } } + return ImmutableSet.copyOf(thriftDirectories); } @@ -319,15 +331,6 @@ abstract class AbstractThriftMojo extends AbstractMojo { return ImmutableSet.copyOf(thriftFilesInDirectory); } - ImmutableSet<File> findThriftFilesInDirectories(Iterable<File> directories) throws IOException { - checkNotNull(directories); - Set<File> thriftFiles = newHashSet(); - for (File directory : directories) { - thriftFiles.addAll(findThriftFilesInDirectory(directory)); - } - return ImmutableSet.copyOf(thriftFiles); - } - /** * Truncates the path of jar files so that they are relative to the local repository. * diff --git a/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java b/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java index fb89d966f..1b1d99e0d 100644 --- a/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java +++ b/contrib/thrift-maven-plugin/src/main/java/org/apache/thrift/maven/ThriftTestCompileMojo.java @@ -23,6 +23,7 @@ import java.io.File; import java.util.List; import org.apache.maven.artifact.Artifact; import com.google.common.collect.ImmutableList; +import org.apache.maven.artifact.repository.ArtifactRepository; /** * @phase generate-test-sources @@ -71,4 +72,22 @@ public final class ThriftTestCompileMojo extends AbstractThriftMojo { protected File getThriftSourceRoot() { return thriftTestSourceRoot; } + + /** + * Set the local maven ArtifactRepository. Exposed only to allow testing outside of Maven itself. + * + * @param localRepository local ArtifactRepository + */ + public void setLocalMavenRepository(final ArtifactRepository localRepository) { + this.localRepository = localRepository; + } + + /** + * Set the option to hash dependent JAR paths. Exposed only to allow testing outside of Maven itself. + * + * @param hashDependentPaths whether or not to hash paths to dependent JARs + */ + public void setHashDependentPaths(final boolean hashDependentPaths) { + this.hashDependentPaths = hashDependentPaths; + } } diff --git a/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java new file mode 100644 index 000000000..c1176712d --- /dev/null +++ b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestAbstractThriftMojo.java @@ -0,0 +1,102 @@ +/* + * 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 org.apache.thrift.maven; + +import com.google.common.collect.Lists; +import com.google.common.collect.Sets; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.io.File; +import java.util.Set; + +import static junit.framework.TestCase.assertEquals; + + +public class TestAbstractThriftMojo { + + private ThriftTestCompileMojo mojo; + private File testRootDir; + private ArtifactRepository mavenRepository; + + + @Before + public void setUp() throws Exception { + final File tmpDir = new File(System.getProperty("java.io.tmpdir")); + testRootDir = new File(tmpDir, "thrift-test"); + + // the truncatePath method assumes a maven repository, but it only cares about the base dir + mavenRepository = Mockito.mock(ArtifactRepository.class); + Mockito.when(mavenRepository.getBasedir()).thenReturn("/test/maven/repo/basedir"); + + mojo = new ThriftTestCompileMojo(); + mojo.setLocalMavenRepository(mavenRepository); + } + + @Test + public void testMakeThriftPathFromJars() throws Throwable { + final File temporaryThriftFileDirectory = testRootDir; + + // The SharedIdl.jar file contains the same idl/shared.thrift and idl/tutorial.thrift hierarchy + // used by other tests. It's used here to represent a dependency of the project maven is building, + // one that is contributing .thrift IDL files as well as any other artifacts. + final Iterable<File> classpathElementFiles = Lists.newArrayList( + new File("src/test/resources/dependency-jar-test/SharedIdl.jar") + ); + + final Set<File> thriftDirectories = mojo.makeThriftPathFromJars(temporaryThriftFileDirectory, classpathElementFiles); + + // The results should be a path to a directory named after the JAR itself (assuming no path hashing, + // but see below for a separate test of that) representing the root of a hierarchy containing thrift + // files, suitable for providing to the thrift compiler as an include directory. In this case, that + // means it points to the directory containing the "idl" hierarchy rather than to the idl directory + // itself. + final Set<File> expected = Sets.newHashSet( + new File(testRootDir, "src/test/resources/dependency-jar-test/SharedIdl.jar") + ); + + assertEquals("makeThriftPathFromJars should return thrift IDL base path from within JAR", expected, thriftDirectories); + } + + @Test + public void testTruncatePath() throws Throwable { + // JAR path is unrelated to maven repo, and should be unchanged + assertEquals("/path/to/somejar.jar", mojo.truncatePath("/path/to/somejar.jar")); + + // JAR path is within maven repo, and should be made relative to the repo + assertEquals("path/to/somejar.jar", mojo.truncatePath("/test/maven/repo/basedir/path/to/somejar.jar")); + + // JAR path contains forward slashes that should be normalized + assertEquals("/path/to/somejar.jar", mojo.truncatePath("\\path\\to\\somejar.jar")); + } + + @Test + public void testTruncatePathWithDependentPathHashing() throws Throwable { + mojo.setHashDependentPaths(true); + + // hashDependentPaths set to true, the JAR path is immediately hashed (MD5) and converted to a hex string + + assertEquals("1c85950987b23493462cf3c261d9510a", mojo.truncatePath("/path/to/somejar.jar")); + assertEquals("39fc2b4c34cb6cb0da38bed5d8b5fc67", mojo.truncatePath("/test/maven/repo/basedir/path/to/somejar.jar")); + assertEquals("25b6924f5b0e19486d0ff88448e999d5", mojo.truncatePath("\\path\\to\\somejar.jar")); + } + +} diff --git a/contrib/thrift.spec b/contrib/thrift.spec index ccd35a50d..cc3c33c8e 100644 --- a/contrib/thrift.spec +++ b/contrib/thrift.spec @@ -28,7 +28,7 @@ Name: thrift License: Apache License v2.0 Group: Development Summary: RPC and serialization framework -Version: 0.10.0 +Version: 1.0.0 Release: 0 URL: http://thrift.apache.org Packager: Thrift Developers <dev@thrift.apache.org> @@ -178,6 +178,19 @@ export RUBYLIB=${PWD}/lib/rb/lib --without-csharp \ --without-erlang \ +%if 0%{!?without_ruby:1} +eval $(grep "^WITH_RUBY_TRUE" config.log) +if [[ "${WITH_RUBY_TRUE}" != "" ]]; then + set +x + echo "" + echo "configure determined that ruby requirements are missing (bundler gem?), either install missing components" >&2 + echo "or disable the ruby sub-packages as follows:" >&2 + echo " rpmbuild -D'%without_ruby 1' ..." >&2 + echo "" + exit 1 +fi +%endif + make %{?_smp_mflags} %if 0%{!?without_java:1} @@ -234,5 +247,7 @@ umask 007 /sbin/ldconfig > /dev/null 2>&1 %changelog -* Wed Oct 10 2012 Thrift Dev <dev@thrift.apache.org> +* Wed Aug 21 2013 Thrift Dev <dev@thrift.apache.org> +- Thrift 0.9.1 release. +* Wed Oct 10 2012 Thrift Dev <dev@thrift.apache.org> - Thrift 0.9.0 release. diff --git a/contrib/transport-sample/ThriftCommon.h b/contrib/transport-sample/ThriftCommon.h index d24d1a7a7..e16d87ddd 100644 --- a/contrib/transport-sample/ThriftCommon.h +++ b/contrib/transport-sample/ThriftCommon.h @@ -16,8 +16,6 @@ // #ifdef _WIN32 //thrift is crashing when using boost threads on Mac OSX -# define USE_BOOST_THREAD 1 -# include <boost/thread.hpp> #else # include <sys/socket.h> # include <netinet/in.h> diff --git a/contrib/vagrant/centos-6.5/README.md b/contrib/vagrant/centos-6.5/README.md index 76dca4439..55583f901 100644 --- a/contrib/vagrant/centos-6.5/README.md +++ b/contrib/vagrant/centos-6.5/README.md @@ -11,7 +11,7 @@ This will download and launch the base box VM under VirtualBox and run the Apach $ vagrant ssh [vagrant@thrift ~]$ cd /thrift [vagrant@thrift thrift]$ compiler/cpp/thrift --version - Thrift version 1.0.0-dev + Thrift version <version> The provisioning script (inside the Vagrantfile) runs ./bootstrap.sh, ./configure, make and make check, but does not install thrift. To install thrift run "make install". diff --git a/contrib/vagrant/centos-6.5/Vagrantfile b/contrib/vagrant/centos-6.5/Vagrantfile index 6207958b3..51a2239bc 100644 --- a/contrib/vagrant/centos-6.5/Vagrantfile +++ b/contrib/vagrant/centos-6.5/Vagrantfile @@ -87,7 +87,7 @@ sudo ./b2 install # Java LIB Dependencies ##################################### -sudo yum install -y ant junit ant-nodeps ant-junit java-1.7.0-openjdk-devel +sudo yum install -y ant junit ant-nodeps ant-junit java-1.8.0-openjdk-devel # Python LIB Dependencies ##################################### diff --git a/contrib/zeromq/Makefile b/contrib/zeromq/Makefile index b09f4ee34..ee398e22c 100644 --- a/contrib/zeromq/Makefile +++ b/contrib/zeromq/Makefile @@ -26,7 +26,7 @@ test-client.o test-server.o test-sender.o test-receiver.o: $(GENSRCS) storage/__init__.py: storage.thrift $(RM) $(dir $@) - $(THRIFT) --gen py:newstyle $< + $(THRIFT) --gen py $< mv gen-py/$(dir $@) . $(GENSRCS): storage.thrift diff --git a/contrib/zeromq/TZmqServer.cpp b/contrib/zeromq/TZmqServer.cpp index f03145885..88660a330 100644 --- a/contrib/zeromq/TZmqServer.cpp +++ b/contrib/zeromq/TZmqServer.cpp @@ -21,7 +21,7 @@ #include <thrift/transport/TBufferTransports.h> #include <boost/scoped_ptr.hpp> -using boost::shared_ptr; +using apache::thrift::std::shared_ptr; using apache::thrift::transport::TMemoryBuffer; using apache::thrift::protocol::TProtocol; diff --git a/contrib/zeromq/TZmqServer.h b/contrib/zeromq/TZmqServer.h index a840c8646..ecd13b424 100644 --- a/contrib/zeromq/TZmqServer.h +++ b/contrib/zeromq/TZmqServer.h @@ -20,6 +20,7 @@ #ifndef _THRIFT_SERVER_TZMQSERVER_H_ #define _THRIFT_SERVER_TZMQSERVER_H_ 1 +#include <memory> #include <zmq.hpp> #include <thrift/server/TServer.h> @@ -28,7 +29,7 @@ namespace apache { namespace thrift { namespace server { class TZmqServer : public TServer { public: TZmqServer( - boost::shared_ptr<TProcessor> processor, + std::shared_ptr<TProcessor> processor, zmq::context_t& ctx, const std::string& endpoint, int type) : TServer(processor) , processor_(processor) @@ -56,7 +57,7 @@ class TZmqServer : public TServer { } private: - boost::shared_ptr<TProcessor> processor_; + std::shared_ptr<TProcessor> processor_; int zmq_type_; zmq::socket_t sock_; }; diff --git a/contrib/zeromq/csharp/ThriftZMQ.csproj b/contrib/zeromq/csharp/ThriftZMQ.csproj index ef2dbc3b9..80ad1dbd6 100755 --- a/contrib/zeromq/csharp/ThriftZMQ.csproj +++ b/contrib/zeromq/csharp/ThriftZMQ.csproj @@ -3,7 +3,7 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> - <ProductVersion>0.10.0</ProductVersion> + <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{17C63B90-DFD7-42AC-A7B0-749E6876C0A1}</ProjectGuid> <OutputType>Exe</OutputType> @@ -25,7 +25,7 @@ <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> - <ApplicationVersion>0.10.0.%2a</ApplicationVersion> + <ApplicationVersion>1.0.0.0</ApplicationVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> @@ -88,4 +88,4 @@ </BootstrapperPackage> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -</Project>
\ No newline at end of file +</Project> diff --git a/contrib/zeromq/test-client.cpp b/contrib/zeromq/test-client.cpp index d2fc56ce1..159c25030 100644 --- a/contrib/zeromq/test-client.cpp +++ b/contrib/zeromq/test-client.cpp @@ -6,7 +6,7 @@ #include "TZmqClient.h" #include "Storage.h" -using boost::shared_ptr; +using apache::thrift::std::shared_ptr; using apache::thrift::transport::TZmqClient; using apache::thrift::protocol::TBinaryProtocol; @@ -17,7 +17,7 @@ int main(int argc, char** argv) { if (argc > 1) { incr = atoi(argv[1]); if (incr) { - socktype = ZMQ_DOWNSTREAM; + socktype = ZMQ_PUSH; endpoint = "tcp://127.0.0.1:9091"; } } diff --git a/contrib/zeromq/test-client.py b/contrib/zeromq/test-client.py index 753b132d8..d51216e45 100755 --- a/contrib/zeromq/test-client.py +++ b/contrib/zeromq/test-client.py @@ -15,7 +15,7 @@ def main(args): if len(args) > 1: incr = int(args[1]) if incr: - socktype = zmq.DOWNSTREAM + socktype = zmq.PUSH endpoint = "tcp://127.0.0.1:9091" ctx = zmq.Context() @@ -29,7 +29,7 @@ def main(args): time.sleep(0.05) else: value = client.get() - print value + print(value) if __name__ == "__main__": diff --git a/contrib/zeromq/test-receiver.cpp b/contrib/zeromq/test-receiver.cpp index 8fe69da92..d465bff63 100644 --- a/contrib/zeromq/test-receiver.cpp +++ b/contrib/zeromq/test-receiver.cpp @@ -2,7 +2,7 @@ #include "TZmqServer.h" #include "Storage.h" -using boost::shared_ptr; +using apache::thrift::std::shared_ptr; using apache::thrift::TProcessor; using apache::thrift::server::TZmqServer; using apache::thrift::server::TZmqMultiServer; diff --git a/contrib/zeromq/test-sender.cpp b/contrib/zeromq/test-sender.cpp index 6b0eef156..5c086a11f 100644 --- a/contrib/zeromq/test-sender.cpp +++ b/contrib/zeromq/test-sender.cpp @@ -6,7 +6,7 @@ #include "TZmqClient.h" #include "Storage.h" -using boost::shared_ptr; +using apache::thrift::std::shared_ptr; using apache::thrift::transport::TZmqClient; using apache::thrift::protocol::TBinaryProtocol; diff --git a/contrib/zeromq/test-server.cpp b/contrib/zeromq/test-server.cpp index c624b0d8d..e6f1b2083 100644 --- a/contrib/zeromq/test-server.cpp +++ b/contrib/zeromq/test-server.cpp @@ -2,7 +2,7 @@ #include "TZmqServer.h" #include "Storage.h" -using boost::shared_ptr; +using apache::thrift::std::shared_ptr; using apache::thrift::TProcessor; using apache::thrift::server::TZmqServer; using apache::thrift::server::TZmqMultiServer; @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) { zmq::context_t ctx(1); TZmqServer reqrep_server(processor, ctx, "tcp://0.0.0.0:9090", ZMQ_REP); - TZmqServer oneway_server(processor, ctx, "tcp://0.0.0.0:9091", ZMQ_UPSTREAM); + TZmqServer oneway_server(processor, ctx, "tcp://0.0.0.0:9091", ZMQ_PULL); TZmqMultiServer multiserver; multiserver.servers().push_back(&reqrep_server); multiserver.servers().push_back(&oneway_server); diff --git a/contrib/zeromq/test-server.py b/contrib/zeromq/test-server.py index c7804d317..d89b37ba2 100755 --- a/contrib/zeromq/test-server.py +++ b/contrib/zeromq/test-server.py @@ -22,7 +22,7 @@ def main(): ctx = zmq.Context() reqrep_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9090", zmq.REP) - oneway_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9091", zmq.UPSTREAM) + oneway_server = TZmqServer.TZmqServer(processor, ctx, "tcp://0.0.0.0:9091", zmq.PULL) multiserver = TZmqServer.TZmqMultiServer() multiserver.servers.append(reqrep_server) multiserver.servers.append(oneway_server) |