public PluginService()
 {
     ResourceID = Guid.Empty;
     ResourceType = Common.Interfaces.Data.ResourceType.PluginService;
     Source = new PluginSource();
     Recordsets = new RecordsetList();
     Method = new ServiceMethod();
 }
Beispiel #2
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = ResourceType.PluginService;
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
Beispiel #3
0
 public PluginService()
 {
     ResourceID = Guid.Empty;
     ResourceType = ResourceType.PluginService;
     Source = new PluginSource();
     Recordsets = new RecordsetList();
     Method = new ServiceMethod();
 }
Beispiel #4
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = Common.Interfaces.Data.ResourceType.PluginService;
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     Method       = new ServiceMethod();
 }
 public void PluginSourceContructorWithInvalidXmlExpectedDoesNotThrowExceptionAndInitializesProperties()
 {
     var xml = new XElement("root");
     var source = new PluginSource(xml);
     Assert.AreNotEqual(Guid.Empty, source.ResourceID);
     Assert.IsTrue(source.IsUpgraded);
     Assert.AreEqual(ResourceType.PluginSource, source.ResourceType);
 }
Beispiel #6
0
 public PluginService()
 {
     ResourceID   = Guid.Empty;
     ResourceType = "PluginService";
     Source       = new PluginSource();
     Recordsets   = new RecordsetList();
     MethodsToRun = new List <IDev2MethodInfo>();
     Constructor  = new ServiceConstructor();
     Method       = new ServiceMethod();
 }
 // POST: Service/PluginSources/Get
 public PluginSource Get(string resourceId, Guid workspaceId, Guid dataListId)
 {
     var result = new PluginSource { ResourceID = Guid.Empty, ResourceType = ResourceType.PluginSource };
     try
     {
         var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, resourceId);
         if(!string.IsNullOrEmpty(xmlStr))
         {
             var xml = XElement.Parse(xmlStr);
             result = new PluginSource(xml);
         }
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }
Beispiel #8
0
 // POST: Service/PluginServices/Test
 public RecordsetList Test(string args, Guid workspaceId, Guid dataListId)
 {
     try
     {
    
         
         var service = JsonConvert.DeserializeObject<PluginService>(args,new JsonSerializerSettings
     {
         TypeNameHandling = TypeNameHandling.Objects
     });
         var pluginSourceFromCatalog = _resourceCatalog.GetResource<PluginSource>(workspaceId, service.Source.ResourceID);
         if (pluginSourceFromCatalog == null)
         {
             try
             {
                 var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, service.Source.ResourceID.ToString());
                 if (!string.IsNullOrEmpty(xmlStr))
                 {
                     var xml = XElement.Parse(xmlStr);
                     pluginSourceFromCatalog = new PluginSource(xml);
                 }
             }
             catch(Exception)
             {
                 //ignore the exception
             }
         }
         if (pluginSourceFromCatalog != null)
         {
             service.Source = pluginSourceFromCatalog;
         }
         return FetchRecordset(service, true);
     }
     catch(Exception ex)
     {
         RaiseError(ex);
         return new RecordsetList { new Recordset { HasErrors = true, ErrorMessage = ex.Message } };
     }
 }
Beispiel #9
0
        public void PluginSourceToXmlWithNullPropertiesExpectedSerializesPropertiesAsEmpty()
        {
            var expected = new PluginSource
            {
                AssemblyLocation = null,
                AssemblyName = null,
            };

            var xml = expected.ToXml();

            var actual = new PluginSource(xml);

            Assert.AreEqual(expected.ResourceType, actual.ResourceType);
            Assert.AreEqual("", actual.AssemblyLocation);
            Assert.AreEqual("", actual.AssemblyName);
        }
Beispiel #10
0
 // POST: Service/PluginServices/Methods
 public ServiceMethodList Methods(string args, Guid workspaceId, Guid dataListId)
 {
     var result = new ServiceMethodList();
     try
     {
         // BUG 9500 - 2013.05.31 - TWR : changed to use PluginService as args 
         var service = JsonConvert.DeserializeObject<PluginService>(args);
         var pluginSourceFromCatalog = _resourceCatalog.GetResource<PluginSource>(workspaceId, service.Source.ResourceID);
         if (pluginSourceFromCatalog == null)
         {
             try
             {
                 var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, service.Source.ResourceID.ToString());
                 if (!string.IsNullOrEmpty(xmlStr))
                 {
                     var xml = XElement.Parse(xmlStr);
                     pluginSourceFromCatalog = new PluginSource(xml);
                 }
             }
             catch(Exception)
             {
                 //ignore this
             }
         }
         if (pluginSourceFromCatalog != null)
         {
             service.Source = pluginSourceFromCatalog;
         }
         var broker = new PluginBroker();
         var pluginSource = (PluginSource)service.Source;
         if(pluginSource != null)
         {
             result = broker.GetMethods(pluginSource.AssemblyLocation, pluginSource.AssemblyName, service.Namespace);
         }
         return result;
     }
     catch(Exception ex)
     {
         RaiseError(ex);
     }
     return result;
 }
 /// <summary>
 /// Fetches the name space list object.
 /// </summary>
 /// <param name="pluginSource">The plugin source.</param>
 /// <returns></returns>
 public NamespaceList FetchNamespaceListObject(PluginSource pluginSource)
 {
     // BUG 9500 - 2013.05.31 - TWR : added check to avoid nulling AssemblyLocation/Name in tests 
     if(string.IsNullOrEmpty(pluginSource.AssemblyLocation))
     {
         pluginSource = new PluginSources().Get(pluginSource.ResourceID.ToString(), Guid.Empty, Guid.Empty);
     }
     var interrogatePlugin = ReadNamespaces(pluginSource.AssemblyLocation, pluginSource.AssemblyName);
     var namespacelist = new NamespaceList();
     namespacelist.AddRange(interrogatePlugin);
     return namespacelist;
 }
Beispiel #12
0
        public void PluginSourceContructorWithValidXmlExpectedInitializesProperties()
        {
            var xml = XmlResource.Fetch("PluginSource");

            var source = new PluginSource(xml);
            Assert.AreEqual(Guid.Parse("00746beb-46c1-48a8-9492-e2d20817fcd5"), source.ResourceID);
            Assert.AreEqual(ResourceType.PluginSource, source.ResourceType);
            Assert.AreEqual(@"C:\Development\DEV2 SCRUM Project\Branches\BUG_9500_PluginNamespaces\BPM Resources\Plugins\Dev2.PluginTester.dll", source.AssemblyLocation);
            Assert.AreEqual("Dev2.PluginTester", source.AssemblyName);
        }
Beispiel #13
0
 public void PluginSourceContructorWithNullXmlExpectedThrowsArgumentNullException()
 {
     var source = new PluginSource(null);
 }
Beispiel #14
0
 public void PluginSourceContructorWithDefaultExpectedInitializesProperties()
 {
     var source = new PluginSource();
     Assert.AreEqual(Guid.Empty, source.ResourceID);
     Assert.AreEqual(ResourceType.PluginSource, source.ResourceType);
 }
 /// <summary>
 /// Gets the namespaces.
 /// </summary>
 /// <param name="pluginSource">The plugin source.</param>
 /// <returns></returns>
 public NamespaceList GetNamespaces(PluginSource pluginSource)
 {
     return PluginServiceExecutionFactory.GetNamespaces(pluginSource);
 }
Beispiel #16
0
        public void PluginSourceToXmlExpectedSerializesProperties()
        {
            var expected = new PluginSource
            {
                AssemblyLocation = "Plugins\\someDllIMadeUpToTest.dll",
                AssemblyName = "dev2.test.namespacefortesting",
            };

            var xml = expected.ToXml();

            var actual = new PluginSource(xml);

            Assert.AreEqual(expected.ResourceType, actual.ResourceType);
            Assert.AreEqual(expected.AssemblyLocation, actual.AssemblyLocation);
            Assert.AreEqual(expected.AssemblyName, actual.AssemblyName);
        }
        public static NamespaceList GetNamespaces(PluginSource pluginSource)
        {
            AppDomain childDomain = null;
            try
            {
                var runtime = CreateInvokeAppDomain(out childDomain);

                // start the runtime.  call will marshal into the child runtime app domain
                return runtime.FetchNamespaceListObject(pluginSource);
            }
            finally
            {
                if(childDomain != null)
                {
                    AppDomain.Unload(childDomain);
                }
            }
        }