Exemple #1
0
        public void SetUp()
        {
            IRestServiceGrammar  restGrammar   = RestServiceGrammar.ItemWebApiV2Grammar();
            IWebApiUrlParameters webApiGrammar = WebApiUrlParameters.ItemWebApiV2UrlParameters();

            this.builderForId    = new ItemByIdUrlBuilder(restGrammar, webApiGrammar);
            this.builderForPath  = new ItemByPathUrlBuilder(restGrammar, webApiGrammar);
            this.builderForQuery = new ItemByQueryUrlBuilder(restGrammar, webApiGrammar);

            this.defaultSource = new ItemSourcePOD(null, null, null);

            SessionConfigPOD mutableSessionConfig = new SessionConfigPOD();

            mutableSessionConfig.ItemWebApiVersion = "v1";
            mutableSessionConfig.InstanceUrl       = "tumba.yumba";
            mutableSessionConfig.Site = null;
            this.sessionConfig        = mutableSessionConfig;


            mutableSessionConfig = new SessionConfigPOD();
            mutableSessionConfig.ItemWebApiVersion = "v234";
            mutableSessionConfig.InstanceUrl       = "trololo.net";
            mutableSessionConfig.Site = "/sitecore/shell";
            this.sitecoreShellConfig  = mutableSessionConfig;
        }
    public void TearDown()
    {
      this.builderForId = null;
      this.builderForPath = null;
      this.builderForQuery = null;

      this.sessionConfig = null;
      this.sitecoreShellConfig = null;
      this.defaultSource = null;
    }
Exemple #3
0
        public void TearDown()
        {
            this.builderForId    = null;
            this.builderForPath  = null;
            this.builderForQuery = null;

            this.sessionConfig       = null;
            this.sitecoreShellConfig = null;
            this.defaultSource       = null;
        }
        public async Task <ScItemsResponse> ReadItemAsync(IReadItemsByQueryRequest request, CancellationToken cancelToken = default(CancellationToken))
        {
            IReadItemsByQueryRequest requestCopy = request.DeepCopyGetItemByQueryRequest();

            using (ICredentialsHeadersCryptor cryptor = await this.GetCredentialsCryptorAsync(cancelToken))
            {
                IReadItemsByQueryRequest autocompletedRequest = this.requestMerger.FillReadItemByQueryGaps(requestCopy);

                var urlBuilder = new ItemByQueryUrlBuilder(this.restGrammar, this.webApiGrammar);
                var taskFlow   = new GetItemsByQueryTasks(urlBuilder, this.httpClient, cryptor);

                return(await RestApiCallFlow.LoadRequestFromNetworkFlow(autocompletedRequest, taskFlow, cancelToken));
            }
        }
    public void SetUp()
    {
      IRestServiceGrammar restGrammar = RestServiceGrammar.ItemWebApiV2Grammar();
      IWebApiUrlParameters webApiGrammar = WebApiUrlParameters.ItemWebApiV2UrlParameters();

      this.builder = new ItemByQueryUrlBuilder(restGrammar, webApiGrammar);

      SessionConfigPOD mutableSession = new SessionConfigPOD ();
      mutableSession.InstanceUrl = "http://mobiledev1ua1.dk.sitecore.net:722";
      mutableSession.ItemWebApiVersion = "v13";
      mutableSession.Site = null;
      this.sessionConfig = mutableSession;

      this.payload = new QueryParameters( PayloadType.Full, null, null );
    }
        public void TestOptionalSourceInSessionAndUserRequest()
        {
            var connection = new SessionConfig("localhost");

            var request       = ItemWebApiRequestBuilder.ReadItemsRequestWithSitecoreQuery("/sitecore/content/home/*").Build();
            var requestMerger = new UserRequestMerger(connection, null);
            var mergedRequest = requestMerger.FillReadItemByQueryGaps(request);

            var urlBuilder = new ItemByQueryUrlBuilder(RestServiceGrammar.ItemWebApiV2Grammar(), WebApiUrlParameters.ItemWebApiV2UrlParameters());

            string result   = urlBuilder.GetUrlForRequest(mergedRequest);
            string expected = "http://localhost/-/item/v1?query=%2fsitecore%2fcontent%2fhome%2f%2a";

            Assert.AreEqual(expected, result);
        }
        public void SetUp()
        {
            IRestServiceGrammar  restGrammar   = RestServiceGrammar.ItemWebApiV2Grammar();
            IWebApiUrlParameters webApiGrammar = WebApiUrlParameters.ItemWebApiV2UrlParameters();

            this.builder = new ItemByQueryUrlBuilder(restGrammar, webApiGrammar);

            SessionConfigPOD mutableSession = new SessionConfigPOD();

            mutableSession.InstanceUrl       = "http://mobiledev1ua1.dk.sitecore.net:722";
            mutableSession.ItemWebApiVersion = "v13";
            mutableSession.Site = null;
            this.sessionConfig  = mutableSession;

            this.payload = new QueryParameters(PayloadType.Full, null, null);
        }
        public void TestDatabaseAndExplicitLanguageAndPayload()
        {
            var connection = new SessionConfig("localhost");

            var request = ItemWebApiRequestBuilder.ReadItemsRequestWithSitecoreQuery("/sitecore/content/home/*")
                          .Language("da")
                          .Payload(PayloadType.Content)
                          .Build();
            var requestMerger = new UserRequestMerger(connection, null);
            var mergedRequest = requestMerger.FillReadItemByQueryGaps(request);

            var urlBuilder = new ItemByQueryUrlBuilder(RestServiceGrammar.ItemWebApiV2Grammar(), WebApiUrlParameters.ItemWebApiV2UrlParameters());

            string result   = urlBuilder.GetUrlForRequest(mergedRequest);
            string expected = "http://localhost/-/item/v1?language=da&payload=content&query=%2fsitecore%2fcontent%2fhome%2f%2a";

            Assert.AreEqual(expected, result);
        }
    public void SetUp()
    {
      IRestServiceGrammar restGrammar = RestServiceGrammar.ItemWebApiV2Grammar();
      IWebApiUrlParameters webApiGrammar = WebApiUrlParameters.ItemWebApiV2UrlParameters();

      this.builderForId = new ItemByIdUrlBuilder(restGrammar, webApiGrammar);
      this.builderForPath = new ItemByPathUrlBuilder(restGrammar, webApiGrammar);
      this.builderForQuery = new ItemByQueryUrlBuilder(restGrammar, webApiGrammar);

      this.defaultSource = new ItemSourcePOD(null, null, null);

      SessionConfigPOD mutableSessionConfig = new SessionConfigPOD();
      mutableSessionConfig.ItemWebApiVersion = "v1";
      mutableSessionConfig.InstanceUrl = "tumba.yumba";
      mutableSessionConfig.Site = null;
      this.sessionConfig = mutableSessionConfig;


      mutableSessionConfig = new SessionConfigPOD();
      mutableSessionConfig.ItemWebApiVersion = "v234";
      mutableSessionConfig.InstanceUrl = "trololo.net";
      mutableSessionConfig.Site = "/sitecore/shell";
      this.sitecoreShellConfig = mutableSessionConfig;
    }
    public async Task<ScItemsResponse> ReadItemAsync(IReadItemsByQueryRequest request, CancellationToken cancelToken = default(CancellationToken))
    {
      IReadItemsByQueryRequest requestCopy = request.DeepCopyGetItemByQueryRequest();

      using (ICredentialsHeadersCryptor cryptor = await this.GetCredentialsCryptorAsync(cancelToken))
      {
        IReadItemsByQueryRequest autocompletedRequest = this.requestMerger.FillReadItemByQueryGaps(requestCopy);

        var urlBuilder = new ItemByQueryUrlBuilder(this.restGrammar, this.webApiGrammar);
        var taskFlow = new GetItemsByQueryTasks(urlBuilder, this.httpClient, cryptor);

        return await RestApiCallFlow.LoadRequestFromNetworkFlow(autocompletedRequest, taskFlow, cancelToken);
      }
    }
 public void TearDown()
 {
   this.builder = null;
   this.sessionConfig = null;
   this.payload = null;
 }
    public void TestDatabaseAndExplicitLanguageAndPayload()
    {
      var connection = new SessionConfig("localhost");

      var request = ItemWebApiRequestBuilder.ReadItemsRequestWithSitecoreQuery("/sitecore/content/home/*")
        .Language("da")
        .Payload(PayloadType.Content)
        .Build();
      var requestMerger = new UserRequestMerger(connection, null);
      var mergedRequest = requestMerger.FillReadItemByQueryGaps(request);

      var urlBuilder = new ItemByQueryUrlBuilder(RestServiceGrammar.ItemWebApiV2Grammar(), WebApiUrlParameters.ItemWebApiV2UrlParameters());

      string result = urlBuilder.GetUrlForRequest(mergedRequest);
      string expected = "http://localhost/-/item/v1?language=da&payload=content&query=%2fsitecore%2fcontent%2fhome%2f%2a";

      Assert.AreEqual(expected, result);
    }
    public void TestOptionalSourceInSessionAndUserRequest()
    {
      var connection = new SessionConfig("localhost");

      var request = ItemWebApiRequestBuilder.ReadItemsRequestWithSitecoreQuery("/sitecore/content/home/*").Build();
      var requestMerger = new UserRequestMerger(connection, null);
      var mergedRequest = requestMerger.FillReadItemByQueryGaps(request);

      var urlBuilder = new ItemByQueryUrlBuilder(RestServiceGrammar.ItemWebApiV2Grammar(), WebApiUrlParameters.ItemWebApiV2UrlParameters());

      string result = urlBuilder.GetUrlForRequest(mergedRequest);
      string expected = "http://localhost/-/item/v1?query=%2fsitecore%2fcontent%2fhome%2f%2a";

      Assert.AreEqual(expected, result);
    }
 public void TearDown()
 {
     this.builder       = null;
     this.sessionConfig = null;
     this.payload       = null;
 }
Exemple #15
0
 public GetItemsByQueryTasks(ItemByQueryUrlBuilder urlBuilder, HttpClient httpClient, ICredentialsHeadersCryptor credentialsHeadersCryptor)
     : base(httpClient, credentialsHeadersCryptor)
 {
     this.urlBuilder = urlBuilder;
     this.Validate();
 }