public void StartHotrodServer()
        {
            ConfigurationBuilder builder = new ConfigurationBuilder();
            conf = builder.AddServers("127.0.0.1:11222").Build();

            string jbossHome = System.Environment.GetEnvironmentVariable("JBOSS_HOME");
            if (jbossHome == null)
            {
                throw new Exception("JBOSS_HOME env variable not set.");
            }

            Assert.IsTrue(PortProbe.IsPortClosed(conf.Servers()[0].Host(),
                                                 conf.Servers()[0].Port(),
                                                 millisTimeout:10000),
                          "Another process already listening on the same ip/port.");

            hrServer = new Process();
            hrServer.StartInfo.FileName = buildStartCommand(jbossHome);
            hrServer.StartInfo.UseShellExecute = false;
            if (PlatformUtils.isUnix()) {
                // Drop the output generated by the server on the console (data present in log file).
                hrServer.StartInfo.RedirectStandardOutput = true;
                hrServer.StartInfo.RedirectStandardError = true;
                hrServer.OutputDataReceived += new DataReceivedEventHandler(DropOutputHandler);
                hrServer.ErrorDataReceived += new DataReceivedEventHandler(DropOutputHandler);
            }
            hrServer.Start();

            Assert.IsTrue(PortProbe.IsPortOpen(conf.Servers()[0].Host(),
                                               conf.Servers()[0].Port()),
                          "Server not listening on the expected ip/port.");

            remoteManager = new RemoteCacheManager(conf, serializer);
            remoteManager.Start();
        }
Exemplo n.º 2
0
 public void BeforeClass()
 {
     ConfigurationBuilder conf = new ConfigurationBuilder();
     conf.AddServer().Host("127.0.0.1").Port(11222);
     conf.ConnectionTimeout(90000).SocketTimeout(6000);
     RemoteCacheManager remoteManager = new RemoteCacheManager(conf.Build(), true);
     cache = remoteManager.GetCache<String, String>();
 }
 public void BeforeClass() {
     ConfigurationBuilder conf = new ConfigurationBuilder();
     conf.AddServer().Host("127.0.0.1").Port(11222);
     conf.ConnectionTimeout(90000).SocketTimeout(6000);
     marshaller = new JBasicMarshaller();
     conf.Marshaller(marshaller);
     remoteManager = new RemoteCacheManager(conf.Build(), true);
 }
Exemplo n.º 4
0
        public void SNI2CorrectCredentialsTest()
        {
            ConfigurationBuilder conf = new ConfigurationBuilder();
            conf.AddServer().Host("127.0.0.1").Port(11222).ConnectionTimeout(90000).SocketTimeout(900);
            conf.Marshaller(new JBasicMarshaller());
            registerServerCAFile(conf, "keystore_server_sni2.pem", "sni2");
            RemoteCacheManager remoteManager = new RemoteCacheManager(conf.Build(), true);
            IRemoteCache<string, string> testCache = remoteManager.GetCache<string, string>();

            testCache.Clear();
            string k1 = "key13";
            string v1 = "boron";
            testCache.Put(k1, v1);
            Assert.AreEqual(v1, testCache.Get(k1));
        }
Exemplo n.º 5
0
        public void SSLSuccessfullServerAndClientAuthTest()
        {
            ConfigurationBuilder conf = new ConfigurationBuilder();
            conf.AddServer().Host("127.0.0.1").Port(11222).ConnectionTimeout(90000).SocketTimeout(900);
            registerServerCAFile(conf, "infinispan-ca.pem");
            conf.Marshaller(new JBasicMarshaller());

            RemoteCacheManager remoteManager = new RemoteCacheManager(conf.Build(), true);
            IRemoteCache<string, string> testCache = remoteManager.GetCache<string, string>();

            testCache.Clear();
            string k1 = "key13";
            string v1 = "boron";
            testCache.Put(k1, v1);
            Assert.AreEqual(v1, testCache.Get(k1));
        }
 static void Main()
 {
     // Create a configuration for a locally-running server
     ConfigurationBuilder builder = new ConfigurationBuilder();
     Configuration conf = builder.AddServers("127.0.0.1:11222").Build();
     // Initialize the remote cache manager
     RemoteCacheManager remoteManager = new RemoteCacheManager(conf);
     // Connect to the server
     remoteManager.Start();
     // Store a value
     IRemoteCache<string,string> cache=remoteManager.GetCache<string, string>();
     cache.Put("key", "value");
     // Retrieve the value and print it out
     Console.WriteLine("key = {0}", cache.Get("key"));
     // Stop the cache manager and release all resources
     remoteManager.Stop();
 }
        public void BeforeClass()
        {
            ConfigurationBuilder conf = new ConfigurationBuilder();
            conf.AddServer().Host("127.0.0.1").Port(11222);
            conf.ConnectionTimeout(90000).SocketTimeout(6000);
            conf.Marshaller(new BasicTypesProtoStreamMarshaller());
            remoteManager = new RemoteCacheManager(conf.Build(), true);

            IRemoteCache<String, String> metadataCache = remoteManager.GetCache<String, String>(PROTOBUF_METADATA_CACHE_NAME);
            metadataCache.Put("sample_bank_account/bank.proto", File.ReadAllText("proto2/bank.proto"));
            if (metadataCache.ContainsKey(ERRORS_KEY_SUFFIX))
            {
                Console.WriteLine("fail: error in registering .proto model");
                Environment.Exit(-1);
            }

            IRemoteCache<String, Transaction> transactionCache = remoteManager.GetCache<String, Transaction>(NAMED_CACHE);
            PutTransactions(transactionCache);
        }
 internal ClusterConfigurationBuilder(ConfigurationBuilder parentBuilder, Infinispan.HotRod.SWIG.ClusterConfigurationBuilder jniBuilder)  : base(parentBuilder)
 {
     this.jniBuilder = jniBuilder;
 }
 internal AbstractConfigurationChildBuilder(ConfigurationBuilder parent) {
     this.parent = parent;
 }
 public void Before()
 {
     builder = new ConfigurationBuilder();
 }
Exemplo n.º 11
0
        public void SNIUntrustedTest()
        {
            ConfigurationBuilder conf = new ConfigurationBuilder();
            conf.AddServer().Host("127.0.0.1").Port(11222).ConnectionTimeout(90000).SocketTimeout(900);
            conf.Marshaller(new JBasicMarshaller());
            registerServerCAFile(conf, "malicious.pem", "sni3-untrusted");

            RemoteCacheManager remoteManager = new RemoteCacheManager(conf.Build(), true);
            IRemoteCache<string, string> testCache = remoteManager.GetCache<string, string>();

            testCache.Clear();
            string k1 = "key13";
            string v1 = "boron";
            testCache.Put(k1, v1);
            Assert.Fail("Should not get here");
        }
Exemplo n.º 12
0
 void registerServerCAFile(ConfigurationBuilder conf, string filename = "", string sni = "")
 {
     SslConfigurationBuilder sslConfB = conf.Ssl();
     if (filename != "")
     {
         checkFileExists(filename);
         sslConfB.Enable().ServerCAFile(filename);
         if (sni != "")
         {
             sslConfB.SniHostName(sni);
         }
     }
 }