Esempio n. 1
0
        public void GetLabelsWithOptionsTest()
        {
            bool unicode = false;

            string uri       = "localhost:6666";
            string user      = "******";
            string pass      = string.Empty;
            string ws_client = "admin_space";

            for (int i = 0; i < 2; i++) // run once for ascii, once for unicode
            {
                // TODO update test with Edge Server installation
                Process p4d    = Utilities.DeployP4TestServer(TestDir, 8, unicode);
                Server  server = new Server(new ServerAddress(uri));
                try
                {
                    Repository rep = new Repository(server);

                    using (Connection con = rep.Connection)
                    {
                        con.UserName    = user;
                        con.Client      = new Client();
                        con.Client.Name = ws_client;

                        bool connected = con.Connect(null);
                        Assert.IsTrue(connected);

                        Assert.AreEqual(con.Status, ConnectionStatus.Connected);

                        LabelsCmdOptions opts = new LabelsCmdOptions(LabelsCmdFlags.None,
                                                                     null, null, 50, null, null);
                        IList <Label> labels = rep.GetLabels(opts);
                        Assert.AreEqual("Created by admin.\n", labels[0].Description);

                        opts = new LabelsCmdOptions(LabelsCmdFlags.Unloaded,
                                                    null, null, 50, null, null);
                        labels = rep.GetLabels(opts);
                        Assert.IsNull(labels);

                        opts = new LabelsCmdOptions(LabelsCmdFlags.All,
                                                    null, null, 50, null, null);
                        labels = rep.GetLabels(opts);
                        Assert.AreEqual("Created by admin.\n", labels[0].Description);

                        opts = new LabelsCmdOptions(LabelsCmdFlags.None,
                                                    null, null, 50, null, "1666-master");
                        labels = rep.GetLabels(opts);
                        Assert.IsNull(labels);
                    }
                }
                finally
                {
                    Utilities.RemoveTestServer(p4d, TestDir);
                }
                unicode = !unicode;
            }
        }
Esempio n. 2
0
        public void GetLabelsPreServerIDTest()
        {
            bool unicode = false;

            string uri       = "localhost:6666";
            string user      = "******";
            string pass      = string.Empty;
            string ws_client = "admin_space";

            for (int i = 0; i < 2; i++) // run once for ascii, once for unicode
            {
                Process p4d    = Utilities.DeployP4TestServer(TestDir, 8, unicode);
                Server  server = new Server(new ServerAddress(uri));
                try
                {
                    Repository rep = new Repository(server);

                    using (Connection con = rep.Connection)
                    {
                        con.UserName    = user;
                        con.Client      = new Client();
                        con.Client.Name = ws_client;

                        bool connected = con.Connect(null);
                        Assert.IsTrue(connected);

                        Assert.AreEqual(con.Status, ConnectionStatus.Connected);

                        // tests to ensure old labels options work, prior
                        // to ServerID argument

                        Options opts = new Options(LabelsCmdFlags.None, null, null,
                                                   50, null);

                        IList <Label> labels = rep.GetLabels(opts);

                        Assert.IsNotNull(labels);
                        Assert.AreEqual(1, labels.Count);

                        LabelsCmdOptions opts2 = new LabelsCmdOptions(LabelsCmdFlags.None, null, null,
                                                                      50, null);

                        labels = rep.GetLabels(opts2);

                        Assert.IsNotNull(labels);
                        Assert.AreEqual(1, labels.Count);
                    }
                }
                finally
                {
                    Utilities.RemoveTestServer(p4d, TestDir);
                }
                unicode = !unicode;
            }
        }