示例#1
0
        public void TestRetrieveRouteResponse()
        {
            string json = @"{
  ""metadata"": {
    ""guid"": ""b7ab8b0e-a008-4971-95c4-da617d61f08c"",
    ""url"": ""/v2/routes/b7ab8b0e-a008-4971-95c4-da617d61f08c"",
    ""created_at"": ""2016-02-09T10:21:52Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""host"": ""host-10"",
    ""domain_guid"": ""a79b96ff-e96a-4cd5-bb5e-bc71fa991333"",
    ""space_guid"": ""f23cc006-ea24-4965-b122-3188edff6a2d"",
    ""domain_url"": ""/v2/domains/a79b96ff-e96a-4cd5-bb5e-bc71fa991333"",
    ""space_url"": ""/v2/spaces/f23cc006-ea24-4965-b122-3188edff6a2d"",
    ""apps_url"": ""/v2/routes/b7ab8b0e-a008-4971-95c4-da617d61f08c/apps""
  }
}";

            RetrieveRouteResponse obj = Utilities.DeserializeJson <RetrieveRouteResponse>(json);

            Assert.AreEqual("b7ab8b0e-a008-4971-95c4-da617d61f08c", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
            Assert.AreEqual("/v2/routes/b7ab8b0e-a008-4971-95c4-da617d61f08c", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
            Assert.AreEqual("2016-02-09T10:21:52Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
            Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
            Assert.AreEqual("host-10", TestUtil.ToTestableString(obj.Host), true);
            Assert.AreEqual("a79b96ff-e96a-4cd5-bb5e-bc71fa991333", TestUtil.ToTestableString(obj.DomainGuid), true);
            Assert.AreEqual("f23cc006-ea24-4965-b122-3188edff6a2d", TestUtil.ToTestableString(obj.SpaceGuid), true);
            Assert.AreEqual("/v2/domains/a79b96ff-e96a-4cd5-bb5e-bc71fa991333", TestUtil.ToTestableString(obj.DomainUrl), true);
            Assert.AreEqual("/v2/spaces/f23cc006-ea24-4965-b122-3188edff6a2d", TestUtil.ToTestableString(obj.SpaceUrl), true);
            Assert.AreEqual("/v2/routes/b7ab8b0e-a008-4971-95c4-da617d61f08c/apps", TestUtil.ToTestableString(obj.AppsUrl), true);
        }
示例#2
0
        public void TestRetrieveRouteResponse()
        {
            string json = @"{
  ""metadata"": {
    ""guid"": ""86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e"",
    ""url"": ""/v2/routes/86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e"",
    ""created_at"": ""2015-04-16T12:04:14+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""host"": ""host-4"",
    ""domain_guid"": ""a6453e83-1512-42d1-9ba6-897415bd88a6"",
    ""space_guid"": ""2d03fb82-3b2a-4ef6-80c0-744bd8af44bb"",
    ""domain_url"": ""/v2/domains/a6453e83-1512-42d1-9ba6-897415bd88a6"",
    ""space_url"": ""/v2/spaces/2d03fb82-3b2a-4ef6-80c0-744bd8af44bb"",
    ""apps_url"": ""/v2/routes/86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e/apps""
  }
}";

            RetrieveRouteResponse obj = Utilities.DeserializeJson <RetrieveRouteResponse>(json);

            Assert.AreEqual("86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
            Assert.AreEqual("/v2/routes/86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
            Assert.AreEqual("2015-04-16T12:04:14+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
            Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
            Assert.AreEqual("host-4", TestUtil.ToTestableString(obj.Host), true);
            Assert.AreEqual("a6453e83-1512-42d1-9ba6-897415bd88a6", TestUtil.ToTestableString(obj.DomainGuid), true);
            Assert.AreEqual("2d03fb82-3b2a-4ef6-80c0-744bd8af44bb", TestUtil.ToTestableString(obj.SpaceGuid), true);
            Assert.AreEqual("/v2/domains/a6453e83-1512-42d1-9ba6-897415bd88a6", TestUtil.ToTestableString(obj.DomainUrl), true);
            Assert.AreEqual("/v2/spaces/2d03fb82-3b2a-4ef6-80c0-744bd8af44bb", TestUtil.ToTestableString(obj.SpaceUrl), true);
            Assert.AreEqual("/v2/routes/86e5f6a7-1ee8-401f-bd07-aadb1ed15a9e/apps", TestUtil.ToTestableString(obj.AppsUrl), true);
        }
示例#3
0
        public void Route_test()
        {
            CreateRouteResponse   newRoute      = null;
            UpdateRouteResponse   updatedRoute  = null;
            RetrieveRouteResponse retrieveRoute = null;

            CreateRouteRequest request = new CreateRouteRequest();

            request.DomainGuid = domainGuid;
            request.SpaceGuid  = spaceGuid;

            try
            {
                newRoute = client.Routes.CreateRoute(request).Result;
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while creating route: {0}", ex.ToString());
            }
            Assert.IsNotNull(newRoute);

            try
            {
                retrieveRoute = client.Routes.RetrieveRoute(newRoute.EntityMetadata.Guid).Result;
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while reading route: {0}", ex.ToString());
            }
            Assert.IsNotNull(retrieveRoute);

            UpdateRouteRequest updateR = new UpdateRouteRequest();

            updateR.Host = "newtestdomain";

            try
            {
                updatedRoute = client.Routes.UpdateRoute(newRoute.EntityMetadata.Guid, updateR).Result;
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while updating route: {0}", ex.ToString());
            }
            Assert.IsNotNull(updatedRoute);
            Assert.AreEqual(updateR.Host, updatedRoute.Host);

            try
            {
                client.Routes.DeleteRoute(newRoute.EntityMetadata.Guid).Wait();
            }
            catch (Exception ex)
            {
                Assert.Fail("Exception while deleting space: {0}", ex.ToString());
            }
        }
示例#4
0
        public void TestRetrieveRouteResponse()
        {
            string json = @"{
  ""metadata"": {
    ""guid"": ""cd04bd89-b17d-4b6c-bb30-6e6831026477"",
    ""url"": ""/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9"",
    ""created_at"": ""2016-09-02T11:52:13Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""host"": ""host-20"",
    ""path"": """",
    ""domain_guid"": ""cd04bd89-b17d-4b6c-bb30-6e6831026477"",
    ""space_guid"": ""cd04bd89-b17d-4b6c-bb30-6e6831026477"",
    ""service_instance_guid"": ""cd04bd89-b17d-4b6c-bb30-6e6831026477"",
    ""port"": null,
    ""domain_url"": ""/v2/shared_domains/03373c10-06d6-4372-a438-24b34d497390"",
    ""space_url"": ""/v2/spaces/6df99007-e725-49df-ad0e-ab6a9b974b29"",
    ""service_instance_url"": ""/v2/service_instances/f6920d25-c999-4345-a7d4-80e651764148"",
    ""apps_url"": ""/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9/apps"",
    ""route_mappings_url"": ""/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9/route_mappings""
  }
}";

            RetrieveRouteResponse obj = Utilities.DeserializeJson <RetrieveRouteResponse>(json);

            Assert.AreEqual("cd04bd89-b17d-4b6c-bb30-6e6831026477", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
            Assert.AreEqual("/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
            Assert.AreEqual("2016-09-02T11:52:13Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
            Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
            Assert.AreEqual("host-20", TestUtil.ToTestableString(obj.Host), true);
            Assert.AreEqual("", TestUtil.ToTestableString(obj.Path), true);
            Assert.AreEqual("cd04bd89-b17d-4b6c-bb30-6e6831026477", TestUtil.ToTestableString(obj.DomainGuid), true);
            Assert.AreEqual("cd04bd89-b17d-4b6c-bb30-6e6831026477", TestUtil.ToTestableString(obj.SpaceGuid), true);
            Assert.AreEqual("cd04bd89-b17d-4b6c-bb30-6e6831026477", TestUtil.ToTestableString(obj.ServiceInstanceGuid), true);
            Assert.AreEqual("", TestUtil.ToTestableString(obj.Port), true);
            Assert.AreEqual("/v2/shared_domains/03373c10-06d6-4372-a438-24b34d497390", TestUtil.ToTestableString(obj.DomainUrl), true);
            Assert.AreEqual("/v2/spaces/6df99007-e725-49df-ad0e-ab6a9b974b29", TestUtil.ToTestableString(obj.SpaceUrl), true);
            Assert.AreEqual("/v2/service_instances/f6920d25-c999-4345-a7d4-80e651764148", TestUtil.ToTestableString(obj.ServiceInstanceUrl), true);
            Assert.AreEqual("/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9/apps", TestUtil.ToTestableString(obj.AppsUrl), true);
            Assert.AreEqual("/v2/routes/b87af946-a48c-4f6d-85f9-3b2b6ae4eac9/route_mappings", TestUtil.ToTestableString(obj.RouteMappingsUrl), true);
        }