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 390/rm some expected fail #302

Merged
merged 3 commits into from
Sep 26, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public RemoteCacheManager(Configuration config) {

public RemoteCacheManager(Configuration config, boolean start) {
jniRemoteCacheManager = new org.infinispan.client.hotrod.jni.RemoteCacheManager(config.getJniConfiguration(), start);
marshaller = new org.infinispan.commons.marshall.jboss.GenericJBossMarshaller();
marshaller = (config.marshaller()!=null) ? config.marshaller() :
new org.infinispan.commons.marshall.jboss.GenericJBossMarshaller();
}

public RemoteCacheManager(URL config, boolean start) throws IOException {
Expand All @@ -77,19 +78,35 @@ public RemoteCacheManager(Properties props, boolean start) {
}

public <K, V> org.infinispan.client.hotrod.RemoteCache<K, V> getCache() {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, "", false);
try {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, "", false);
} catch (Exception e) {
return null;
}
}

public <K, V> org.infinispan.client.hotrod.RemoteCache<K, V> getCache(boolean forceReturnValue) {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, "", forceReturnValue);
try {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, "", forceReturnValue);
} catch (Exception e) {
return null;
}
}

public <K, V> org.infinispan.client.hotrod.RemoteCache<K, V> getCache(String cacheName) {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, cacheName, false);
try {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, cacheName, false);
} catch (Exception e) {
return null;
}
}

public <K, V> org.infinispan.client.hotrod.RemoteCache<K, V> getCache(String cacheName, boolean forceReturnValue) {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, cacheName, forceReturnValue);
try {
return new org.infinispan.client.hotrod.impl.RemoteCacheImpl<K, V>(this, cacheName, forceReturnValue);
} catch (Exception e) {
return null;
}
}

public Marshaller getMarshaller() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ public Configuration(org.infinispan.client.hotrod.jni.Configuration jniConfigura
this.transportFactory = null;
}

public Configuration(org.infinispan.client.hotrod.jni.Configuration jniConfiguration, Marshaller marshaller2) {
super();
this.jniConfiguration = jniConfiguration;
this.asyncExecutorFactory = null;
this.balancingStrategy = null;
this.classLoader = null;
this.consistentHashImpl = null;
this.marshallerClass = (marshaller2==null) ? null : marshaller2.getClass();
this.marshaller = marshaller2;
this.servers = null;
this.failoverServers = null;
this.transportFactory = null;
}

Configuration(ExecutorFactoryConfiguration asyncExecutorFactory, Class<? extends RequestBalancingStrategy> balancingStrategy, ClassLoader classLoader,
ConnectionPoolConfiguration connectionPool, int connectionTimeout, Class<? extends ConsistentHash>[] consistentHashImpl, boolean forceReturnValues, int keySizeEstimate, Class<? extends Marshaller> marshallerClass,
boolean pingOnStartup, String protocolVersion, List<ServerConfiguration> servers, List<ServerConfiguration> failOverServers, int socketTimeout, SslConfiguration ssl, boolean tcpNoDelay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public org.infinispan.client.hotrod.jni.ConfigurationBuilder getJniConfiguration

@Override
public ServerConfigurationBuilder addServer() {
return new ServerConfigurationBuilder(this,jniConfigurationBuilder.addServer());
return new ServerConfigurationBuilder(this,jniConfigurationBuilder.addServer());
}

public ClusterConfigurationBuilder addCluster(String clusterName) {
return new ClusterConfigurationBuilder(this, jniConfigurationBuilder.addCluster(clusterName));
return new ClusterConfigurationBuilder(this, jniConfigurationBuilder.addCluster(clusterName));
}


Expand Down Expand Up @@ -171,16 +171,14 @@ public ConfigurationBuilder marshaller(String marshaller) {

@Override
public ConfigurationBuilder marshaller(Class<? extends Marshaller> marshaller) {
throw new UnsupportedOperationException();
// this.marshallerClass = marshaller;
// return this;
this.marshallerClass = marshaller;
return this;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this^^^ version of the method work too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok enabled

@Override
public ConfigurationBuilder marshaller(Marshaller marshaller) {
throw new UnsupportedOperationException();
// this.marshaller = marshaller;
// return this;
this.marshaller = marshaller;
return this;
}

@Override
Expand Down Expand Up @@ -238,7 +236,7 @@ public ConfigurationBuilder valueSizeEstimate(int valueSizeEstimate) {

@Override
public ConfigurationBuilder maxRetries(int maxRetries) {
this.jniConfigurationBuilder.maxRetries(maxRetries);
this.jniConfigurationBuilder.maxRetries(maxRetries);
this.maxRetries = maxRetries;
return this;
}
Expand Down Expand Up @@ -290,7 +288,8 @@ public Configuration create() {

@Override
public Configuration build() {
return new Configuration(this.jniConfigurationBuilder.build());
return (marshaller != null) ? new Configuration(this.jniConfigurationBuilder.build(), marshaller)
: new Configuration(this.jniConfigurationBuilder.build());
}

public Configuration build(boolean validate) {
Expand Down
64 changes: 29 additions & 35 deletions jni/src/test/java/org/infinispan/client/jni/hotrod/JniTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
import org.testng.ITestNGMethod;
import org.testng.ITestResult;
import org.testng.TestNG;
import org.testng.reporters.TextReporter;

public class JniTest implements IMethodSelector {
private final static String [] passOverTestList = {
"CacheManagerNotStartedTest.testPutAllAsync",
"CacheManagerNotStartedTest.testPutAsync",
"CacheManagerNotStartedTest.testReplaceAsync",
"CacheManagerNotStartedTest.testVersionedRemoveAsync",
"CacheManagerStoppedTest.testPutAllAsync",
"CacheManagerStoppedTest.testPutAsync",
"CacheManagerStoppedTest.testReplaceAsync",
"CacheManagerStoppedTest.testVersionedRemoveAsync",
private final static String [] passOverTestList = {
"CacheManagerNotStartedTest.testPutAllAsync",
"CacheManagerNotStartedTest.testPutAsync",
"CacheManagerNotStartedTest.testReplaceAsync",
"CacheManagerNotStartedTest.testVersionedRemoveAsync",
"CacheManagerStoppedTest.testPutAllAsync",
"CacheManagerStoppedTest.testPutAsync",
"CacheManagerStoppedTest.testReplaceAsync",
"CacheManagerStoppedTest.testVersionedRemoveAsync",
"HotRodAsyncReplicationTest.testPutKeyValue"};
private final static HashSet<String> passOverTestSet = new HashSet<String>(Arrays.asList(passOverTestList));
public static void main(String[] args) {
TestNG testng = new TestNG();
testng.addMethodSelector("org.infinispan.client.jni.hotrod.JniTest", 1);
Expand Down Expand Up @@ -90,15 +89,12 @@ public static void main(String[] args) {
"BulkGetKeysDistTest.testBulkGetAfterLifespanExpire", // unstable, ISPN-4017
"HotRodIntegrationTest.testReplaceWithVersionWithLifespanAsync", // async not implemented
"ClientSocketReadTimeoutTest.testPutTimeout", // TODO: TransportException not marshalled correctly
"RemoteCacheManagerTest.testMarshallerInstance", // setting marshaller through configuration builder not implemented
"BulkGetKeysReplTest.testBulkGetAfterLifespanExpire",
"BulkGetKeysSimpleTest.testBulkGetAfterLifespanExpire",
"BulkGetReplTest.testBulkGetAfterLifespanExpire",
"BulkGetSimpleTest.testBulkGetAfterLifespanExpire",
"ForceReturnValuesTest.testDifferentInstancesForDifferentForceReturnValues",
"ForceReturnValuesTest.testSameInstanceForSameForceReturnValues",
"HotRodIntegrationTest.testGetWithMetadata",
"RemoteCacheManagerTest.testGetUndefinedCache"
"HotRodIntegrationTest.testGetWithMetadata"
));
Set<String> expectedSkips = Collections.emptySet();

Expand All @@ -118,7 +114,7 @@ public static void main(String[] args) {
if (!unexpectedFails.isEmpty()) {
exitCode = 1;
System.err.println("These test fail (but should not!):");
for (String testName : unexpectedFails) {
for (String testName : unexpectedFails) {
System.err.println("\t" + testName);
}
}
Expand All @@ -127,7 +123,7 @@ public static void main(String[] args) {
if (!notFailing.isEmpty()) {
exitCode = 1;
System.err.println("These test should fail (but don't!):");
for (String testName : notFailing) {
for (String testName : notFailing) {
System.err.println("\t" + testName);
}
}
Expand All @@ -136,7 +132,7 @@ public static void main(String[] args) {
if (!unexpectedSkips.isEmpty()) {
exitCode = 1;
System.err.println("These test have been skipped (but should not!):");
for (String testName : unexpectedSkips) {
for (String testName : unexpectedSkips) {
System.err.println("\t" + testName);
}
}
Expand All @@ -145,7 +141,7 @@ public static void main(String[] args) {
if (!notSkipped.isEmpty()) {
exitCode = 1;
System.err.println("These test should have been skipped (but haven't!):");
for (String testName : notSkipped) {
for (String testName : notSkipped) {
System.err.println("\t" + testName);
}
}
Expand All @@ -156,20 +152,18 @@ when main() returns. */
System.exit(exitCode);
}

@Override
public boolean includeMethod(IMethodSelectorContext context, ITestNGMethod method, boolean isTestMethod) {
String testName = method.getRealClass().getSimpleName()+"."+method.getMethodName();
if (passOverTestSet.contains(testName))
{
context.setStopped(true);
return false;
}
return true;
}
@Override
public boolean includeMethod(IMethodSelectorContext context, ITestNGMethod method, boolean isTestMethod) {
String testName = method.getRealClass().getSimpleName()+"."+method.getMethodName();
if (passOverTestSet.contains(testName)) {
context.setStopped(true);
return false;
}
return true;
}

@Override
public void setTestMethods(List<ITestNGMethod> testMethods) {
// TODO Auto-generated method stub

}
@Override
public void setTestMethods(List<ITestNGMethod> testMethods) {
// TODO Auto-generated method stub
}
}
5 changes: 3 additions & 2 deletions src/hotrod/impl/RemoteCacheManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ std::shared_ptr<RemoteCacheImpl> RemoteCacheManagerImpl::createRemoteCache(
const std::string& name, bool forceReturnValue, NearCacheConfiguration nc)
{
ScopedLock<Mutex> l(lock);
std::map<std::string, RemoteCacheHolder>::iterator iter = cacheName2RemoteCache.find(name);
std::string nameAndForceFlag = (forceReturnValue) ? name+"/true" : name+"/false";
std::map<std::string, RemoteCacheHolder>::iterator iter = cacheName2RemoteCache.find(nameAndForceFlag);
// Cache found
if (iter != cacheName2RemoteCache.end()) {
return iter->second.first;
Expand All @@ -123,7 +124,7 @@ std::shared_ptr<RemoteCacheImpl> RemoteCacheManagerImpl::createRemoteCache(
}
}
// If ping on startup is disabled, or cache is defined in server
cacheName2RemoteCache[name] = RemoteCacheHolder(rcache_sptr, forceReturnValue);
cacheName2RemoteCache[nameAndForceFlag] = RemoteCacheHolder(rcache_sptr, forceReturnValue);
return rcache_sptr;
}
catch (...)
Expand Down