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