Exemple #1
0
        public void TestServerVersionParsing()
        {
            var oldVersion = new RemoteServerVersion("Couchbase Sync Gateway/1.1.0");

            Assert.IsTrue(oldVersion.IsSyncGateway);
            Assert.AreEqual("Couchbase Sync Gateway", oldVersion.Name);
            Assert.AreEqual("1.1.0", oldVersion.Version);
            Assert.AreEqual(String.Empty, oldVersion.Branch);
            Assert.AreEqual(String.Empty, oldVersion.Commit);

            var nonSGVersion = new RemoteServerVersion("CouchDB/1.6.1");

            Assert.IsFalse(nonSGVersion.IsSyncGateway);
            Assert.AreEqual("CouchDB", nonSGVersion.Name);
            Assert.AreEqual("1.6.1", nonSGVersion.Version);
            Assert.AreEqual(String.Empty, nonSGVersion.Branch);
            Assert.AreEqual(String.Empty, nonSGVersion.Commit);

            var newVersion = new RemoteServerVersion("Couchbase Sync Gateway/1.2 branch/fix/server_header commit/5bfcf79");

            Assert.IsTrue(newVersion.IsSyncGateway);
            Assert.AreEqual("Couchbase Sync Gateway", newVersion.Name);
            Assert.AreEqual("1.2", newVersion.Version);
            Assert.AreEqual("fix/server_header", newVersion.Branch);
            Assert.AreEqual("5bfcf79", newVersion.Commit);
        }
        public void TestServerVersionParsing()
        {
            var oldVersion = new RemoteServerVersion("Couchbase Sync Gateway/1.1.0");
            Assert.IsTrue(oldVersion.IsSyncGateway);
            Assert.AreEqual("Couchbase Sync Gateway", oldVersion.Name);
            Assert.AreEqual("1.1.0", oldVersion.Version);
            Assert.AreEqual(String.Empty, oldVersion.Branch);
            Assert.AreEqual(String.Empty, oldVersion.Commit);

            var nonSGVersion = new RemoteServerVersion("CouchDB/1.6.1");
            Assert.IsFalse(nonSGVersion.IsSyncGateway);
            Assert.AreEqual("CouchDB", nonSGVersion.Name);
            Assert.AreEqual("1.6.1", nonSGVersion.Version);
            Assert.AreEqual(String.Empty, nonSGVersion.Branch);
            Assert.AreEqual(String.Empty, nonSGVersion.Commit);

            var newVersion = new RemoteServerVersion("Couchbase Sync Gateway/1.2 branch/fix/server_header commit/5bfcf79");
            Assert.IsTrue(newVersion.IsSyncGateway);
            Assert.AreEqual("Couchbase Sync Gateway", newVersion.Name);
            Assert.AreEqual("1.2", newVersion.Version);
            Assert.AreEqual("fix/server_header", newVersion.Branch);
            Assert.AreEqual("5bfcf79", newVersion.Commit);
        }
 private void UpdateServerType(HttpResponseMessage response)
 {
     var server = response.Headers.Server;
     if (server != null && server.Any()) {
         var serverString = String.Join(" ", server.Select(pi => pi.Product).Where(pi => pi != null).ToStringArray());
         ServerType = new RemoteServerVersion(serverString);
         Log.V(TAG, "Server Version: " + ServerType);
     }
 }