Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hrcpp 465/cs transactions #142

Merged
merged 6 commits into from Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Expand Up @@ -167,7 +167,7 @@ if (WIN32)

add_custom_target(
swig ALL
COMMAND cmake -G "${CMAKE_GENERATOR}" "-DHOTRODCPP_HOME=${NATIVE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/swig"
COMMAND cmake -G "${CMAKE_GENERATOR}" "-DHOTRODCPP_HOME=${NATIVE_DIR}" "-DSWIG_DIR=${SWIG_DIR}" "-DSWIG_EXECUTABLE=${SWIG_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/swig"
COMMAND cmake --build . --config "${CMAKE_CFG_INTDIR}"
WORKING_DIRECTORY "${SWIG_BUILD}"
DEPENDS ${PROTO_SRCS} ${TEST_PROTO_SRCS}
Expand Down Expand Up @@ -416,6 +416,7 @@ if (NOT DEFINED ENABLE_CSHARP_TESTING OR ENABLE_CSHARP_TESTING)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/standalone-hotrod-ssl.xml DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/clustered-sasl-cs.xml DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/clustered.xml DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/standalone.xml DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore.jks DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/truststore.jks DESTINATION "${JBOSS_HOME}/standalone/configuration")
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/resources/certificates/keystore_server_sni1_rsa.jks DESTINATION "${JBOSS_HOME}/standalone/configuration")
Expand Down
13 changes: 6 additions & 7 deletions Jenkinsfile
Expand Up @@ -11,23 +11,22 @@ pipeline {
cppTag = '8.1.0.Final'
CMAKE_HOME = 'C:\\\\PROGRA~2\\\\CMake\\\\bin'
generator = '"Visual Studio 14 2015 Win64"'
INFINISPAN_VERSION = '9.2.3.Final'
INFINISPAN_VERSION = '9.3.1.Final'
JAVA_HOME = 'C:\\\\PROGRA~1\\\\JAVA\\\\JDK18~1.0_7'
M2_HOME = 'C:\\\\APACHE~1.9'
MVN_PROGRAM = 'C:\\\\APACHE~1.9\\\\BIN\\\\MVN.BAT'
PROTOBUF_INCLUDE_DIR = 'C:\\\\protobuf-2.6.1-pack\\\\include'
PROTOBUF_LIBRARY = 'C:\\\\protobuf-2.6.1-pack\\\\lib\\\\libprotobuf-static.lib'
PROTOBUF_PROTOC_EXECUTABLE = 'C:\\\\protobuf-2.6.1-pack\\\\bin\\\\protoc.exe'
PROTOBUF_PROTOC_LIBRARY = 'C:\\\\protobuf-2.6.1-pack\\\\lib\\\\libprotoc.lib'
SWIG_DIR = 'C:\\\\PROGRA~1\\\\SWIGWI~1.12'
SWIG_EXECUTABLE = 'C:\\\\PROGRA~1\\\\SWIGWI~1.12\\\\SWIG.EXE'
SWIG_DIR = 'C:\\\\PROGRA~1\\\\SWIGWI~2.12'
SWIG_EXECUTABLE = 'C:\\\\PROGRA~1\\\\SWIGWI~2.12\\\\SWIG.EXE'
test32 = 'empty'
test64 = 'empty'
version_1major = '8'
version_2minor = '1'
version_3micro = '0'
version_4qualifier = 'Final'
HOTROD_LOG_LEVEL = 'TRACE'
}
steps {
dir('cpp-client') {
Expand Down Expand Up @@ -57,8 +56,8 @@ pipeline {
GOOGLE_PROTOBUF_NUPKG = 'C:\\\\Users\\\\Administrator'
HOTROD_SNK = 'c:\\\\data\\\\hotrod_cs.key'
IKVM_CUSTOM_BIN_PATH = 'C:\\\\Users\\\\Administrator\\\\ikvm-8.1.5717.0\\\\bin'
INFINISPAN_VERSION = '9.2.3.Final'
JBOSS_HOME = 'Y:\\\\cpp-client\\\\infinispan-server-9.2.3.Final'
INFINISPAN_VERSION = '9.3.1.Final'
JBOSS_HOME = 'Y:\\\\cpp-client\\\\infinispan-server-9.3.1.Final'
JAVA_HOME = 'C:\\\\PROGRA~1\\\\JAVA\\\\JDK18~1.0_7'
M2_HOME = 'C:\\\\APACHE~1.9'
MAVEN_OPTS = '"-Dmaven.multiModuleProjectDirectory=C:\\\\APACHE~1.9"'
Expand All @@ -72,7 +71,7 @@ pipeline {
PROTOBUF_PROTOC_EXECUTABLE = 'C:\\\\protobuf-2.6.1-pack\\\\bin\\\\protoc.exe'
PROTOBUF_PROTOC_EXECUTABLE_CS = 'C:\\\\Users\\\\Administrator\\\\Google.Protobuf.Tools.3.4.0\\\\tools\\\\windows_x64\\\\protoc.exe'
PROTOBUF_PROTOC_LIBRARY = 'C:\\\\protobuf-2.6.1-pack\\\\lib\\\\libprotoc.lib'
SWIG_DIR = 'C:\\\\PROGRA~1\\\\SWIGWI~1.12'
SWIG_DIR = 'C:\\\\PROGRA~1\\\\SWIGWI~2.12'
SWIG_EXECUTABLE = 'C:\\\\PROGRA~1\\\\SWIGWI~2.12\\\\SWIG.EXE'
test32 = 'skip'
test64 = 'run'
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Expand Up @@ -16,7 +16,7 @@ cd build_windows
set "buildTest=%~1"

call :unquote u_generator %generator%
cmake -G "%u_generator%" -DHOTRODCPP_HOME=%HOTRODCPP_HOME% -DPROTOBUF_PROTOC_EXECUTABLE_CS="%PROTOBUF_PROTOC_EXECUTABLE_CS%" -DGOOGLE_PROTOBUF_NUPKG="%GOOGLE_PROTOBUF_NUPKG%" -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INCLUDE_DIR% -DJBOSS_HOME=%JBOSS_HOME% -DIKVM_CUSTOM_BIN_PATH=%IKVM_CUSTOM_BIN_PATH% -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_DIR% -DCONFIGURATION=RelWithDebInfo %~4 ..
cmake -G "%u_generator%" -DHOTRODCPP_HOME=%HOTRODCPP_HOME% -DSWIG_DIR=%SWIG_DIR% -DSWIG_EXECUTABLE=%SWIG_EXECUTABLE% -DPROTOBUF_PROTOC_EXECUTABLE_CS="%PROTOBUF_PROTOC_EXECUTABLE_CS%" -DGOOGLE_PROTOBUF_NUPKG="%GOOGLE_PROTOBUF_NUPKG%" -DPROTOBUF_INCLUDE_DIR=%PROTOBUF_INCLUDE_DIR% -DJBOSS_HOME=%JBOSS_HOME% -DIKVM_CUSTOM_BIN_PATH=%IKVM_CUSTOM_BIN_PATH% -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_DIR% -DCONFIGURATION=RelWithDebInfo %~4 ..
if %errorlevel% neq 0 goto fail

cmake --build . --config RelWithDebInfo
Expand Down
18 changes: 18 additions & 0 deletions src/Infinispan.HotRod/Config/Configuration.cs
Expand Up @@ -130,5 +130,23 @@ public IMarshaller Marshaller()
{
return marshaller;
}

/// <summary>
/// Check if this configuration enables transactional operation
/// </summary>
/// <returns></returns>
public bool IsTransactional()
{
return config.isTransactional();
}

/// <summary>
/// Enable disable transactional operations
/// </summary>
/// <param name="t">true enables transactional operations</param>
public void SetTransactional(bool t)
{
config.setTransactional(t);
}
}
}
7 changes: 6 additions & 1 deletion src/Infinispan.HotRod/Config/ConfigurationBuilder.cs
Expand Up @@ -135,7 +135,12 @@ public ConfigurationBuilder Marshaller(IMarshaller marshaller)
this.marshaller = marshaller;
return this;
}


public ConfigurationBuilder Transactional(bool t)
{
builder.SetTransactional(t);
return this;
}
}
#pragma warning restore 1591
}
12 changes: 12 additions & 0 deletions src/Infinispan.HotRod/Exceptions/HotRodClientRollbackException.cs
@@ -0,0 +1,12 @@
namespace Infinispan.HotRod.Exceptions
{
/// <summary>
/// Used to indicated that a commit operation actually rolled back
/// </summary>
public class HotRodClientRollbackException : HotRodClientException
{
internal HotRodClientRollbackException(string message) : base(message)
{
}
}
}
9 changes: 9 additions & 0 deletions src/Infinispan.HotRod/RemoteCacheManager.cs
Expand Up @@ -256,5 +256,14 @@ public ISet<String> GetCacheNames()
{
return manager.GetCacheNames();
}

/// <summary>
/// Return the transaction manager
/// </summary>
/// <returns></returns>
public Infinispan.HotRod.SWIG.TransactionManager GetTransactionManager()
{
return manager.GetTransactionManager();
}
}
}
2 changes: 2 additions & 0 deletions src/Infinispan.HotRod/SWIG/Configuration.cs
Expand Up @@ -21,5 +21,7 @@ internal interface Configuration

IList<ServerConfiguration> Servers();
Dictionary<string,IList<ServerConfiguration>> GetServersMapConfiguration();
bool isTransactional();
void setTransactional(bool t);
}
}
1 change: 1 addition & 0 deletions src/Infinispan.HotRod/SWIG/ConfigurationBuilder.cs
Expand Up @@ -28,5 +28,6 @@ internal interface ConfigurationBuilder
ConfigurationBuilder ValueSizeEstimate(int valueSizeEstimate);
ConfigurationBuilder MaxRetries(int maxRetries);
ConfigurationBuilder BalancingStrategyProducer(Infinispan.HotRod.Config.FailOverRequestBalancingStrategyProducerDelegate bsp);
ConfigurationBuilder SetTransactional(bool t);
}
}
1 change: 1 addition & 0 deletions src/Infinispan.HotRod/SWIG/RemoteCacheManager.cs
Expand Up @@ -16,5 +16,6 @@ internal interface RemoteCacheManager
RemoteCounterManager GetCounterManager();
Infinispan.HotRod.SWIGGen.RemoteCacheManagerAdmin administration();
System.Collections.Generic.ISet<string> GetCacheNames();
TransactionManager GetTransactionManager();
}
}
23 changes: 23 additions & 0 deletions src/Infinispan.HotRod/SWIG/TransactionManager.cs
@@ -0,0 +1,23 @@
using System;

namespace Infinispan.HotRod.SWIG
{
/// <summary>
/// This class contains method to start commit and rollback a transaction
/// </summary>
public interface TransactionManager
{
/// <summary>
/// Begin a transaction
/// </summary>
void Begin();
/// <summary>
/// Commit a transaction
/// </summary>
void Commit();
/// <summary>
/// Rollback a transaction
/// </summary>
void Rollback();
}
}
23 changes: 23 additions & 0 deletions swig/hotrod_arch.i
Expand Up @@ -74,6 +74,10 @@
return this;
}

public Infinispan.HotRod.SWIG.ConfigurationBuilder SetTransactional(bool t) {
return setTransactional(t);
}

%}

%typemap(csinterfaces_derived) infinispan::hotrod::ServerConfigurationBuilder "IDisposable, Infinispan.HotRod.SWIG.ServerConfigurationBuilder"
Expand Down Expand Up @@ -351,12 +355,26 @@ public System.Collections.Generic.Dictionary<string, System.Collections.Generic.
%typemap(csinterfaces) infinispan::hotrod::RemoteCache<infinispan::hotrod::ByteArray, infinispan::hotrod::ByteArray> "IDisposable, Infinispan.HotRod.SWIG.RemoteByteArrayCache"

%typemap(csinterfaces) infinispan::hotrod::RemoteCacheManager "IDisposable, Infinispan.HotRod.SWIG.RemoteCacheManager"
%typemap(csinterfaces) infinispan::hotrod::TransactionManager "IDisposable, Infinispan.HotRod.SWIG.TransactionManager"
%typemap(csinterfaces) infinispan::hotrod::RemoteCounterManager "IDisposable, Infinispan.HotRod.RemoteCounterManager"
%typemap(csinterfaces) infinispan::hotrod::Counter "IDisposable, Infinispan.HotRod.Counter"
%typemap(csinterfaces_derived) infinispan::hotrod::StrongCounter "IDisposable, Infinispan.HotRod.StrongCounter"
%typemap(csinterfaces_derived) infinispan::hotrod::WeakCounter "IDisposable, Infinispan.HotRod.WeakCounter"
%typemap(csinterfaces) infinispan::hotrod::CounterConfiguration "IDisposable, Infinispan.HotRod.ICounterConfiguration"

%typemap(cscode) infinispan::hotrod::TransactionManager %{
public void Begin() {
begin();
}

public void Commit() {
commit();
}

public void Rollback() {
rollback();
}
%}
%typemap(cscode) infinispan::hotrod::RemoteCacheManager %{
public void Start() {
start();
Expand Down Expand Up @@ -409,6 +427,11 @@ public System.Collections.Generic.Dictionary<string, System.Collections.Generic.
v.destroy_iterator(it);
return retSet;
}

public Infinispan.HotRod.SWIG.TransactionManager GetTransactionManager() {
return (Infinispan.HotRod.SWIG.TransactionManager)getTransactionManager();
}

%}

%typemap(cscode) infinispan::hotrod::RemoteCounterManager %{
Expand Down
13 changes: 10 additions & 3 deletions swig/hotrod_exception.i
Expand Up @@ -9,6 +9,7 @@
HotRod_HotRodClientException,
HotRod_CounterLowerBoundException,
HotRod_CounterUpperBoundException,
HotRod_HotRodClientRollbackException,
HotRod_Exception,

} HotRodExceptionCodes;
Expand Down Expand Up @@ -66,6 +67,9 @@
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.CounterUpperBoundException(message));
break;
case 9:
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.HotRodClientRollbackException(message));
break;
case 10:
default:
SWIGPendingException.Set(new Infinispan.HotRod.Exceptions.Exception(message));
break;
Expand Down Expand Up @@ -100,15 +104,18 @@
} catch (const infinispan::hotrod::UnsupportedOperationException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_UnsupportedOperationException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientException, e.what());
return $null;
} catch (const infinispan::hotrod::CounterLowerBoundException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_CounterLowerBoundException, e.what());
return $null;
} catch (const infinispan::hotrod::CounterUpperBoundException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_CounterUpperBoundException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientRollbackException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientRollbackException, e.what());
return $null;
} catch (const infinispan::hotrod::HotRodClientException& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_HotRodClientException, e.what());
return $null;
} catch (const infinispan::hotrod::Exception& e) {
SWIG_CSharpSetPendingExceptionCustom(HotRod_Exception, e.what());
return $null;
Expand Down
12 changes: 12 additions & 0 deletions swig/hotrodcs.i
Expand Up @@ -13,6 +13,8 @@ namespace org { namespace infinispan { namespace query { namespace remote { name
%typemap(csin) TYPE, TYPE& "$csinput"
%enddef

%typemap(csbase) infinispan::hotrod::TransactionRemoteStatus "uint"

%cs_callback(infinispan::hotrod::FailOverRequestBalancingStrategy::ProducerFn, FailOverRequestBalancingStrategyProducerDelegate)

%include "std_shared_ptr.i"
Expand Down Expand Up @@ -44,6 +46,8 @@ namespace org { namespace infinispan { namespace query { namespace remote { name
#include <infinispan/hotrod/MetadataValue.h>
#include <infinispan/hotrod/RemoteCache.h>
#include <infinispan/hotrod/RemoteCacheBase.h>
#include <infinispan/hotrod/TransactionManager.h>
#include <infinispan/hotrod/Transactions.h>
#include <infinispan/hotrod/RemoteCacheManager.h>
#include <infinispan/hotrod/RemoteCacheManagerAdmin.h>
#include <infinispan/hotrod/ServerConfiguration.h>
Expand All @@ -69,6 +73,7 @@ namespace org { namespace infinispan { namespace query { namespace remote { name
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "internal class"
%typemap(csclassmodifiers) enum SWIGTYPE "internal enum"


/* Force a common interface between the 32 and 64 bit wrapper code. */
%include "hotrod_arch.i"

Expand Down Expand Up @@ -179,6 +184,11 @@ static int getpath(void *context, const char ** path) {
%ignore infinispan::hotrod::event::ClientCacheEntryCustomEvent;
%ignore infinispan::hotrod::event::DotNetClientListener::getFailoverFunction;
%ignore getBalancingStrategy;
%ignore infinispan::hotrod::TransactionContext;
%ignore infinispan::hotrod::SynchronizationAdapter;
%ignore infinispan::hotrod::XID;
%ignore infinispan::hotrod::TransactionTable;


%include "infinispan/hotrod/ClientEvent.h"
%include "infinispan/hotrod/ClientListener.h"
Expand All @@ -202,6 +212,8 @@ static int getpath(void *context, const char ** path) {

%include "infinispan/hotrod/RemoteCacheBase.h"
%include "infinispan/hotrod/RemoteCache.h"
%include "infinispan/hotrod/TransactionManager.h"
%include "infinispan/hotrod/Transactions.h"
%include "infinispan/hotrod/RemoteCacheManager.h"
%include "infinispan/hotrod/CounterConfiguration.h"
%include "infinispan/hotrod/CounterEvent.h"
Expand Down
2 changes: 2 additions & 0 deletions test/Infinispan.HotRod.Tests/RemoteEventTest.cs
Expand Up @@ -139,6 +139,7 @@ public void ConditionalEventsTest()
}

[Test]
[Ignore("ISPN-9409")]
public void CustomEventsTest()
{
LoggingEventListener<string> listener = new LoggingEventListener<string>();
Expand Down Expand Up @@ -169,6 +170,7 @@ public void CustomEventsTest()
}

[Test]
[Ignore("ISPN-9409")]
public void FilterEventsTest()
{
LoggingEventListener<string> listener = new LoggingEventListener<string>();
Expand Down