public void GetNavigationHierarchyTwoLocations()
        {
            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            configuration.AddLocation(module, "Plant.Area.Production");
            configuration.AddLocation(module, "Plant.Area.Equipment.Production");

            SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(
                database,
                configuration,
                new SimpleSecurityWebServiceClient("User"));

            GetNavigationHierarchyResponse response = webServiceClient.GetNavigationHierarchy(
                new GetNavigationHierarchyRequest
            {
                Module      = AmplaModules.Production,
                Credentials = CreateCredentials()
            });

            Assert.That(response, Is.Not.Null);
            Assert.That(response.Hierarchy, Is.Not.Null);
            CheckViewPoints(response.Hierarchy.ViewPoints, "", "Plant");
            CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints, "Plant", "Area");
            CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints, "Plant.Area", "Equipment");

            CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ReportingPoints, "Plant.Area", "Production");
            CheckViewPoints(response.Hierarchy.ViewPoints[0].ViewPoints[0].ViewPoints[0].ReportingPoints, "Plant.Area.Equipment", "Production");
        }
        public void GetData_ResolveIdentifiers_True()
        {
            InMemoryRecord record = DowntimeRecords.NewRecord().MarkAsNew();

            record.SetFieldIdValue("Cause", "Shutdown", 100);
            record.SetFieldIdValue("Classification", "Unplanned Process", 200);

            database.EnableModule("Downtime");

            configuration.EnableModule("Downtime");
            configuration.AddLocation("Downtime", "Enterprise.Site.Area.Downtime");
            SimpleDataWebServiceClient webServiceClient = new SimpleDataWebServiceClient(database, configuration, new SimpleSecurityWebServiceClient("User"));

            record.SaveTo(webServiceClient);

            List <InMemoryRecord> records = new List <InMemoryRecord>(database.GetModuleRecords("Downtime").Values);

            Assert.That(records, Is.Not.Empty);

            string recordId = Convert.ToString(records[0].RecordId);

            GetDataRequest request = new GetDataRequest
            {
                Credentials = CreateCredentials(),
                Filter      = new DataFilter {
                    Location = record.Location, Criteria = new [] { new FilterEntry {
                                                                        Name = "Id", Value = recordId
                                                                    } }
                },
                View = new GetDataView {
                    Context = NavigationContext.Plant, Mode = NavigationMode.Location, Module = AmplaModules.Downtime
                },
                Metadata      = true,
                OutputOptions = new GetDataOutputOptions {
                    ResolveIdentifiers = true
                }
            };
            GetDataResponse response = webServiceClient.GetData(request);

            AssertResponseContainsValue(response, "Cause", "Shutdown");
            AssertResponseContainsValue(response, "Classification", "Unplanned Process");
        }
        protected override void OnSetUp()
        {
            base.OnSetUp();
            database = new SimpleAmplaDatabase();
            database.EnableModule(module);

            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            configuration.AddLocation(module, location);
            configuration.SetDefaultView("Production", ProductionViews.StandardView());
        }
Esempio n. 4
0
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            SimpleSecurityWebServiceClient securityClient = new SimpleSecurityWebServiceClient("User");
            SimpleAmplaDatabase            amplaDatabase  = new SimpleAmplaDatabase();

            amplaDatabase.EnableModule("Production");
            amplaDatabase.EnableModule("Quality");
            amplaDatabase.EnableModule("Downtime");

            SimpleAmplaConfiguration configuration = new SimpleAmplaConfiguration();

            configuration.EnableModule("Production");
            configuration.AddLocation("Production", "Enterprise.Site.Area.Production");
            configuration.SetDefaultView("Production", QualityViews.StandardViewPlus(
                                             StandardViews.Field <double>("Weight"),
                                             StandardViews.Field <string>("Material", "Material", false, true)
                                             ));

            configuration.EnableModule("Quality");
            configuration.AddLocation("Quality", "Enterprise.Site.Area.Quality");
            configuration.SetDefaultView("Quality", QualityViews.StandardViewPlus(
                                             StandardViews.Field <double>("Moisture"),
                                             StandardViews.Field <string>("SampleId", "SampleId", false, true),
                                             StandardViews.Field <double>("Silica", "Silica", false, true),
                                             StandardViews.Field <double>("Sodium", "Sodium", false, true)
                                             ));

            configuration.EnableModule("Downtime");
            configuration.AddLocation("Downtime", "Enterprise.Site.Area.Downtime");
            configuration.SetDefaultView("Downtime", DowntimeViews.StandardView());

            builder.RegisterInstance(amplaDatabase).As <IAmplaDatabase>().SingleInstance();
            builder.RegisterInstance(configuration).As <IAmplaConfiguration>().SingleInstance();

            builder.RegisterInstance(securityClient).As <ISecurityWebServiceClient>().SingleInstance();
            builder.RegisterInstance(securityClient).SingleInstance();

            builder.RegisterType <SimpleDataWebServiceClient>().As <IDataWebServiceClient>();
        }
        protected override void OnSetUp()
        {
            base.OnSetUp();
            database = new SimpleAmplaDatabase();
            database.EnableModule(module);

            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            configuration.AddLocation(module, location);
            configuration.SetDefaultView(module, ProductionViews.AreaValueModelView());

            webServiceClient = new SimpleDataWebServiceClient(database, configuration, new SimpleSecurityWebServiceClient("User"));
            repository       = new AmplaReadOnlyRepository <AreaValueModel>(new AmplaRepository <AreaValueModel>(webServiceClient, credentialsProvider));
        }
        protected override void OnSetUp()
        {
            base.OnSetUp();
            database = new SimpleAmplaDatabase();
            database.EnableModule(module);
            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            foreach (string location in locations)
            {
                configuration.AddLocation(module, location);
            }

            configuration.SetDefaultView(module, getViewFunc());

            webServiceClient = new SimpleDataWebServiceClient(database, configuration, new SimpleSecurityWebServiceClient("User"));
            listLogger       = new ListLogger();
            repository       = new AmplaRepository <TModel>(new LoggingDataWebServiceClient(webServiceClient, listLogger),
                                                            CredentialsProvider.ForUsernameAndPassword(userName, password));
        }
Esempio n. 7
0
        protected override void OnSetUp()
        {
            base.OnSetUp();

            database = new SimpleAmplaDatabase();
            database.EnableModule(module);
            configuration = new SimpleAmplaConfiguration();
            configuration.EnableModule(module);
            configuration.AddLocation(module, location);
            configuration.SetDefaultView(module, ProductionViews.StandardView());

            SimpleSecurityWebServiceClient securityWebService = new SimpleSecurityWebServiceClient("User");

            webServiceClient = new SimpleDataWebServiceClient(database, configuration, securityWebService);

            DataWebServiceFactory.Factory = () => webServiceClient;

            dynamicViewPoint = new DynamicViewPoint(location, module);
        }