public async Task StartBinary()
        {
            MetaDataResponseDTO metadataForUploadedBinary = await UploadBinaryAlgoAndGetResponceDTO();

            string AlgoID = metadataForUploadedBinary.Id;

            DeployBinaryDTO algo = new DeployBinaryDTO()
            {
                AlgoId = AlgoID
            };

            string url = ApiPaths.ALGO_STORE_DEPLOY_BINARY;

            var uploadBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(algo), Method.POST);

            Assert.That(uploadBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryDTO startAlgo = new StartBinaryDTO
            {
                AlgoId = algo.AlgoId
            };

            url = ApiPaths.ALGO_STORE_ALGO_START;

            var startBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(startAlgo), Method.POST);

            Assert.That(startBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryResponseDTO startResponse = JsonUtils.DeserializeJson <StartBinaryResponseDTO>(startBinaryresponce.ResponseJson);

            Assert.That(startResponse.Status, Is.EqualTo("STARTED"));
        }
Ejemplo n.º 2
0
        public async Task DoubleStartBinary()
        {
            MetaDataResponseDTO temporaryResponseDTO = DataManager.getMetaDataForBinaryUpload();

            string url = ApiPaths.ALGO_STORE_UPLOAD_BINARY;

            string AlgoId = temporaryResponseDTO.Id;

            Dictionary <string, string> quaryParam = new Dictionary <string, string>()
            {
                { "AlgoId", AlgoId }
            };

            var responceAllClientMetadata = await this.Consumer.ExecuteRequestFileUpload(url, quaryParam, null, Method.POST, pathFile);

            Assert.That(responceAllClientMetadata.Status, Is.EqualTo(HttpStatusCode.NoContent));
            bool blobExists = await this.BlobRepository.CheckIfBlobExists(AlgoId, BinaryAlgoFileType.JAR);

            Assert.That(blobExists, Is.EqualTo(true));

            DeployBinaryDTO algo = new DeployBinaryDTO()
            {
                AlgoId = AlgoId
            };

            url = ApiPaths.ALGO_STORE_DEPLOY_BINARY;

            var uploadBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(algo), Method.POST);

            Assert.That(uploadBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            RuntimeDataEntity runtimeDataEntity = await RuntimeDataRepository.TryGetAsync(t => t.Id == AlgoId) as RuntimeDataEntity;

            Assert.NotNull(runtimeDataEntity);

            StartBinaryDTO startAlgo = new StartBinaryDTO
            {
                AlgoId = algo.AlgoId
            };

            url = ApiPaths.ALGO_STORE_ALGO_START;

            var startBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(startAlgo), Method.POST);

            Assert.That(startBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryResponseDTO startResponse = JsonUtils.DeserializeJson <StartBinaryResponseDTO>(startBinaryresponce.ResponseJson);

            Assert.That(startResponse.Status, Is.EqualTo("STARTED"));

            var startBinaryresponceSecondTime = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(startAlgo), Method.POST);

            Assert.That(startBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryResponseDTO startResponseSecondTime = JsonUtils.DeserializeJson <StartBinaryResponseDTO>(startBinaryresponce.ResponseJson);

            Assert.That(startResponse.Status, Is.EqualTo("STARTED"));
        }
        public async Task StartBinaryBadRequest(string badID)
        {
            StartBinaryDTO startAlgo = new StartBinaryDTO
            {
                AlgoId = badID
            };

            string url = ApiPaths.ALGO_STORE_ALGO_START;

            var startBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(startAlgo), Method.POST);

            Assert.That(startBinaryresponce.Status, Is.EqualTo(HttpStatusCode.BadRequest));
        }
        public async Task GetTailLog()
        {
            MetaDataResponseDTO metadataForUploadedBinary = await UploadBinaryAlgoAndGetResponceDTO();

            string AlgoID = metadataForUploadedBinary.Id;

            DeployBinaryDTO algo = new DeployBinaryDTO()
            {
                AlgoId = AlgoID
            };

            string url = ApiPaths.ALGO_STORE_DEPLOY_BINARY;

            var uploadBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(algo), Method.POST);

            Assert.That(uploadBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryDTO startAlgo = new StartBinaryDTO
            {
                AlgoId = algo.AlgoId
            };

            url = ApiPaths.ALGO_STORE_ALGO_START;

            var startBinaryresponce = await this.Consumer.ExecuteRequest(url, Helpers.EmptyDictionary, JsonUtils.SerializeObject(startAlgo), Method.POST);

            Assert.That(startBinaryresponce.Status, Is.EqualTo(HttpStatusCode.OK));

            StartBinaryResponseDTO startResponse = JsonUtils.DeserializeJson <StartBinaryResponseDTO>(startBinaryresponce.ResponseJson);

            Assert.That(startResponse.Status, Is.EqualTo("STARTED"));

            url = ApiPaths.ALGO_STORE_ALGO_TAIL_LOG;

            Dictionary <string, string> algoIDTailLog = new Dictionary <string, string>()
            {
                { "AlgoId", AlgoID },
                { "Tail", "60" }
            };

            var algoIDTailLogResponse = await this.Consumer.ExecuteRequest(url, algoIDTailLog, null, Method.GET);

            Assert.That(algoIDTailLogResponse.Status, Is.EqualTo(HttpStatusCode.OK));

            LogResponseDTO LogObject = JsonUtils.DeserializeJson <LogResponseDTO>(algoIDTailLogResponse.ResponseJson);

            Assert.NotNull(LogObject);
        }