Ejemplo n.º 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);
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
 public static bool ContainsSmartObject(this SmartObjectManagementServer server, string systemName)
 {
     return(WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).ContainsSmartObject(systemName));
 }
Ejemplo n.º 7
0
 public static void DeleteSmartObjects(this SmartObjectManagementServer server, Guid serviceInstanceGuid)
 {
     WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).DeleteSmartObjects(serviceInstanceGuid);
 }
Ejemplo n.º 8
0
 public static void DeleteSmartObject(this SmartObjectManagementServer server, string systemName)
 {
     WrapperFactory.Instance.GetSmartObjectManagementServerWrapper(server).DeleteSmartObject(systemName);
 }
Ejemplo n.º 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;
        }