示例#1
0
        public static List <SmartObjectProperty> SmartObjectMethodsExplorer(Guid SmartObjectGUID)
        {
            List <SmartObjectProperty> list = new List <SmartObjectProperty>();

            SmartObjectManagementServer smomgt = new SmartObjectManagementServer();

            smomgt.CreateConnection();
            try
            {
                smomgt.Connection.Open(ConnectToK2());
                Properties prop = new Properties();

                list = prop.GetSmartObjectMethods(smomgt.GetSmartObjectInfo(smomgt.GetSmartObjectDefinition(SmartObjectGUID).ToString()).Methods);
            }
            catch (Exception ex)
            {
                list.Add(new SmartObjectProperty
                {
                    Description = ex.Message,
                    Name        = ex.Source,
                    displayname = "SmartObject Property Error"
                });
            }
            finally
            {
                smomgt.Connection.Close();
            }
            return(list);
        }
示例#2
0
        public static List <SmartObject> SmartObjectExplorer()
        {
            List <SmartObject> list = new List <SmartObject>();

            SmartObjectManagementServer smomgt = new SmartObjectManagementServer();

            smomgt.CreateConnection();
            try
            {
                smomgt.Connection.Open(ConnectToK2());

                SourceCode.SmartObjects.Management.SmartObjectExplorer smartobjects = smomgt.GetSmartObjects();

                foreach (SourceCode.SmartObjects.Management.SmartObjectInfo info in smartobjects.SmartObjectList)
                {
                    list.Add(SmartObjectBuilder(info));
                }
            }
            catch (Exception ex)
            {
                list.Add(new SmartObject
                {
                    Description  = ex.Message,
                    Name         = ex.Source,
                    ArtefactType = "SmartObject Error"
                });
            }
            finally
            {
                smomgt.Connection.Close();
            }
            return(list);
        }
 private void ManagementServerConnect()
 {
     if (_smoManagementServer == null)
     {
         _smoManagementServer = new SmartObjectManagementServer();
     }
     if (_smoManagementServer.Connection == null)
     {
         _smoManagementServer.CreateConnection();
     }
     if (!_smoManagementServer.Connection.IsConnected)
     {
         _smoManagementServer.Connection.Open(_connectionString.ConnectionString);
     }
 }
示例#4
0
        public void DeleteSmartObject_SmartObjectNotExists()
        {
            // Arrange
            var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);
            SmartObjectManagementServer smartObjectManagementServer = null;
            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            // Action
            SmartObjectHelper.DeleteSmartObject(smartObjectManagementServer, Guid.NewGuid().ToString());
        }
示例#5
0
        public void ContainsSmartObject()
        {
            // Arrange
            var smartObjectInfo = SmartObjectInfo.Create(Resources.SmartObjectDefinition_ProcessInfo);
            SmartObjectManagementServer smartObjectManagementServer = null;
            var mockSmartObjectExplorer = Mock.Of <SmartObjectExplorer>();

            mockSmartObjectExplorer.SmartObjects.Add(smartObjectInfo);

            MockWrapperFactory.Instance.SmartObjectManagementServer
            .Setup(i => i.GetSmartObjects(
                       It.IsAny <string>()))
            .Returns(mockSmartObjectExplorer);

            // Action
            var actual = SmartObjectHelper.ContainsSmartObject(smartObjectManagementServer, smartObjectInfo.Name);

            // Assert
            Assert.IsTrue(actual);
        }
示例#6
0
 public static bool ContainsSmartObject(this SmartObjectManagementServer server, string systemName)
 {
     return(WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).ContainsSmartObject(systemName));
 }
示例#7
0
 public static void DeleteSmartObjects(this SmartObjectManagementServer server, Guid serviceInstanceGuid)
 {
     WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).DeleteSmartObjects(serviceInstanceGuid);
 }
示例#8
0
 public static void DeleteSmartObject(this SmartObjectManagementServer server, string systemName)
 {
     WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).DeleteSmartObject(systemName);
 }
示例#9
0
        internal virtual SmartObjectManagementServerWrapper GetSmartObjectManagementServerWrapper(SmartObjectManagementServer server)
        {
            if (server == null)
            {
                server = ConnectionHelper.GetServer <SmartObjectManagementServer>();
            }

            return(new SmartObjectManagementServerWrapper(server));
        }
        public SmartObjectManagementServerWrapper(SmartObjectManagementServer smartObjectManagementServer)
        {
            smartObjectManagementServer.ThrowIfNull(nameof(smartObjectManagementServer));

            _smartObjectManagementServer = smartObjectManagementServer;
        }