summaryrefslogtreecommitdiffstats
path: root/cucumber-js-test-apis-ci/cucumber.js
blob: 0eb79d3ac5a2679dba01b91b9d967f7a5e3daa77 (plain)
1
2
3
module.exports = {
	"default" : "--require stepDefinitions -f summary -r ./features -f summary:report/summary.txt -f json:report/report.json --format-options '{\"colorsEnabled\": false}'"
};
t-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
/*
 * Copyright (c) 2018 AT&T Intellectual Property.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *
 */

import { Injectable, Inject } from '@angular/core';
import { Http, Response } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import {IAppConfigurtaion, ValidationConfiguration, Validations, Plugins, PluginsConfiguration} from "app/models";
import {IApi} from "app/models/app-config";
import {SdcConfigToken, ISdcConfig} from "../config/sdc-config.config";

@Injectable()
export class ConfigService {

    private baseUrl;
    public configuration: IAppConfigurtaion;
    public api:IApi;

    constructor(private http: Http, @Inject(SdcConfigToken) private sdcConfig:ISdcConfig) {
    	this.api = this.sdcConfig.api;
        this.baseUrl = this.api.root + this.sdcConfig.api.component_api_root;
    }

    loadValidationConfiguration(): Promise<ValidationConfiguration> {
        let url: string = this.sdcConfig.validationConfigPath;
        let promise: Promise<ValidationConfiguration> = this.http.get(url).map((res: Response) => res.json()).toPromise();
        promise.then((validationData: Validations) => {
            ValidationConfiguration.validation = validationData;
        }).catch((ex) => {
            console.error('Error loading validation.json configuration file, using fallback data', ex);

            let fallback:Validations = {
                "propertyValue": {
                    "max": 2500,
                    "min": 0
                },

                "validationPatterns": {
                    "string": "^[\\sa-zA-Z0-9+-]+$",
                    "comment": "^[\\sa-zA-Z0-9+-_\\{\\}\"]+$",
                    "integer": "^(([-+]?\\d+)|([-+]?0x[0-9a-fA-F]+))$"
                }
            };

            ValidationConfiguration.validation = fallback;

        });

        return promise;
    }

    loadPluginsConfiguration(): Promise<PluginsConfiguration> {
        let url:string = this.api.no_proxy_root + this.api.GET_plugins_configuration;
        let promise: Promise<any> = this.http.get(url).map((res: Response) => res.json()).toPromise();
        return new Promise<PluginsConfiguration>((resolve) => {
            promise.then((pluginsData: Plugins) => {
                PluginsConfiguration.plugins = pluginsData;
                resolve();
            }).catch((ex) => {
                console.error("Error loading plugins configuration from FE", ex);

                PluginsConfiguration.plugins = [] as Plugins;
                resolve();
            });
        });
    }

}