private ModelToViewsTuple[] InitModelViewRelation()
        {
            ModelToViewsTuple[]         modelsToViews = new ModelToViewsTuple[1];
            Dictionary <String, String> descriptions  = new Dictionary <String, String>();

            descriptions.Add("en", "This view opens the values in a SQLViewer.");
            descriptions.Add("de", "Dieses Tool öffnet die Werte in einem SQLViewer.");
            OpenEngSBCore.XLinkConnectorView[] views = new OpenEngSBCore.XLinkConnectorView[1];
            views[0] = new OpenEngSBCore.XLinkConnectorView()
            {
                name         = "SQLView",
                viewId       = "SQL Viewer",
                descriptions = descriptions.ConvertMap <OpenEngSBCore.string2stringMapEntry>()
            };
            modelsToViews[0] =
                new ModelToViewsTuple()
            {
                description = new ModelDescription()
                {
                    modelClassName = "org.openengsb.domain.SQLCode.model.SQLCreate", versionString = "3.0.0.SNAPSHOT"
                },
                views = views
            };
            return(modelsToViews);
        }
        /// <summary>
        /// Creates the Array of Model/View relations, offered by the Tool, for XLink
        /// </summary>
        private ModelToViewsTuple[] initModelViewRelation()
        {
            ModelToViewsTuple[] modelsToViews
                = new ModelToViewsTuple[1];
            Dictionary <String, String> descriptions = new Dictionary <String, String>();

            descriptions.Add("en", "This view opens the values in a C# SourceCode viewer.");
            descriptions.Add("de", "Dieses Tool öffnet die Werte in einem C# SourceCode viewer.");

            OpenEngSBCore.XLinkConnectorView[] views = new OpenEngSBCore.XLinkConnectorView[1];
            views[0]         = (new OpenEngSBCore.XLinkConnectorView()
            {
                name = "C# SourceCode View", viewId = Program.viewId, descriptions = descriptions.ConvertMap <entry3>()
            });
            modelsToViews[0] =
                new ModelToViewsTuple()
            {
                description = new ModelDescription()
                {
                    modelClassName = classNameOfOpenEngSBModel, versionString = "3.0.0.SNAPSHOT"
                },
                views = views
            };
            return(modelsToViews);
        }
Beispiel #3
0
        public void TestConvertXLinkConnectorViewTypesFromDiffrentDlls()
        {
            // Convert between OOSourceCodeDomain.XLinkConnectorView and OpenEngSBCore.XLinkConnectorView
            OOSourceCodeDomain.XLinkConnectorView oosxlink = new OOSourceCodeDomain.XLinkConnectorView();
            oosxlink.name   = "TestCase";
            oosxlink.viewId = "TestViewId";
            OpenEngSBCore.XLinkConnectorView openEngSBCOre = oosxlink.ConvertOSBType <OpenEngSBCore.XLinkConnectorView>();

            Assert.AreEqual <String>(oosxlink.name, openEngSBCOre.name);
            Assert.AreEqual <String>(oosxlink.viewId, openEngSBCOre.viewId);
        }
 /// <summary>
 /// Returns the XLinkConnectorView entry to the given XLinkConnector and viewId or null
 /// </summary>
 private OpenEngSBCore.XLinkConnectorView findViewToCurrentlyInstalledTool(OpenEngSBCore.XLinkConnector otherLocalTool, string viewId)
 {
     OpenEngSBCore.XLinkConnectorView otherLocalView = null;
     for (int i = 0; i < otherLocalTool.availableViews.Length; i++)
     {
         if (otherLocalTool.availableViews[i].viewId.Equals(viewId))
         {
             otherLocalView = otherLocalTool.availableViews[i];
             break;
         }
     }
     return(otherLocalView);
 }
Beispiel #5
0
        public void TestConvertXLinkConnectorViewTypesFromDiffrentDllsAndAllValuesSet()
        {
            OOSourceCodeDomain.XLinkConnectorView oosxlink = new OOSourceCodeDomain.XLinkConnectorView();
            oosxlink.name   = "TestCase";
            oosxlink.viewId = "TestViewId";
            OOSourceCodeDomain.string2stringMapEntry[] entry = new OOSourceCodeDomain.string2stringMapEntry[1];
            entry[0]              = new OOSourceCodeDomain.string2stringMapEntry();
            entry[0].key          = "key";
            entry[0].value        = "value";
            oosxlink.descriptions = entry;
            OpenEngSBCore.XLinkConnectorView openEngSBCOre = oosxlink.ConvertOSBType <OpenEngSBCore.XLinkConnectorView>();

            Assert.AreEqual <String>(oosxlink.name, openEngSBCOre.name);
            Assert.AreEqual <String>(oosxlink.viewId, openEngSBCOre.viewId);
            Assert.AreEqual <String>(oosxlink.descriptions[0].key, entry[0].key);
            Assert.AreEqual <String>(oosxlink.descriptions[0].value, entry[0].value);
        }
        /// <summary>
        /// Triggers the local switching functionality for the given program, using the given viewId ontop of the defined file.
        /// </summary>
        public void triggerLocalSwitch(String programname, String viewId, String filename)
        {
            OpenEngSBCore.XLinkConnector otherLocalTool = findCurrentlyInstalledToolToName(programname);
            if (otherLocalTool == null)
            {
                outputLine("Supplied programname '" + programname + "' unknown.");
                return;
            }
            OpenEngSBCore.XLinkConnectorView otherLocalView = findViewToCurrentlyInstalledTool(otherLocalTool, viewId);

            if (otherLocalView == null)
            {
                outputLine("Supplied viewId '" + viewId + "' unknown to program '" + programname + "'.");
                return;
            }

            WorkingDirectoryFile searchedFile = Program.directoryBrowser.searchForFile(filename);

            if (searchedFile == null)
            {
                outputLine("Specified file was not found.");
                return;
            }
            else
            {
                String xlink = createXLink(searchedFile);
                // TODO remove Hack (hardcoded ConnectorIdKeyname) after correct implementation at OpenEngSB
                xlink += "&" + "connectorId=" + otherLocalTool.id + "&" + blueprint.keyNames.viewIdKeyName + "=" + HttpUtility.UrlEncode(viewId);
                WebRequest      webRequest = WebRequest.Create(xlink);
                HttpWebResponse response   = (HttpWebResponse)webRequest.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    outputLine("Local switch was triggered.");
                }
                else
                {
                    outputLine("Local switch was not successfull triggered, returned status code was " + (int)response.StatusCode);
                }
            }
        }
 private ModelToViewsTuple[] InitModelViewRelation()
 {
     ModelToViewsTuple[] modelsToViews = new ModelToViewsTuple[1];
     Dictionary<String, String> descriptions = new Dictionary<String, String>();
     descriptions.Add("en", "This view opens the values in a SQLViewer.");
     descriptions.Add("de", "Dieses Tool öffnet die Werte in einem SQLViewer.");
     OpenEngSBCore.XLinkConnectorView[] views = new OpenEngSBCore.XLinkConnectorView[1];
     views[0] = new OpenEngSBCore.XLinkConnectorView()
     {
         name = "SQLView",
         viewId = "SQL Viewer",
         descriptions = descriptions.ConvertMap<OpenEngSBCore.string2stringMapEntry>()
     };
     modelsToViews[0] =
         new ModelToViewsTuple()
     {
         description = new ModelDescription() { modelClassName = "org.openengsb.domain.SQLCode.model.SQLCreate", versionString = "3.0.0.SNAPSHOT" },
         views = views
     };
     return modelsToViews;
 }
        /// <summary>
        /// Creates the Array of Model/View relations, offered by the Tool, for XLink
        /// </summary>
        private ModelToViewsTuple[] initModelViewRelation()
        {
            ModelToViewsTuple[] modelsToViews
                = new ModelToViewsTuple[1];
            Dictionary<String, String> descriptions = new Dictionary<String, String>();
            descriptions.Add("en", "This view opens the values in a C# SourceCode viewer.");
            descriptions.Add("de", "Dieses Tool öffnet die Werte in einem C# SourceCode viewer.");

            OpenEngSBCore.XLinkConnectorView[] views = new OpenEngSBCore.XLinkConnectorView[1];
            views[0] = (new OpenEngSBCore.XLinkConnectorView() { name = "C# SourceCode View", viewId = Program.viewId, descriptions = descriptions.ConvertMap<entry3>() });
            modelsToViews[0] =
                    new ModelToViewsTuple()
                    {
                        description = new ModelDescription() { modelClassName = classNameOfOpenEngSBModel, versionString = "3.0.0.SNAPSHOT" },
                        views = views
                    };
            return modelsToViews;
        }