예제 #1
0
        public static void Scan(RunTimeConfiguration rc,
                                APConfigParameter AP1Config24GHz,
                                APConfigParameter AP1Config5GHz,
                                APConfigParameter AP2Config24GHz,
                                APConfigParameter AP2Config5GHz,
                                SCAN_TEST_OPTIONS ScanTestOptions
                                )
        {
            TraceProvider traceProvider = new TraceProvider("ScanDriver");

            using (UsingGroup g = new UsingGroup())
            {
                traceProvider.TraceInformation("Scanning Scenarios Configuration ");

                WhckScanning hckScanning = new WhckScanning(rc,
                                                            AP1Config24GHz,
                                                            AP1Config5GHz,
                                                            AP2Config24GHz,
                                                            AP2Config5GHz,
                                                            ScanTestOptions);

                g.Add(hckScanning);

                hckScanning.Scan();
            }
        }
예제 #2
0
        public WhckAssociation(RunTimeConfiguration RuntimeConfig,
                               APConfigParameter AP1Config24GHz,
                               APConfigParameter AP1Config5GHz,
                               APConfigParameter AP2Config24GHz,
                               APConfigParameter AP2Config5GHz,
                               ASSOC_TEST_OPTIONS AssocTestOptions)
        {
            if (RuntimeConfig == null)
            {
                throw new ArgumentNullException("RuntimeConfig");
            }
            m_TraceProvider = new WlanHckTestLogger("WhckAssociation");

            this.m_AssociationConfiguration = RuntimeConfig;
            this.m_AP1Config24GHz           = AP1Config24GHz;
            this.m_AP1Config5GHz            = AP1Config5GHz;
            this.m_AP2Config24GHz           = AP2Config24GHz;
            this.m_AP2Config5GHz            = AP2Config5GHz;
            this.m_AssocTestOptions         = AssocTestOptions;

            m_WlanApi = new Wlan();

            m_TestInterface = Helpers.GetWlanInterface(m_WlanApi);

            m_ApConfigClient = Helpers.ConnectToService(m_AssociationConfiguration.ServiceBackChannelAddress);

            m_Routers = Helpers.GetRouterCollection(m_ApConfigClient);
            this.m_DeviceSupports5GHz = RuntimeConfig.DeviceSupports5Ghz;
            m_PowerManager            = new PowerManager();
            m_bIsAccessPointSetup     = false;
        }
        public void SetUp()
        {
            _environment = Mock.Create <IEnvironment>();

            Mock.Arrange(() => _environment.GetEnvironmentVariable(Arg.IsAny <string>()))
            .Returns(null as string);

            _processStatic              = Mock.Create <IProcessStatic>();
            _httpRuntimeStatic          = Mock.Create <IHttpRuntimeStatic>();
            _configurationManagerStatic = new ConfigurationManagerStaticMock();
            _dnsStatic = Mock.Create <IDnsStatic>();
            _securityPoliciesConfiguration = new SecurityPoliciesConfiguration();

            _runTimeConfiguration = new RunTimeConfiguration();
            _serverConfig         = new ServerConfiguration();
            _localConfig          = new configuration();

            _localConfig.crossApplicationTracingEnabled = true;
            _localConfig.attributes.enabled             = true;
            _localConfig.spanEvents.enabled             = true;
            _localConfig.distributedTracing.enabled     = true;

            _configurationService = Mock.Create <IConfigurationService>();

            UpdateConfig();

            _configAutoResponder = new ConfigurationAutoResponder(_configuration);

            _transactionMetricNameMaker = Mock.Create <ITransactionMetricNameMaker>();
            _attribDefSvc = new AttributeDefinitionService((f) => new AttributeDefinitions(f));
            _transactionAttributeMaker = new TransactionAttributeMaker(_configurationService, _attribDefSvc);
        }
        public WhckRoaming(RunTimeConfiguration rc,
                           APConfigParameter AP1Config24GHz,
                           APConfigParameter AP1Config5GHz,
                           APConfigParameter AP2Config24GHz,
                           APConfigParameter AP2Config5GHz,
                           ROAM_TEST_OPTIONS RoamTestOptions)
        {
            if (rc == null)
            {
                throw new ArgumentNullException("rc");
            }
            traceProvider = new WlanHckTestLogger("WhckRoaming");

            this.RoamingConfiguration = rc;
            this.m_AP1Config24GHz     = AP1Config24GHz;
            this.m_AP1Config5GHz      = AP1Config5GHz;
            this.m_AP2Config24GHz     = AP2Config24GHz;
            this.m_AP2Config5GHz      = AP2Config5GHz;
            this.m_RoamTestOptions    = RoamTestOptions;

            Api = new Wlan();

            TestInterface = Helpers.GetWlanInterface(Api);
            AC            = Helpers.ConnectToService(RoamingConfiguration.ServiceBackChannelAddress);

            routers            = Helpers.GetRouterCollection(AC);
            AccessPointSetup   = false;
            DeviceSupports5Ghz = rc.DeviceSupports5Ghz;
        }
        public void SetUp()
        {
            _localConfig = new configuration();
            _localConfig.distributedTracing.enabled = true;
            _serverConfig  = new ServerConfiguration();
            _runTimeConfig = new RunTimeConfiguration();
            _defaultConfig = new TestableDefaultConfiguration(Mock.Create <IEnvironment>(), _localConfig, _serverConfig, _runTimeConfig,
                                                              new SecurityPoliciesConfiguration(), Mock.Create <IProcessStatic>(), Mock.Create <IHttpRuntimeStatic>(), Mock.Create <IConfigurationManagerStatic>(),
                                                              Mock.Create <IDnsStatic>());

            _transactionMetricNameMaker = Mock.Create <ITransactionMetricNameMaker>();
            Mock.Arrange(() => _transactionMetricNameMaker.GetTransactionMetricName(Arg.Matches <ITransactionName>(txName => txName.IsWeb)))
            .Returns(new TransactionMetricName("WebTransaction", "TransactionName"));
            Mock.Arrange(() => _transactionMetricNameMaker.GetTransactionMetricName(Arg.Matches <ITransactionName>(txName => !txName.IsWeb))).Returns(new TransactionMetricName("OtherTransaction", "TransactionName"));

            _transactionSegmentState = Mock.Create <ITransactionSegmentState>();
            Mock.Arrange(() => _transactionSegmentState.GetRelativeTime()).Returns(() => TimeSpan.Zero);
            Mock.Arrange(() => _transactionSegmentState.AttribDefs).Returns(() => new AttributeDefinitions(new AttributeFilter(new AttributeFilter.Settings())));

            _segmentTreeMaker = Mock.Create <ISegmentTreeMaker>();

            _metricNameService = Mock.Create <IMetricNameService>();

            _metricBuilder    = Mock.Create <IMetricBuilder>();
            _metricAggregator = Mock.Create <IMetricAggregator>();

            _configurationService = Mock.Create <IConfigurationService>();
            Mock.Arrange(() => _configurationService.Configuration).Returns(_defaultConfig);

            _transactionTraceAggregator = Mock.Create <ITransactionTraceAggregator>();
            _transactionTraceMaker      = Mock.Create <ITransactionTraceMaker>();
            _transactionEventAggregator = Mock.Create <ITransactionEventAggregator>();
            _transactionEventMaker      = Mock.Create <ITransactionEventMaker>();
            _transactionAttributeMaker  = Mock.Create <ITransactionAttributeMaker>();
            _errorTraceAggregator       = Mock.Create <IErrorTraceAggregator>();
            _errorTraceMaker            = Mock.Create <IErrorTraceMaker>();
            _errorEventAggregator       = Mock.Create <IErrorEventAggregator>();
            _errorEventMaker            = Mock.Create <IErrorEventMaker>();
            _sqlTraceAggregator         = Mock.Create <ISqlTraceAggregator>();
            _sqlTraceMaker = Mock.Create <ISqlTraceMaker>();

            _spanEventAggregator = Mock.Create <ISpanEventAggregator>();
            Mock.Arrange(() => _spanEventAggregator.IsServiceEnabled).Returns(() => _defaultConfig != null && _defaultConfig.SpanEventsEnabled && _defaultConfig.SpanEventsMaxSamplesStored > 0 && _defaultConfig.DistributedTracingEnabled);
            Mock.Arrange(() => _spanEventAggregator.IsServiceAvailable).Returns(() => _defaultConfig != null && _defaultConfig.SpanEventsEnabled && _defaultConfig.SpanEventsMaxSamplesStored > 0 && _defaultConfig.DistributedTracingEnabled);

            _spanEventAggregatorInfiniteTracing = Mock.Create <ISpanEventAggregatorInfiniteTracing>();
            Mock.Arrange(() => _spanEventAggregatorInfiniteTracing.IsServiceEnabled).Returns(() => !string.IsNullOrWhiteSpace(_defaultConfig?.InfiniteTracingTraceObserverHost));
            Mock.Arrange(() => _spanEventAggregatorInfiniteTracing.IsServiceAvailable).Returns(() => !string.IsNullOrWhiteSpace(_defaultConfig?.InfiniteTracingTraceObserverHost));

            _spanEventMaker        = Mock.Create <ISpanEventMaker>();
            _customEventAggregator = Mock.Create <ICustomEventAggregator>();
            _errorService          = Mock.Create <IErrorService>();

            _attribDefSvc = new AttributeDefinitionService((f) => new AttributeDefinitions(f));

            _agentTimerService      = Mock.Create <IAgentTimerService>();
            _transactionTransformer = new TransactionTransformer(_transactionMetricNameMaker, _segmentTreeMaker, _metricNameService, _metricAggregator, _configurationService, _transactionTraceAggregator, _transactionTraceMaker, _transactionEventAggregator, _transactionEventMaker, _transactionAttributeMaker, _errorTraceAggregator, _errorTraceMaker, _errorEventAggregator, _errorEventMaker, _sqlTraceAggregator, _sqlTraceMaker, _spanEventAggregator, _spanEventMaker, _agentTimerService, Mock.Create <IAdaptiveSampler>(), _errorService, _spanEventAggregatorInfiniteTracing);
            _customEventTransformer = new CustomEventTransformer(_configurationService, _customEventAggregator, _attribDefSvc);
        }
예제 #6
0
        public void SetUp()
        {
            _environment                = Mock.Create <IEnvironment>();
            _processStatic              = Mock.Create <IProcessStatic>();
            _httpRuntimeStatic          = Mock.Create <IHttpRuntimeStatic>();
            _configurationManagerStatic = Mock.Create <IConfigurationManagerStatic>();
            _dnsStatic = Mock.Create <IDnsStatic>();
            _securityPoliciesConfiguration = new SecurityPoliciesConfiguration();

            _runTimeConfiguration = new RunTimeConfiguration();
            _serverConfig         = new ServerConfiguration();

            SetLocalConfigurationDefaults();
            PublishConfig();

            _configAutoResponder = new ConfigurationAutoResponder(_config);

            _configurationService = Mock.Create <IConfigurationService>();
            Mock.Arrange(() => _configurationService.Configuration).Returns(() => _config);

            _attribDefSvc = new AttributeDefinitionService((f) => new AttributeDefinitions(f));

            _metricNameSvc = new MetricNameService();
            _transactionMetricNameMaker = new TransactionMetricNameMaker(_metricNameSvc);

            _transactionAttribMaker = new TransactionAttributeMaker(_configurationService, _attribDefSvc);

            _spanEventMaker  = new SpanEventMaker(_attribDefSvc, _configurationService);
            _databaseService = new DatabaseService(Mock.Create <ICacheStatsReporter>());

            _transactionEventMaker = new TransactionEventMaker(_attribDefSvc);


            _transactionGuid = GuidGenerator.GenerateNewRelicGuid();
            _startTime       = new DateTime(2018, 7, 18, 7, 0, 0, DateTimeKind.Utc); // unixtime = 1531897200000

            // Generic Segments
            _baseGenericSegment = new Segment(CreateTransactionSegmentState(3, null, 777), new MethodCallData(MethodCallType, MethodCallMethod, 1));
            _baseGenericSegment.SetSegmentData(new SimpleSegmentData(SegmentName));

            _childGenericSegment = new Segment(CreateTransactionSegmentState(4, 3, 777), new MethodCallData(MethodCallType, MethodCallMethod, 1));
            _childGenericSegment.SetSegmentData(new SimpleSegmentData(SegmentName));

            // Datastore Segments
            _connectionInfo       = new ConnectionInfo("localhost", "1234", "default", "maininstance");
            _parsedSqlStatement   = SqlParser.GetParsedDatabaseStatement(DatastoreVendor.MSSQL, System.Data.CommandType.Text, ShortQuery);
            _obfuscatedSql        = _databaseService.GetObfuscatedSql(ShortQuery, DatastoreVendor.MSSQL);
            _baseDatastoreSegment = new Segment(CreateTransactionSegmentState(3, null, 777), new MethodCallData(MethodCallType, MethodCallMethod, 1));
            _baseDatastoreSegment.SetSegmentData(new DatastoreSegmentData(_databaseService, _parsedSqlStatement, ShortQuery, _connectionInfo));

            // Http Segments
            _baseHttpSegment = new Segment(CreateTransactionSegmentState(3, null, 777), new MethodCallData(MethodCallType, MethodCallMethod, 1));
            _baseHttpSegment.SetSegmentData(new ExternalSegmentData(new Uri(HttpUri), HttpMethod));
        }
 public void Setup()
 {
     _environment                   = Mock.Create <IEnvironment>();
     _processStatic                 = Mock.Create <IProcessStatic>();
     _httpRuntimeStatic             = Mock.Create <IHttpRuntimeStatic>();
     _configurationManagerStatic    = Mock.Create <IConfigurationManagerStatic>();
     _localConfig                   = new configuration();
     _serverConfig                  = new ServerConfiguration();
     _runTimeConfig                 = new RunTimeConfiguration();
     _securityPoliciesConfiguration = new SecurityPoliciesConfiguration();
     _dnsStatic     = Mock.Create <IDnsStatic>();
     _defaultConfig = new TestDefaultConfiguration(_environment, _localConfig, _serverConfig, _runTimeConfig, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
 }
        private void SetUp(TestCase testCase)
        {
            _environment = Mock.Create <IEnvironment>();

            Mock.Arrange(() => _environment.GetEnvironmentVariable(Arg.IsAny <string>()))
            .Returns(null as string);

            _processStatic              = Mock.Create <IProcessStatic>();
            _httpRuntimeStatic          = Mock.Create <IHttpRuntimeStatic>();
            _configurationManagerStatic = new ConfigurationManagerStaticMock();
            _dnsStatic = Mock.Create <IDnsStatic>();
            _securityPoliciesConfiguration = new SecurityPoliciesConfiguration();

            _runTimeConfiguration = new RunTimeConfiguration();
            _serverConfig         = new ServerConfiguration();
            _localConfig          = new configuration();


            _localConfig.crossApplicationTracingEnabled = true;
            _localConfig.attributes.enabled             = true;
            _localConfig.service.licenseKey             = testCase.LicenseKey;
            _localConfig.appSettings.Add(new configurationAdd()
            {
                key = "NewRelic.LicenseKey", value = testCase.LicenseKey
            });
            _serverConfig.RumSettingsJavaScriptAgentLoader = "JSAGENT";
            _serverConfig.RumSettingsJavaScriptAgentFile   = testCase.ConnectReply.JsAgentFile;
            _serverConfig.RumSettingsBeacon = testCase.ConnectReply.Beacon;

            _serverConfig.RumSettingsErrorBeacon              = testCase.ConnectReply.ErrorBeacon;
            _serverConfig.RumSettingsBrowserKey               = testCase.ConnectReply.BrowserKey;
            _serverConfig.RumSettingsApplicationId            = testCase.ConnectReply.ApplicationId;
            _localConfig.browserMonitoring.attributes.enabled = testCase.BrowserMonitoringAttributesEnabled;

            _configuration        = new TestableDefaultConfiguration(_environment, _localConfig, _serverConfig, _runTimeConfiguration, _securityPoliciesConfiguration, _processStatic, _httpRuntimeStatic, _configurationManagerStatic, _dnsStatic);
            _configurationService = Mock.Create <IConfigurationService>();
            Mock.Arrange(() => _configurationService.Configuration).Returns(_configuration);

            _configAutoResponder = new ConfigurationAutoResponder(_configuration);

            _transactionMetricNameMaker = Mock.Create <ITransactionMetricNameMaker>();
            _attribDefSvc = new AttributeDefinitionService((f) => new AttributeDefinitions(f));
            _transactionAttributeMaker    = new TransactionAttributeMaker(_configurationService, _attribDefSvc);
            _browserMonitoringScriptMaker = new BrowserMonitoringScriptMaker(_configurationService, _transactionMetricNameMaker, _transactionAttributeMaker, _attribDefSvc);
        }
예제 #9
0
        public static void Associate(RunTimeConfiguration rc,
                                     APConfigParameter AP1Config24GHz,
                                     APConfigParameter AP1Config5GHz,
                                     APConfigParameter AP2Config24GHz,
                                     APConfigParameter AP2Config5GHz,
                                     ASSOC_TEST_OPTIONS AssocTestOptions)
        {
            WlanHckTestLogger traceProvider = new WlanHckTestLogger("Associate Driver");

            using (UsingGroup g = new UsingGroup())
            {
                try
                {
                    traceProvider.LogComment("Association Scenarios Begin");

                    WhckAssociation hckAssociation = new WhckAssociation(rc,
                                                                         AP1Config24GHz,
                                                                         AP1Config5GHz,
                                                                         AP2Config24GHz,
                                                                         AP2Config5GHz,
                                                                         AssocTestOptions);

                    g.Add(hckAssociation);

                    //Basic Association AP1 2.4GHz -> AP2 5 GHz (2.4 GHz if 5 not supported), no sleep
                    hckAssociation.BasicAssociationTest();

                    //If requested perform advanced association tests
                    if (AssocTestOptions.HasFlag(ASSOC_TEST_OPTIONS.Sleep) || AssocTestOptions.HasFlag(ASSOC_TEST_OPTIONS.Hibernate))
                    {
                        hckAssociation.AdvancedAssociationTests();
                    }
                }
                catch (Exception e)
                {
                    traceProvider.LogError("Error - " + e.Message);
                    throw;
                }
                finally
                {
                    traceProvider.Flush();
                }
            }
        }
예제 #10
0
        public WhckScanning(RunTimeConfiguration rc,
                            APConfigParameter AP1Config24GHz,
                            APConfigParameter AP1Config5GHz,
                            APConfigParameter AP2Config24GHz,
                            APConfigParameter AP2Config5GHz,
                            SCAN_TEST_OPTIONS ScanTestOptions)
        {
            if (rc == null)
            {
                throw new ArgumentNullException("rc");
            }
            traceProvider = new TraceProvider("WhckScanning");
            this.ScanningConfiguration = rc;
            this.m_AP1Config24GHz      = AP1Config24GHz;
            this.m_AP1Config5GHz       = AP1Config5GHz;
            this.m_AP2Config24GHz      = AP2Config24GHz;
            this.m_AP2Config5GHz       = AP2Config5GHz;
            this.m_ScanTestOptions     = ScanTestOptions;

            Api = new Wlan();


            TestInterface = Helpers.GetWlanInterface(Api);
            AC            = null;
            AC            = Helpers.ConnectToService(ScanningConfiguration.ServiceBackChannelAddress);


            if (AC == null)
            {
                Log("Helpers.ConnectToService failed");
                AC = null;
                throw new Exception("Helpers.ConnectToService failed");
            }

            routers = Helpers.GetRouterCollection(AC);

            AccessPointSetup = false;
        }
예제 #11
0
 public static void ClassSetup(TestContext context)
 {
     sConfig = new RunTimeConfiguration(context);
 }
 public TestDefaultConfiguration(IEnvironment environment, configuration localConfig, ServerConfiguration serverConfig, RunTimeConfiguration runTimeConfiguration, SecurityPoliciesConfiguration _securityPoliciesConfiguration, IProcessStatic processStatic, IHttpRuntimeStatic httpRuntimeStatic, IConfigurationManagerStatic configurationManagerStatic, IDnsStatic dnsStatic) : base(environment, localConfig, serverConfig, runTimeConfiguration, _securityPoliciesConfiguration, processStatic, httpRuntimeStatic, configurationManagerStatic, dnsStatic)
 {
 }
        public static void Roam(RunTimeConfiguration rc,
                                APConfigParameter AP1Config24GHz,
                                APConfigParameter AP1Config5GHz,
                                APConfigParameter AP2Config24GHz,
                                APConfigParameter AP2Config5GHz,
                                ROAM_TEST_OPTIONS RoamTestOptions)
        {
            WlanHckTestLogger traceProvider = new WlanHckTestLogger("RoamingDriver");

            using (UsingGroup g = new UsingGroup())
            {
                traceProvider.LogComment("Roaming Scenarios Begin");

                try
                {
                    WhckRoaming hckRoaming = new WhckRoaming(rc,
                                                             AP1Config24GHz,
                                                             AP1Config5GHz,
                                                             AP2Config24GHz,
                                                             AP2Config5GHz,
                                                             RoamTestOptions);

                    g.Add(hckRoaming);


                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.SuddenLossOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.SuddenLossOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing sudden loss of Signal");
                        hckRoaming.SuddenLossOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.SuddenDropOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.SuddenDropOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing sudden drop of Signal");
                        hckRoaming.SuddenDropOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.GradualDropOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.GradualDropOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing gradual drop of Signal");
                        hckRoaming.GradualDropOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }

                    if (RoamTestOptions.HasFlag(ROAM_TEST_OPTIONS.GradualLossOfSignal))
                    {
                        string scenarioName = "Roaming " + ROAM_TEST_OPTIONS.GradualLossOfSignal.ToString();
                        Helpers.LogVariationStart(scenarioName, scenarioName);

                        traceProvider.LogComment("Testing gradual loss of Signal");
                        hckRoaming.GradualLossOfSignal();
                        Helpers.LogVariationStop(scenarioName);
                    }
                }
                catch (Exception e)
                {
                    traceProvider.LogError("Error - " + e.Message);
                    throw;
                }
            }
        }