Exemplo n.º 1
0
        public static void CreateActivityLibraryAndStoreActivities(out CWF.DataContracts.ActivityLibraryDC activityLibraryDC, out List<CWF.DataContracts.StoreActivitiesDC> storeActivityDC)
        {
            //// Setup the base request objects in request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivityRequest = new List<CWF.DataContracts.StoreActivitiesDC>();

            CWF.DataContracts.ActivityLibraryDC alDC = new CWF.DataContracts.ActivityLibraryDC();
            CWF.DataContracts.StoreActivitiesDC saDC = new CWF.DataContracts.StoreActivitiesDC();

            //// population the request object
            //// create activity library entry

            alDC.Incaller = INCALLER;
            alDC.IncallerVersion = INCALLERVERSION;
            alDC.Guid = Guid.NewGuid();
            alDC.Name = "TEST#421A";
            alDC.AuthGroupName = "pqocwfauthors";
            alDC.CategoryName = "OAS Basic Controls";
            alDC.Category = Guid.Empty;
            alDC.Executable = new byte[4];
            alDC.HasActivities = true;
            alDC.ImportedBy = "REDMOND\v-stska";
            alDC.Description = "TEST#421A DESCRIPTION";
            alDC.InsertedByUserAlias = "v-stska";
            alDC.VersionNumber = "1.0.0.8";
            alDC.Status = 1;
            alDC.StatusName = "Private";
            alDC.UpdatedByUserAlias = "REDMOND\v-stska1";

            //// Create store activity entries
            storeActivityRequest.Add(CreateSA("TEST#300", "1.1.0.0", new Guid(), alDC.Name, alDC.VersionNumber));

            activityLibraryDC = alDC;
            storeActivityDC = storeActivityRequest;
        }
        /// <summary>
        /// Performs input validation and gets activity libraries that match with search 
        /// parameters without including assemblies.
        /// </summary>
        /// <param name="request">GetLibraryAndActivitiesDC.</param>
        /// <returns>GetLibraryAndActivitiesDC object.</returns>
        public static GetAllActivityLibrariesReplyDC GetActivityLibrariesWithoutDlls(GetAllActivityLibrariesRequestDC request)
        {
            ActivityLibraryDC newRequest = null;
            if (request != null)
            {
                newRequest = new ActivityLibraryDC();
                newRequest.Name = null;
                newRequest.VersionNumber = null;
                newRequest.Incaller = request.Incaller;
                newRequest.IncallerVersion = request.IncallerVersion;
            }

            GetAllActivityLibrariesReplyDC reply = new GetAllActivityLibrariesReplyDC();

            try
            {
                // Validates the input and throws ValidationException for any issues found.
                newRequest.ValidateGetRequest();

                // Gets the activity libraries that match search criteria.
                reply.List = ActivityLibraryRepositoryService.GetActivityLibraries(newRequest, false);
            }
            catch (ValidationException e)
            {
                e.HandleException();
            }
            catch (DataAccessException e)
            {
                e.HandleException();
            }

            return reply;
        }
        /// <summary>
        /// Get an activity library by ID if a positive ID value is provided.  Otherwise, gets by GUID
        /// if a non-empty GUID is provided.  If the ID is not positive and the GUID is empty, then 
        /// a list of activity libraries matching the name and version combination.
        /// </summary>
        /// <param name="request">ActivityLibraryDC</param>
        /// <param name="includeDll">Flag that indicates whether the DLL binaries should be included in the response.</param>
        /// <returns>List of activity libraries.</returns>
        public static List<ActivityLibraryDC> GetActivityLibraries(ActivityLibraryDC request, bool includeDll)
        {
            var reply = new List<ActivityLibraryDC>();
            var status = new StatusReplyDC();
            Database database = null;
            DbCommand command = null;
            string outErrorString = string.Empty;
            try
            {
                database = DatabaseFactory.CreateDatabase();
                command = database.GetStoredProcCommand(StoredProcNames.ActivityLibraryGet);
                database.AddParameter(command, "@inCaller", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Incaller);
                database.AddParameter(command, "@inCallerVersion", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.IncallerVersion);
                database.AddParameter(command, "@InId", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.Id);
                database.AddParameter(command, "@InGuid", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, Convert.ToString(request.Guid));
                database.AddParameter(command, "@InName", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, Convert.ToString(request.Name));
                database.AddParameter(command, "@InVersion", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, Convert.ToString(request.VersionNumber));
                database.AddParameter(command, "@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null, DataRowVersion.Default, 0);

                using (IDataReader reader = database.ExecuteReader(command))
                {
                    while (reader.Read())
                    {
                        var activeLibraryDCreply = new ActivityLibraryDC();
                        activeLibraryDCreply.AuthGroupId = Convert.ToInt32(reader["AuthGroupId"]);
                        activeLibraryDCreply.AuthGroupName = Convert.ToString(reader["AuthGroupName"]);
                        activeLibraryDCreply.Category = (reader["Category"] == DBNull.Value) ? Guid.Empty : new Guid(Convert.ToString(reader["Category"]));
                        activeLibraryDCreply.CategoryId = (reader["CategoryId"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["CategoryId"]);
                        activeLibraryDCreply.Description = Convert.ToString(reader["Description"]) ?? string.Empty;
                        activeLibraryDCreply.Guid = (reader["Guid"] == DBNull.Value) ? Guid.Empty : new Guid(Convert.ToString(reader["Guid"]));
                        activeLibraryDCreply.HasActivities = (reader["HasActivities"] == DBNull.Value) ? false : Convert.ToBoolean(reader["HasActivities"]);
                        activeLibraryDCreply.Id = Convert.ToInt32(reader["Id"]);
                        activeLibraryDCreply.ImportedBy = Convert.ToString(reader["ImportedBy"]);
                        activeLibraryDCreply.MetaTags = Convert.ToString(reader["MetaTags"]) ?? string.Empty;
                        activeLibraryDCreply.Name = Convert.ToString(reader["Name"]);
                        activeLibraryDCreply.Status = (reader["Status"] == DBNull.Value) ? 0 : Convert.ToInt32(reader["Status"]);
                        activeLibraryDCreply.StatusName = Convert.ToString(reader["StatusName"]);
                        activeLibraryDCreply.VersionNumber = Convert.ToString(reader["VersionNumber"]);
                        activeLibraryDCreply.FriendlyName = Convert.ToString(reader["FriendlyName"]);
                        activeLibraryDCreply.ReleaseNotes = Convert.ToString(reader["ReleaseNotes"]);
                        activeLibraryDCreply.HasExecutable = reader["Executable"] != DBNull.Value;

                        if (includeDll)
                        {
                            activeLibraryDCreply.Executable = (reader["Executable"] == DBNull.Value) ? null : (byte[])reader["Executable"];
                        }

                        reply.Add(activeLibraryDCreply);
                    }
                }
            }
            catch (SqlException e)
            {
                e.HandleException();
            }

            return reply;
        }
        /// <summary>
        /// Performs input validation and gets activity libraries that match with search 
        /// parameters while including assemblies with each activity library entry found.
        /// </summary>
        /// <param name="request">ActivityLibraryDC data contract.</param>
        /// <returns>List of ActivityLibraryDC.</returns>
        public static List<ActivityLibraryDC> GetActivityLibraries(ActivityLibraryDC request)
        {
            List<ActivityLibraryDC> reply = null;
            try
            {
                // Validates the input and throws ValidationException for any issues found.
                request.ValidateGetRequest();

                // Gets the activity libraries that match search criteria.
                reply = ActivityLibraryRepositoryService.GetActivityLibraries(request, true);
            }
            catch (ValidationException e)
            {
                e.HandleException();
            }
            catch (DataAccessException e)
            {
                e.HandleException();
            }
            return reply;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Performs input validation and gets activities by activity library ID or Name & Version combination.
        /// </summary>
        /// <param name="request">Request that specifies activity library identifier info.</param>
        /// <param name="includeXaml">Flag that indicates whether activity XAML should be returned.</param>
        /// <returns>Response that contains a list of activities.</returns>
        public static GetActivitiesByActivityLibraryNameAndVersionReplyDC GetActivitiesByActivityLibrary(GetActivitiesByActivityLibraryNameAndVersionRequestDC request, bool includeXaml)
        {
            var reply = new GetActivitiesByActivityLibraryNameAndVersionReplyDC();

            try
            {
                // Validates the input and throws ValidationException for any issues found.
                request.ValidateRequest();

                var newRequest = new GetLibraryAndActivitiesDC();
                var activityLibraryDC = new ActivityLibraryDC();
                var newReply = new List<GetLibraryAndActivitiesDC>();

                activityLibraryDC.IncallerVersion = request.IncallerVersion;
                activityLibraryDC.Incaller = request.Incaller;
                activityLibraryDC.Name = request.Name;
                activityLibraryDC.VersionNumber = request.VersionNumber;
                newRequest.ActivityLibrary = activityLibraryDC;

                newReply = ActivityRepositoryService.GetActivitiesByActivityLibrary(newRequest, includeXaml);

                if (newReply != null && newReply.Count > 0)
                {
                    reply.List = newReply[0].StoreActivitiesList;
                }
            }
            catch (ValidationException e)
            {
                e.HandleException();
            }
            catch (DataAccessException e)
            {
                e.HandleException();
            }

            return reply;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Verify CreateOrUpdate FROM etblActivityLibraries Table. This will be a create since id is null.
        /// </summary>
        /// <param name="name">name to be created</param>
        /// <param name="description">description to do a create or update on.</param>
        /// <param name="version">version to do a create or update on.</param>
        /// <param name="authGroupName">authGroupName to do a create or update on.</param>
        /// <param name="categoryName">categoryName to do a create or update on.</param>
        /// <returns>returns the id created</returns>
        private int CreateActivityLibrariesWithNullID(string name, string description, string version, string authGroupName, string categoryName)
        {
            createOrUpdateRequest = new ActivityLibraryDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.Guid = Guid.NewGuid();
            createOrUpdateRequest.Name = name;
            createOrUpdateRequest.Description = description;
            createOrUpdateRequest.InsertedByUserAlias = USER;
            createOrUpdateRequest.UpdatedByUserAlias = USER;
            createOrUpdateRequest.VersionNumber = version;
            createOrUpdateRequest.AuthGroupName = authGroupName;
            createOrUpdateRequest.CategoryName = categoryName;
            createOrUpdateRequest.StatusName = STATUS;
            createOrUpdateRequest.Status = STATUSCODE;

            try
            {
                createOrUpdateReply = devBranchProxy.ActivityLibraryCreateOrUpdate(createOrUpdateRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(createOrUpdateReply, "ActivityLibraryDC object null");
            Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.StatusReply is null");
            Assert.AreEqual(SprocValues.REPLY_ERRORCODE_VALUE_OK, createOrUpdateReply.StatusReply.Errorcode, "createOrUpdateReply.StatusReply.Errorcode is not 0. Instead it is {0}.", createOrUpdateReply.StatusReply.Errorcode);
            Assert.IsTrue(string.IsNullOrEmpty(createOrUpdateReply.StatusReply.ErrorMessage), "createOrUpdateReply.StatusReply.ErrorMessage is not null");
            Assert.IsTrue(string.IsNullOrEmpty(createOrUpdateReply.StatusReply.ErrorGuid), "createOrUpdateReply.StatusReply.ErrorGuid is not null");

            int id = GetActivityLibrariesForValidNameAndValidateForMaxID(name);
            GetActivityLibrariesForValidID(id);
            Assert.IsNotNull(getReplyList, "getReplyList is null.");
            Assert.AreNotEqual(0, getReplyList.Count, " getReply.List.Count is 0.");
            Assert.AreEqual(description, getReplyList[0].Description, "Description did not get inserted or updated correctly");
            Assert.AreEqual(name, getReplyList[0].Name, "Name did not get inserted or updated correctly");

            return id;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Create activity library entry and store activity entries
        /// </summary>
        /// <param name="activityLibraryDC"></param>
        /// <param name="storeActivityDC"></param>
        private void CreateActivityLibraryAndStoreActivities(out ActivityLibraryDC activityLibraryDC, out List<StoreActivitiesDC> storeActivityDC)
        {
            List<StoreActivitiesDC> storeActivityRequestList = new List<StoreActivitiesDC>();
            ActivityLibraryDC activityLibraryDCTemp = new ActivityLibraryDC();

            // create activity library entry
            activityLibraryDCTemp.Incaller = IN_CALLER;
            activityLibraryDCTemp.IncallerVersion = IN_CALLER_VERSION;
            activityLibraryDCTemp.Guid = Guid.NewGuid();
            activityLibraryDCTemp.Name = TEST_STRING;
            activityLibraryDCTemp.AuthGroupName = AUTH_GROUP_NAME2;
            activityLibraryDCTemp.CategoryName = CATEGORY_NAME2;
            activityLibraryDCTemp.Category = Guid.Empty;
            activityLibraryDCTemp.Executable = new byte[4];
            activityLibraryDCTemp.HasActivities = true;
            activityLibraryDCTemp.ImportedBy = USER;
            activityLibraryDCTemp.Description = TEST_STRING;
            activityLibraryDCTemp.InsertedByUserAlias = USER;
            activityLibraryDCTemp.VersionNumber = VERSIONNUMBER1;
            activityLibraryDCTemp.UpdatedByUserAlias = USER;
            activityLibraryDCTemp.Status = STATUSCODE;
            activityLibraryDCTemp.StatusName = STATUS;

            // Create 40 store activities and let it crank
            for (int i = 0; i < 40; i++)
            {
                storeActivityRequestList.Add(CreateStoreActivity(STOREACTIVITYNAME, "3.1.0." + i, new Guid(), activityLibraryDCTemp.Name, activityLibraryDCTemp.VersionNumber));
            }

            activityLibraryDC = activityLibraryDCTemp;
            storeActivityDC = storeActivityRequestList;
        }
Exemplo n.º 8
0
        /// <summary>
        /// The assembly name local location location to activity library dc.
        /// </summary>
        /// <param name="aai">
        /// The  assemblyLocationItems.
        /// </param>
        /// <returns>
        /// Converted ActivityLibraryDC instance
        /// </returns>
        public static ActivityLibraryDC AssemblyItemToActivityLibraryDataContract(ActivityAssemblyItem aai)
        {
            var activityLibrary = new ActivityLibraryDC();
            activityLibrary.Name = aai.AssemblyName.Name;
            activityLibrary.VersionNumber = aai.Version.ToString();

            // TODO: remove these
            activityLibrary.Incaller = Utility.GetCallerName();
            activityLibrary.IncallerVersion = Utility.GetCallerVersion();
            activityLibrary.Guid = Guid.NewGuid();
            activityLibrary.AuthGroupName = aai.AuthorityGroup;
            activityLibrary.CategoryName = aai.Category ?? "OAS Basic Controls";
            activityLibrary.Category = Guid.Empty;
            activityLibrary.Executable = new byte[4];
            activityLibrary.HasActivities = false;
            activityLibrary.ImportedBy = Utility.GetCurrentUserName();
            activityLibrary.Description = aai.Description;
            activityLibrary.Status = 1;

            return activityLibrary;
        }
Exemplo n.º 9
0
 private static ActivityLibraryDC GetActivityLibraryDC(
     string libraryName,
     string category,
     string description,
     string insertBy,
     string version,
     string status)
 {
     var library = new ActivityLibraryDC()
     {
         Name = libraryName,
         Executable = null,
         AuthGroupName = AuthorizationService.GetWorkflowAuthGroupName(),
         CategoryName = category,
         ImportedBy = Utility.GetCurrentUserName(),
         Description = description,
         InsertedByUserAlias =
             !String.IsNullOrEmpty(insertBy)
                 ? insertBy
                 : Utility.GetCurrentUserName(),
         VersionNumber = version,
         UpdatedByUserAlias = Utility.GetCurrentUserName(),
         Guid = Guid.NewGuid(),
         StatusName = status
     };
     return library;
 }
Exemplo n.º 10
0
        public void GetActivityLibraryAndStoreActivities()
        {
            List<CWF.DataContracts.GetLibraryAndActivitiesDC> reply = null;
            CWF.DataContracts.GetLibraryAndActivitiesDC request = new CWF.DataContracts.GetLibraryAndActivitiesDC();
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();
            activityLibraryDC.IncallerVersion = INCALLERVERSION;
            activityLibraryDC.Incaller = INCALLER;
            activityLibraryDC.Name = "OASP.Core2";
            activityLibraryDC.VersionNumber = "1.0.0.0";
            activityLibraryDC.Id = 0;
            request.ActivityLibrary = activityLibraryDC;
            try
            {
                reply = ActivityRepositoryService.GetActivitiesByActivityLibrary(request, false);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.DAL.Activities.GetActivityLibraryAndStoreActivities(request);");
            }

            Assert.IsNotNull(reply);
        }
Exemplo n.º 11
0
        public void TESTBalUploadActivityLibraryAndDependentActivitiesRepeat()
        {
            var nameModifier = Guid.NewGuid().ToString();
            CWF.DataContracts.StoreLibraryAndActivitiesRequestDC request = new CWF.DataContracts.StoreLibraryAndActivitiesRequestDC();
            List<CWF.DataContracts.StoreActivitiesDC> reply = null;

            request.IncallerVersion = INCALLERVERSION;
            request.Incaller = INCALLER;
            request.InInsertedByUserAlias = INCALLER;
            request.InUpdatedByUserAlias = INCALLER;
            request.EnforceVersionRules = true;

            // Create ActivityLibrary object and add to request object
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivitiesDCList = new List<CWF.DataContracts.StoreActivitiesDC>();
            CWF.DataContracts.StoreActivitiesDC storeActivitiesDC = new CWF.DataContracts.StoreActivitiesDC();
            CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);
            request.ActivityLibrary = activityLibraryDC;
            request.StoreActivitiesList = storeActivitiesDCList;
            request.StoreActivitiesList.ForEach(record =>
            {
                record.Name += nameModifier;
                record.ActivityLibraryName += nameModifier;
                record.ShortName += nameModifier;

            });

            activityLibraryDC.Name = "PublishingInfo";
            activityLibraryDC.VersionNumber = "1.0.0.1";

            request.StoreActivityLibraryDependenciesGroupsRequestDC = new StoreActivityLibraryDependenciesGroupsRequestDC()
            {
                Name = activityLibraryDC.Name,
                Version = activityLibraryDC.VersionNumber,
                List = new List<StoreActivityLibraryDependenciesGroupsRequestDC>
                {
                    new StoreActivityLibraryDependenciesGroupsRequestDC
                    {
                        IncallerVersion = INCALLERVERSION,
                        Incaller = INCALLER,
                        Name = "PublishingInfo",
                        Version = "1.0.0.1"
                    },
                }
            };

            try
            {
                reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);");
            }
            Assert.IsNotNull(reply);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for Invalid IDs
        /// </summary>
        /// <param name="nonExistingID">id of row to do a get on</param>
        private void VerifyGetActivityLibrariesForInvalidIDs(int nonExistingID)
        {
            getRequest = new ActivityLibraryDC();

            // Populate Request
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.InsertedByUserAlias = USER;
            getRequest.UpdatedByUserAlias = USER;
            getRequest.Id = nonExistingID;

            getReplyList = new List<ActivityLibraryDC>();

            try
            {
                getReplyList = new List<ActivityLibraryDC>(devBranchProxy.ActivityLibraryGet(getRequest));
            }
            catch (FaultException ex)
            {
                Assert.Fail("Caught WCF FaultExceptionException: Message: {0} \n Stack Trace: {1}", ex.Message, ex.StackTrace);
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception Invoking the Service. Message: {0} \n Stack Trace: {1}", e.Message, e.StackTrace);
            }

            int errorConstant = 0; // No error expected

            Assert.IsNotNull(getReplyList, "getReplyList is null.");
            Assert.AreEqual(1, getReplyList.Count, "Service returned wrong number of records. InId= {0}. It should have returned 1 but instead returned {1}.", nonExistingID, getReplyList.Count);
            Assert.IsNotNull(getReplyList[0].StatusReply, "getReply.StatusReply is null");
            Assert.IsNull(getReplyList[0].StatusReply.ErrorMessage, "Error Message is null");
            Assert.AreEqual(errorConstant, getReplyList[0].StatusReply.Errorcode, "Service returned unexpected error code. Expected: {0}, Returned: {1}", errorConstant, getReplyList[0].StatusReply.Errorcode);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for softDeleted IDs
        /// </summary>
        /// <param name="softDeletedID">id of row to do a get on</param>
        private void GetActivityLibrariesForSoftDeletedIDs(int softDeletedID)
        {
            getRequest = new ActivityLibraryDC();
            getReplyList = new List<ActivityLibraryDC>();

            //Populate the request data
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.Id = softDeletedID;

            try
            {
                getReplyList = new List<ActivityLibraryDC>(devBranchProxy.ActivityLibraryGet(getRequest));
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", ex.Message);
            }

            int errorConstant = GetErrorConstantSoftDeletedID();

            Assert.IsNotNull(getReplyList, "getReplyList is null");
            Assert.AreEqual(1, getReplyList.Count, "Get returned the wrong number of entries. InId: {0}. It should have returned 1 but instead returned {1}.", softDeletedID, getReplyList.Count);
            Assert.IsNotNull(getReplyList[0].StatusReply, "getReply.Status is null");
            Assert.AreEqual(errorConstant, getReplyList[0].StatusReply.Errorcode, "Returned the wrong status error code. InId: {0}.", softDeletedID);
        }
Exemplo n.º 14
0
        public static void MyClassInitialize(TestContext testContext)
        {
            string nameModifier = "Test_" + Guid.NewGuid().ToString();
            CWF.DataContracts.StoreLibraryAndActivitiesRequestDC request = new CWF.DataContracts.StoreLibraryAndActivitiesRequestDC();
            List<CWF.DataContracts.StoreActivitiesDC> reply = null;

            request.IncallerVersion = INCALLERVERSION;
            request.Incaller = INCALLER;
            request.InInsertedByUserAlias = INCALLER;
            request.InUpdatedByUserAlias = INCALLER;
            request.EnforceVersionRules = true;

            // Create ActivityLibrary object and add to request object
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivitiesDCList = new List<CWF.DataContracts.StoreActivitiesDC>();
            CWF.DataContracts.StoreActivitiesDC storeActivitiesDC = new CWF.DataContracts.StoreActivitiesDC();
            DALUnitTest.CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);
            request.ActivityLibrary = activityLibraryDC;
            request.StoreActivitiesList = storeActivitiesDCList;
            request.StoreActivitiesList.ForEach(record =>
            {
                record.Name += nameModifier;
                record.ActivityLibraryName += nameModifier;
                record.ShortName += nameModifier;

            });

            activityLibraryDC.Name += nameModifier;

            request.StoreActivityLibraryDependenciesGroupsRequestDC = new StoreActivityLibraryDependenciesGroupsRequestDC()
            {
                Name = activityLibraryDC.Name,
                Version = activityLibraryDC.VersionNumber,
                List = new List<StoreActivityLibraryDependenciesGroupsRequestDC>
                {
                    new StoreActivityLibraryDependenciesGroupsRequestDC
                    {
                        IncallerVersion = INCALLERVERSION,
                        Incaller = INCALLER,
                        Name = "PublishingInfo",
                        Version = "1.0.0.1"
                    },
                }
            };
            reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);
            Assert.IsNotNull(reply);
            activityId = reply[0].Id;
            Assert.IsTrue(activityId > 0);

            //Test Create or Update
            Guid taskGuid = Guid.NewGuid();
            TaskActivityDC reply1 = null;
            TaskActivityDC request1 = new TaskActivityDC()
            {
                ActivityId = activityId,
                Guid = taskGuid,
                Incaller = INCALLER,
                IncallerVersion = INCALLERVERSION,
                AssignedTo = OWNER
            };
            try
            {
                reply1 = TaskActivityRepositoryService.TaskActivitiesCreateOrUpdate(request1);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch exception in reply = TaskActivityRepository.CreateOrUpdate(request)");
            }
            Assert.IsNotNull(reply1);
            Assert.IsTrue(reply1.Id > 0);
            Assert.AreEqual(SprocValues.REPLY_ERRORCODE_VALUE_OK, reply1.StatusReply.Errorcode);
        }
Exemplo n.º 15
0
        public void ActivityLibraryCreateANDUpdate()
        {
            CWF.DataContracts.ActivityLibraryDC reply = null;
            CWF.DataContracts.ActivityLibraryDC request = new CWF.DataContracts.ActivityLibraryDC();
            //// UPDATE
            try
            {
                request.Incaller = INCALLER;
                request.IncallerVersion = INCALLERVERSION;
                request.Description = "In NEW Description";
                request.Id = 100000;
                request.InsertedByUserAlias = INSERTEDBYUSERALIAS;
                request.UpdatedByUserAlias = UPDATEDBYUSERALIAS;
                try
                {
                    reply = ActivityLibrary.ActivityLibraryCreateOrUpdate(request);
                }
                catch (Exception deleteEx)
                {
                    string faultMessage = deleteEx.Message;
                    Assert.Fail(faultMessage + "-catch (Exception deleteEx) in reply = CWF.DAL.Activities.ActivityLibraryCreateOrUpdate(request);");
                }
                // TODO Unit testing fails(too many parameters) while TEST Harness works - Assert.AreEqual(reply.StatusReply.Errorcode, -60);
                //// update
                request.Guid = new Guid("ACE00000-0000-0000-0000-000000000000");
                request.Name = "TEST#200";
                request.AuthGroupName = "pqocwfauthors";
                request.CategoryName = "OAS Basic Controls";
                request.Category = Guid.Empty;
                request.Executable = new byte[4];
                request.HasActivities = true;
                request.ImportedBy = "REDMOND\v-stska";
                request.Description = "TEST DESCRIPTION";
                request.InsertedByUserAlias = INCALLER;
                request.VersionNumber = "1.0.0.1";
                request.Status = 990;
                request.UpdatedByUserAlias = "REDMOND\v-stska";

                //// update
                try
                {
                    reply = ActivityLibrary.ActivityLibraryCreateOrUpdate(request);
                }
                catch (Exception ex)
                {
                    string faultMessage = ex.Message;
                    Assert.Fail(faultMessage + "-catch (Exception ex) in reply = CWF.DAL.Activities.ActivityLibraryCreateOrUpdate(request);");
                }

                Assert.IsNotNull(reply);
                // TODO Unit testing fails(too many parameters) while TEST Harness works - Assert.AreEqual(reply.StatusReply.Errorcode, SprocValues.UPDATE_INVALID_ID);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                // TODO Unit testing fails(too many parameters) while TEST Harness works - Assert.Fail(faultMessage + "-catch (Exception ex) in reply = CWF.DAL.Activities.ActivityLibraryCreateOrUpdate(request);");
            }

            Assert.IsNotNull(reply);
            // TODO Unit testing fails(too many parameters) while TEST Harness works - Assert.AreEqual(reply.StatusReply.Errorcode, SprocValues.UPDATE_INVALID_ID);
        }
Exemplo n.º 16
0
        public void BALActivityLibraryGet()
        {
            CWF.DataContracts.ActivityLibraryDC request = new CWF.DataContracts.ActivityLibraryDC();
            List<CWF.DataContracts.ActivityLibraryDC> reply = null;
            request.Incaller = INCALLER;
            request.IncallerVersion = INCALLERVERSION;

            try
            {
                reply = ActivityLibraryBusinessService.GetActivityLibraries(request);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) in reply = Microsoft.Support.Workflow.Service.BusinessServices.ActivityLibraryBusinessService.ActivityLibraryGet(request);");
            }

            Assert.IsNotNull(reply);
            Assert.AreEqual(reply[0].StatusReply.Errorcode, SprocValues.REPLY_ERRORCODE_VALUE_OK);
        }
Exemplo n.º 17
0
        public void TestUploadTaskActivity()
        {
            string nameModifier = "Test_" + Guid.NewGuid().ToString();
            CWF.DataContracts.StoreLibraryAndTaskActivityRequestDC request = new CWF.DataContracts.StoreLibraryAndTaskActivityRequestDC();
            List<CWF.DataContracts.TaskActivityDC> reply = null;

            request.IncallerVersion = INCALLERVERSION;
            request.Incaller = INCALLER;
            request.InInsertedByUserAlias = INCALLER;
            request.InUpdatedByUserAlias = INCALLER;
            request.EnforceVersionRules = true;

            // Create ActivityLibrary object and add to request object
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivitiesDCList = new List<CWF.DataContracts.StoreActivitiesDC>();
            CWF.DataContracts.StoreActivitiesDC storeActivitiesDC = new CWF.DataContracts.StoreActivitiesDC();
            DALUnitTest.CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);
            request.ActivityLibrary = activityLibraryDC;
            storeActivitiesDCList.ForEach(record =>
            {
                record.Name += nameModifier;
                record.ActivityLibraryName += nameModifier;
                record.ShortName += nameModifier;

            });
            List<TaskActivityDC> taskActivityList = storeActivitiesDCList.Select(sa => new TaskActivityDC()
            {
                Activity = sa,
                AssignedTo = OWNER,
                Guid = Guid.NewGuid(),
                Incaller = INCALLER,
                IncallerVersion = INCALLERVERSION
            }).ToList();
            request.TaskActivitiesList = taskActivityList;

            activityLibraryDC.Name += nameModifier;

            request.StoreActivityLibraryDependenciesGroupsRequestDC = new StoreActivityLibraryDependenciesGroupsRequestDC()
            {
                Name = activityLibraryDC.Name,
                Version = activityLibraryDC.VersionNumber,
                List = new List<StoreActivityLibraryDependenciesGroupsRequestDC>
                {
                    new StoreActivityLibraryDependenciesGroupsRequestDC
                    {
                        IncallerVersion = INCALLERVERSION,
                        Incaller = INCALLER,
                        Name = "PublishingInfo",
                        Version = "1.0.0.1"
                    },
                }
            };
            reply = CWF.BAL.Services.UploadLibraryAndTaskActivities(request);
            Assert.IsNotNull(reply);
        }
Exemplo n.º 18
0
        public void GetMissingActivityLibraries()
        {
            var request = new CWF.DataContracts.GetMissingActivityLibrariesRequest();
            var reply = new List<CWF.DataContracts.ActivityLibraryDC>();

            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();
            activityLibraryDC.IncallerVersion = INCALLERVERSION;
            activityLibraryDC.Incaller = INCALLER;
            activityLibraryDC.Name = "OASP.Core2";
            activityLibraryDC.VersionNumber = "1.0.0.0";
            activityLibraryDC.Id = 0;

            request.Incaller = INCALLER;
            request.IncallerVersion = INCALLERVERSION;
            request.ActivityLibrariesList = new List<ActivityLibraryDC> { activityLibraryDC };

            try
            {
                reply = ActivityLibraryRepositoryService.GetMissingActivityLibraries(request);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.BAL.StoreActivityLibraryDependencies.StoreActivityLibraryDependencyList(request);");
            }

            Assert.IsNotNull(reply);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Verify CreateOrUpdate FROM etblActivityLibraries Table
        /// </summary>
        /// <param name="id"> id to do a create or update on. id is 0 if it will be a create.</param>
        /// <param name="name">name to do a create or update on.</param>
        /// <param name="description">description to do a create or update on.</param>
        /// <param name="version">version to do a create or update on.</param>
        /// <param name="authGroupName">authGroupName to do a create or update on.</param>
        /// <param name="categoryName">categoryName to do a create or update on.</param>
        private void CreateOrUpdateActivityLibraries(int id, string name, string description, string version, string authGroupName, string categoryName)
        {
            createOrUpdateRequest = new ActivityLibraryDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.Id = id;
            createOrUpdateRequest.Guid = Guid.NewGuid();
            createOrUpdateRequest.Name = name;
            createOrUpdateRequest.Description = description;
            createOrUpdateRequest.InsertedByUserAlias = USER;
            createOrUpdateRequest.UpdatedByUserAlias = USER;
            createOrUpdateRequest.VersionNumber = version;
            createOrUpdateRequest.AuthGroupName = authGroupName;
            createOrUpdateRequest.CategoryName = categoryName;
            createOrUpdateRequest.StatusName = STATUS;
            createOrUpdateRequest.Status = STATUSCODE;

            try
            {
                createOrUpdateReply = devBranchProxy.ActivityLibraryCreateOrUpdate(createOrUpdateRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(createOrUpdateReply, "ActivityLibraryDC object null");
            Assert.IsNotNull(createOrUpdateReply.StatusReply, "createOrUpdateReply.StatusReply is null");
            Assert.AreEqual(0, createOrUpdateReply.StatusReply.Errorcode, "createOrUpdateReply.StatusReply.Errorcode is not 0. Instead it is {0}.", createOrUpdateReply.StatusReply.Errorcode);
            Assert.IsTrue(string.IsNullOrEmpty(createOrUpdateReply.StatusReply.ErrorMessage), "createOrUpdateReply.StatusReply.ErrorMessage is not null");
            Assert.IsTrue(string.IsNullOrEmpty(createOrUpdateReply.StatusReply.ErrorGuid), "createOrUpdateReply.StatusReply.ErrorGuid is not null");
        }
Exemplo n.º 20
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for valid name and invalid version
        /// </summary>
        /// <param name="name">name of row to do a get on</param>
        /// <param name="version">version of name to do a get on</param>
        private void VerifyGetActivityLibrariesForValidNameAndInvalidVersion(string name, string version)
        {
            getRequest = new ActivityLibraryDC();
            getReplyList = null;

            //Populate the request data
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.Name = name;
            getRequest.VersionNumber = version;

            getReplyList = new List<ActivityLibraryDC>(devBranchProxy.ActivityLibraryGet(getRequest));
            Assert.IsNotNull(getReplyList, "getReply.List is null");
            Assert.AreEqual(0, getReplyList.Count, "Get returned the wrong number of entries. name: {0}, version: {1}. It should have returned 0 but instead returned {2}.", name, version, getReplyList.Count);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Verify CreateOrUpdate FROM etblActivityLibraries Table for Invalid IDs. id is invalid if it's not 0 or not already in the table.
        /// </summary>
        /// <param name="id">id to try to insert or update</param>
        /// <param name="name">name to try to insert or update</param>
        /// <param name="description">description to do a create or update on.</param>
        /// <param name="version">version to do a create or update on.</param>
        /// <param name="authGroupName">authGroupName to do a create or update on.</param>
        /// <param name="categoryName">categoryName to do a create or update on.</param>
        private void CreateOrUpdateActivityLibrariesForInvalidIds(int id, string name, string description, string version, string authGroupName, string categoryName)
        {
            createOrUpdateRequest = new ActivityLibraryDC();

            createOrUpdateReply = null;

            //Populate the request data
            createOrUpdateRequest.Incaller = IN_CALLER;
            createOrUpdateRequest.IncallerVersion = IN_CALLER_VERSION;
            createOrUpdateRequest.Id = id;
            createOrUpdateRequest.Guid = Guid.NewGuid();
            createOrUpdateRequest.Name = name;
            createOrUpdateRequest.Description = description;
            createOrUpdateRequest.InsertedByUserAlias = USER;
            createOrUpdateRequest.UpdatedByUserAlias = USER;
            createOrUpdateRequest.VersionNumber = version;
            createOrUpdateRequest.AuthGroupName = authGroupName;
            createOrUpdateRequest.CategoryName = categoryName;
            createOrUpdateRequest.StatusName = STATUS;
            createOrUpdateRequest.Status = STATUSCODE;

            try
            {
                createOrUpdateReply = devBranchProxy.ActivityLibraryCreateOrUpdate(createOrUpdateRequest);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to createOrUpdate data from etblActivityLibraries: {0}", ex.Message);
            }

            int errorConstant = SprocValues.UPDATE_INVALID_ID;

            Assert.IsNotNull(createOrUpdateReply, "ActivityLibraryDC object null");
            Assert.IsNotNull(createOrUpdateReply.StatusReply, "getReply.Status is null");
            Assert.AreEqual(errorConstant, createOrUpdateReply.StatusReply.Errorcode, "Returned the wrong status error code. InId: {0}", id);
            Assert.IsNotNull(createOrUpdateReply.StatusReply.ErrorMessage, "createOrUpdateReply.StatusReply.ErrorMessage is null");
        }
Exemplo n.º 22
0
        /// <summary>
        /// Verify UploadActivityLibrariesAndDependentActivities FROM etblActivityLibraries Table
        /// </summary>
        private void VerifyUploadActivityLibraryAndDependentActivities(string incaller, int errorCode)
        {
            storeLibraryAndActivitiesRequest = new StoreLibraryAndActivitiesRequestDC();
              //  reply = null;

            storeLibraryAndActivitiesRequest.IncallerVersion = IN_CALLER_VERSION;
            storeLibraryAndActivitiesRequest.Incaller = incaller;
            storeLibraryAndActivitiesRequest.InInsertedByUserAlias = USER;
            storeLibraryAndActivitiesRequest.InUpdatedByUserAlias = USER;

            // Create ActivityLibrary object and add to request object
            ActivityLibraryDC activityLibraryDC = new ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<StoreActivitiesDC> storeActivitiesDCList = new List<StoreActivitiesDC>();
            StoreActivitiesDC storeActivitiesDC = new StoreActivitiesDC();

            CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);

            storeLibraryAndActivitiesRequest.ActivityLibrary = activityLibraryDC;
            storeLibraryAndActivitiesRequest.StoreActivityLibraryDependenciesGroupsRequestDC = CreateStoreActivityLibraryDependenciesGroupsRequestDC();
            storeLibraryAndActivitiesRequest.StoreActivitiesList = storeActivitiesDCList;

            storeActivitiesDCList.ForEach(record => record.Version = VersionHelper.GetNextVersion(record).ToString());

            try
            {
                replyList = new List<StoreActivitiesDC>(devBranchProxy.UploadActivityLibraryAndDependentActivities(storeLibraryAndActivitiesRequest));
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to upload from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to upload from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(replyList, "Reply is null");
            Assert.AreEqual(errorCode, replyList[0].StatusReply.Errorcode, "UploadActivityLibraryAndDependentActivities not successful.");
        }
Exemplo n.º 23
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for a valid name
        /// </summary>
        /// <param name="name">name from row to do a get on</param>
        /// <returns>returns the id of this row</returns>
        private int GetActivityLibrariesForValidNameAndValidateForMaxID(string name)
        {
            getRequest = new ActivityLibraryDC();
            getReplyList = new List<ActivityLibraryDC>();

            //Populate the request data
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.Name = name;

            try
            {
                getReplyList = new List<ActivityLibraryDC>(devBranchProxy.ActivityLibraryGet(getRequest));
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(getReplyList, "getReplyList is null");
            Assert.AreNotEqual(0, getReplyList.Count, "Get returned the wrong number of entries. InName: {0}. It should not have returned 0.", name);
            Assert.IsNotNull(getReplyList[0].StatusReply, "getReplyList[0].StatusReply is null");

            int index = getReplyList.Count - 1;
            int id = getReplyList[index].Id;

            return id;
        }
Exemplo n.º 24
0
        public void GetActivitiesByActivityLibrary()
        {
            List<CWF.DataContracts.GetLibraryAndActivitiesDC> reply = null;
            var request = new CWF.DataContracts.GetLibraryAndActivitiesDC();
            var activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            activityLibraryDC.IncallerVersion = INCALLERVERSION;
            activityLibraryDC.Incaller = INCALLER;
            activityLibraryDC.Name = "OASP.Core";
            activityLibraryDC.VersionNumber = "2.2.108.0";
            activityLibraryDC.Id = 0;
            request.ActivityLibrary = activityLibraryDC;

            try
            {
                reply = CWF.BAL.Services.GetLibraryAndActivities(request);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.BAL.GetLibrary.GetLibraryAndActivities(request);");
            }

            Assert.IsNotNull(reply);
            Assert.AreEqual(reply[0].StatusReply.Errorcode, 0);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for Valid guid
        /// </summary>
        /// <param name="guid">guid of row to do a get on</param>
        private void VerifyGetActivityLibrariesForValidGuid(Guid guid)
        {
            getRequest = new ActivityLibraryDC();
            getReplyList = null;

            //Populate the request data
            getRequest.Incaller = IN_CALLER;
            getRequest.IncallerVersion = IN_CALLER_VERSION;
            getRequest.InsertedByUserAlias = USER;
            getRequest.UpdatedByUserAlias = USER;
            getRequest.Guid = guid;

            try
            {
                getReplyList = new List<ActivityLibraryDC>(devBranchProxy.ActivityLibraryGet(getRequest));
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to get data from etblActivityLibraries: {0}", ex.Message);
            }

            Assert.IsNotNull(getReplyList, "getReply.List is null");
            Assert.AreEqual(1, getReplyList.Count, "Get returned the wrong number of entries. guid: {0}. It should have returned 1 but instead returned {1}.", guid, getReplyList.Count);
            Assert.IsNotNull(getReplyList[0].StatusReply, "getReply.StatusReply is null");
            Assert.AreEqual(0, getReplyList[0].StatusReply.Errorcode, "StatusReply returned the wrong error code. Expected: 0. Actual: {0}", getReplyList[0].StatusReply.Errorcode);
            Assert.AreEqual(getRequest.Guid, getReplyList[0].Guid, "Get returned wrong data");
        }
Exemplo n.º 26
0
        /// <summary>
        /// If the parameter request.InId is valid, it is an update, otherwise it is a create operation.
        /// </summary>
        /// <param name="request">request object</param>
        /// <returns>ActivityLibraryDC object</returns>
        public static ActivityLibraryDC ActivityLibraryCreateOrUpdate(ActivityLibraryDC request)
        {
            var reply = new ActivityLibraryDC();
            var status = new StatusReplyDC();
            int retValue = 0;
            Database db = null;
            DbCommand cmd = null;
            string outErrorString = string.Empty;
            try
            {
                db = DatabaseFactory.CreateDatabase();
                cmd = db.GetStoredProcCommand(StoredProcNames.ActivityLibraryCreateOrUpdate);
                db.AddParameter(cmd, "@inCaller", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Incaller);
                db.AddParameter(cmd, "@inCallerVersion", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.IncallerVersion);
                db.AddParameter(cmd, "@InId", DbType.Int32, ParameterDirection.Input, null, DataRowVersion.Default, request.Id);
                db.AddParameter(cmd, "@InGUID", DbType.Guid, ParameterDirection.Input, null, DataRowVersion.Default, request.Guid);
                db.AddParameter(cmd, "@InName", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Name);
                db.AddParameter(cmd, "@InAuthGroup", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.AuthGroupName);
                db.AddParameter(cmd, "@InCategoryGUID", DbType.Guid, ParameterDirection.Input, null, DataRowVersion.Default, request.Category);
                db.AddParameter(cmd, "@InCategoryName", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.CategoryName);
                db.AddParameter(cmd, "@InExecutable", DbType.Binary, ParameterDirection.Input, null, DataRowVersion.Default, request.Executable);
                db.AddParameter(cmd, "@InHasActivities", DbType.Boolean, ParameterDirection.Input, null, DataRowVersion.Default, request.HasActivities);
                db.AddParameter(cmd, "@InDescription", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.Description);
                db.AddParameter(cmd, "@InImportedBy", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.ImportedBy);
                db.AddParameter(cmd, "@InVersionNumber", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.VersionNumber);
                db.AddParameter(cmd, "@InMetaTags", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.MetaTags);
                db.AddParameter(cmd, "@InInsertedByUserAlias", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.InsertedByUserAlias);
                db.AddParameter(cmd, "@InUpdatedByUserAlias", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.UpdatedByUserAlias);
                db.AddParameter(cmd, "@InFriendlyName", DbType.String, ParameterDirection.Input, null,
                                DataRowVersion.Default, request.FriendlyName);
                db.AddParameter(cmd, "@InReleaseNotes", DbType.String, ParameterDirection.Input, null,
                               DataRowVersion.Default, request.ReleaseNotes);
                db.AddParameter(cmd, "@inStatusName", DbType.String, ParameterDirection.Input, null, DataRowVersion.Default, request.StatusName);
                db.AddParameter(cmd, "@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue, null, DataRowVersion.Default, 0);
                db.AddOutParameter(cmd, "@outErrorString", DbType.String, 300);

                db.ExecuteScalar(cmd);
                retValue = Convert.ToInt32(cmd.Parameters["@ReturnValue"].Value);
                outErrorString = Convert.ToString(cmd.Parameters["@outErrorString"].Value);
                if (retValue != 0)
                {
                    status.ErrorMessage = outErrorString;
                    status.Errorcode = retValue;
                    Logging.Log(retValue,
                                EventLogEntryType.Error,
                                SprocValues.ACTIVITY_LIBRARY_CREATE_OR_UPDATE_CALL_ERROR_MSG,
                                outErrorString);
                }
            }
            catch (Exception ex)
            {
                status.ErrorMessage = SprocValues.ACTIVITY_LIBRARY_CREATE_OR_UPDATE_CALL_ERROR_MSG + ex.Message;
                status.Errorcode = SprocValues.GENERIC_CATCH_ID;
                Logging.Log(SprocValues.GENERIC_CATCH_ID,
                            EventLogEntryType.Error,
                            SprocValues.ACTIVITY_LIBRARY_CREATE_OR_UPDATE_CALL_ERROR_MSG,
                            ex);
            }

            reply.StatusReply = status;
            return reply;
        }
Exemplo n.º 27
0
        /// <summary>
        /// Verify GET FROM etblActivityLibraries Table for valid name and version
        /// </summary>
        /// <param name="name">name of row to do a get on</param>
        /// <param name="version">version of name to do a get on</param>
        private void VerifyGetActivityLibrariesForValidNameAndVersion(string name, string version)
        {
            getRequest = new ActivityLibraryDC();
            getReplyList = new List<ActivityLibraryDC>();

            VerifyGetForValidNameAndVersion(name, version, getRequest, getReplyList);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Gets the Workflow Template Activity Item based on the Selected Workflow Template, and its dependencies
        /// </summary>
        /// <returns>The Activity Item that will have the XAML required to create the workflow from the specified Workflow Template</returns>
        private WorkflowItem GetWorkflowTemplateActivityExecute(IWorkflowsQueryService client)
        {
            WorkflowItem workflowActivityTemplateItem = null;
            List<StoreActivitiesDC> storeActivitiesList = null;
            ActivityAssemblyItem workflowActivityTemplateItemAssembly = null;
            StoreActivitiesDC targetDC = null;
            ActivityLibraryDC targetLibrary = null;
            List<ActivityLibraryDC> activityLibraryList;

            // Throw if nothing selected. CanExecute should prevent this.
            if (null == SelectedWorkflowTemplateItem)
                throw new ArgumentNullException();
            // Create the Activity request
            var requestActivity = new StoreActivitiesDC()
                                                    {
                                                        Incaller = Assembly.GetExecutingAssembly().GetName().Name,
                                                        IncallerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                        Id = SelectedWorkflowTemplateItem.WorkflowTemplateId
                                                    };

            // Get the List of Activities that qualify, should only be one
            storeActivitiesList = client.StoreActivitiesGet(requestActivity);
            storeActivitiesList[0].StatusReply.CheckErrors();
            if (null != storeActivitiesList)
            {
                // Get the first or one and only StoreActivity
                targetDC = storeActivitiesList.First();
                // We have to get the Activity Library associated with the Store Activity
                if (0 != targetDC.ActivityLibraryId)
                {
                    List<ActivityAssemblyItem> references = new List<ActivityAssemblyItem>();
                    Utility.DoTaskWithBusyCaption("Loading...",() =>
                    {
                        // Create the Library request
                        var requestLibrary = new ActivityLibraryDC
                        {
                            Incaller = Assembly.GetExecutingAssembly().GetName().Name,
                            IncallerVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                            Id = targetDC.ActivityLibraryId
                        };
                        // Get the list
                        try
                        {
                            activityLibraryList = client.ActivityLibraryGet(requestLibrary);
                        }

                        catch (FaultException<ServiceFault> ex)
                        {
                            throw new CommunicationException(ex.Detail.ErrorMessage);
                        }
                        catch (FaultException<ValidationFault> ex)
                        {
                            throw new BusinessValidationException(ex.Detail.ErrorMessage);
                        }
                        catch (Exception ex)
                        {
                            throw new CommunicationException(ex.Message);
                        }

                        // Get the First one or null, should only be one
                        targetLibrary = activityLibraryList.FirstOrDefault();
                        workflowActivityTemplateItemAssembly = DataContractTranslator.ActivityLibraryDCToActivityAssemblyItem(targetLibrary);

                        // download dependencies
                        references = Caching.CacheAndDownloadAssembly(client, Caching.ComputeDependencies(client, workflowActivityTemplateItemAssembly));
                    });

                    workflowActivityTemplateItem = DataContractTranslator.StoreActivitiyDCToWorkflowItem(targetDC, workflowActivityTemplateItemAssembly, references);
                    workflowActivityTemplateItem.WorkflowType = SelectedWorkflowTemplateItem.WorkflowTypeName;
                    workflowActivityTemplateItem.IsOpenFromServer = false;
                }
            }
            return workflowActivityTemplateItem;   // Return the ActivityItem
        }
Exemplo n.º 29
0
        /// <summary>
        /// The activity library dc to activity assembly item.
        /// </summary>
        /// <param name="activityLibraryDC">
        /// The activity library dc.
        /// </param>
        /// <param name="assemblyReferences">
        /// Referenced assemblies for this ActivityLibraryDC. Use this parameter when you are actually downloading the library
        /// to cache and use, vs. just displaying it in a Select screen. It would be great if this info were actually part of
        /// ActivityLibraryDC but it isn't so we have to collect it separately.
        /// </param>
        /// <returns>
        /// Converted ActivityAssemblyItem instance
        /// </returns>
        public static ActivityAssemblyItem ActivityLibraryDCToActivityAssemblyItem(ActivityLibraryDC activityLibraryDC,
            IEnumerable<AssemblyName> assemblyReferences = null)
        {
            var activityAssemblyItem = new ActivityAssemblyItem();
            Version version;

            activityAssemblyItem.ActivityItems = new ObservableCollection<ActivityItem>();
            activityAssemblyItem.Assembly = null;
            activityAssemblyItem.AssemblyName = new AssemblyName(activityLibraryDC.Name);
            System.Version.TryParse(activityLibraryDC.VersionNumber, out version);
            activityAssemblyItem.Version = version;
            activityAssemblyItem.AuthorityGroup = activityLibraryDC.AuthGroupName;
            activityAssemblyItem.CachingStatus = CachingStatus.None;
            activityAssemblyItem.Category = activityLibraryDC.CategoryName;

            activityAssemblyItem.Description = activityLibraryDC.Description;
            activityAssemblyItem.DisplayName = activityLibraryDC.Name;
            activityAssemblyItem.Status = activityLibraryDC.StatusName;
            activityAssemblyItem.Tags = activityLibraryDC.MetaTags;

            if (assemblyReferences != null)
            {
                activityAssemblyItem.SetDatabaseReferences(assemblyReferences);
            }

            activityAssemblyItem.UserSelected = false;
            activityAssemblyItem.ReleaseNotes = activityLibraryDC.ReleaseNotes;
            activityAssemblyItem.FriendlyName = activityLibraryDC.FriendlyName;

            return activityAssemblyItem;
        }
Exemplo n.º 30
0
        public void TESTBalUploadActivityLibraryAndDependentActivitiesAndUpdateVersionAndSaveStoreActivitiesFailed()
        {
            //var nameModifier = Guid.NewGuid().ToString();
            CWF.DataContracts.StoreLibraryAndActivitiesRequestDC request = new CWF.DataContracts.StoreLibraryAndActivitiesRequestDC();
            List<CWF.DataContracts.StoreActivitiesDC> reply = null;

            request.IncallerVersion = INCALLERVERSION;
            request.Incaller = INCALLER;
            request.InInsertedByUserAlias = INCALLER;
            request.InUpdatedByUserAlias = INCALLER;
            request.EnforceVersionRules = false;

            // Create ActivityLibrary object and add to request object
            CWF.DataContracts.ActivityLibraryDC activityLibraryDC = new CWF.DataContracts.ActivityLibraryDC();

            // create storeActivitiesDC list and individual objects and add to request
            List<CWF.DataContracts.StoreActivitiesDC> storeActivitiesDCList = new List<CWF.DataContracts.StoreActivitiesDC>();
            CWF.DataContracts.StoreActivitiesDC storeActivitiesDC = new CWF.DataContracts.StoreActivitiesDC();
            CreateActivityLibraryAndStoreActivities(out activityLibraryDC, out storeActivitiesDCList);
            request.ActivityLibrary = activityLibraryDC;
            request.StoreActivitiesList = new List<StoreActivitiesDC> { CreateSA(string.Empty, string.Empty, new Guid(), activityLibraryDC.Name, activityLibraryDC.VersionNumber) };

            request.StoreActivityLibraryDependenciesGroupsRequestDC = new StoreActivityLibraryDependenciesGroupsRequestDC()
            {
                Name = activityLibraryDC.Name,
                Version = activityLibraryDC.VersionNumber,
                List = new List<StoreActivityLibraryDependenciesGroupsRequestDC>
                {
                    new StoreActivityLibraryDependenciesGroupsRequestDC
                    {
                        IncallerVersion = INCALLERVERSION,
                        Incaller = INCALLER,
                        Name = "PublishingInfo",
                        Version = "1.0.0.1"
                    },
                }
            };

            try
            {
                reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);
            }
            catch (Exception ex)
            {
                string faultMessage = ex.Message;
                Assert.Fail(faultMessage + "-catch (Exception ex) on reply = CWF.BAL.Services.UploadActivityLibraryAndDependentActivities(request);");
            }
            Assert.IsNotNull(reply);
            Assert.AreEqual(reply[0].StatusReply.Errorcode, 55106);
        }