Ejemplo n.º 1
0
        protected void Filter(Func <WorkspaceAttribute, bool> predicate)
        {
            this.Clear();

            foreach (Type t in typeof(Workspaces).Assembly.GetTypes())
            {
                object[] attributes = t.GetCustomAttributes(typeof(WorkspaceAttribute), true);

                if (attributes.Length > 0)
                {
                    WorkspaceAttribute workspaceAttribute = attributes[0] as WorkspaceAttribute;

                    if (predicate != null && !predicate(workspaceAttribute))
                    {
                        continue;
                    }

                    if (AstoriaTestProperties.DataLayerProviderKinds.Contains(workspaceAttribute.DataLayerProviderKind) &&
                        (IgnoreWorkspacePriority || workspaceAttribute.Priority <= AstoriaTestProperties.MaxPriority))
                    {
                        foreach (Workspace w in Construct(t))
                        {
                            this.Add(w);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // Skip workspace creation for service versions older than V2.
            if (!Versioning.Server.SupportsV2Features)
                return false;

            return attribute.Name == "Aruba";
        }
Ejemplo n.º 3
0
        // Filters unsupported workspaces out.
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // Do not create services older than V2.
            if (!Versioning.Server.SupportsV2Features)
                return false;

            return DataLayerProviderKind.Edm == attribute.DataLayerProviderKind && attribute.Name == "PicturesTags";
        }
Ejemplo n.º 4
0
        // Filters unsupported workspaces out.
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // Do not create services older than V2.
            if (!Versioning.Server.SupportsV2Features)
            {
                return(false);
            }

            return(DataLayerProviderKind.Edm == attribute.DataLayerProviderKind && attribute.Name == "PicturesTags");
        }
Ejemplo n.º 5
0
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // Skip workspace creation for service versions older than V2.
            if (!Versioning.Server.SupportsV2Features)
            {
                return(false);
            }

            return(attribute.Name == "Aruba");
        }
Ejemplo n.º 6
0
        internal static Workspaces CreateFilteredWorkspaces(DataLayerProviderKind[] kinds, int maxPriority, bool standardOnly, Action <Workspace> beforeWorkspaceCreate)
        {
            Workspaces workspaces = new Workspaces();
            //Find all workspaces
            List <WorkspaceCreation> workspacesToBeInitialized = new List <WorkspaceCreation>();

            //Filter by Test Property information
            foreach (Type t in typeof(Workspaces).Assembly.GetTypes())
            {
                object[] attributes = t.GetCustomAttributes(typeof(WorkspaceAttribute), true);
                if (attributes.Length > 0)
                {
                    WorkspaceAttribute workspaceAttribute = attributes[0] as WorkspaceAttribute;
                    if (kinds.Contains(workspaceAttribute.DataLayerProviderKind) &&
                        workspaceAttribute.Priority <= maxPriority &&
                        (!standardOnly || workspaceAttribute.Standard))
                    {
                        WorkspaceCreation creationType = new WorkspaceCreation();
                        creationType.WorkspaceAttribute = workspaceAttribute;
                        creationType.WorkspaceType      = t;
                        workspacesToBeInitialized.Add(creationType);
                    }
                }
            }

            //Initialize Workspace types
            foreach (WorkspaceCreation wc in
                     workspacesToBeInitialized)
            // some tests RELY on the arbitrary order of the workspaces
            //.OrderBy(wc => wc.WorkspaceAttribute.DataLayerProviderKind + "." + wc.WorkspaceAttribute.Name))
            {
                if (!wc.WorkspaceType.IsSubclassOf(typeof(Workspace)))
                {
                    //TODO: Should possibly error here
                    continue;
                }
                else
                {
                    Workspace workspace = (Workspace)wc.WorkspaceType.GetConstructor(new Type[] { }).Invoke(new object[] { });
                    workspaces.Add(workspace);
                }
            }



            //Now call create on all workspaces
            foreach (Workspace w in workspaces)
            {
                beforeWorkspaceCreate(w);
                w.Create();
            }

            return(workspaces);
        }
Ejemplo n.º 7
0
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // TODO: need a way to make sure all containers exist

            if (!attribute.Name.Equals("Aruba", StringComparison.InvariantCultureIgnoreCase))
                return false;

            // TODO: allow inmemorylinq once it is working
            if (attribute.DataLayerProviderKind != DataLayerProviderKind.Edm)
                return false;

            return true;
        }
Ejemplo n.º 8
0
        protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
        {
            // TODO: need a way to make sure all containers exist

            if (!attribute.Name.Equals("Aruba", StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            // TODO: allow inmemorylinq once it is working
            if (attribute.DataLayerProviderKind != DataLayerProviderKind.Edm)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
 //---------------------------------------------------------------------
 // Filters unsupported workspaces out.
 //---------------------------------------------------------------------
 protected override bool WorkspacePredicate(WorkspaceAttribute w)
 {
     return(w.Name == "Aruba" && w.DataLayerProviderKind != DataLayerProviderKind.LinqToSql && Versioning.Server.SupportsV2Features);
 }
Ejemplo n.º 10
0
 //---------------------------------------------------------------------
 // Filters unsupported workspaces out.
 //---------------------------------------------------------------------
 protected override bool WorkspacePredicate(WorkspaceAttribute w)
 {
     return w.Name == "Aruba" && w.DataLayerProviderKind != DataLayerProviderKind.LinqToSql && Versioning.Server.SupportsV2Features;
 }
Ejemplo n.º 11
0
 protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
 {
     // only run on standard workspaces
     return attribute.Standard && attribute.Name.Equals("Aruba", StringComparison.InvariantCultureIgnoreCase);
 }
Ejemplo n.º 12
0
 protected bool FilterWorkspaces(WorkspaceAttribute attribute)
 {
     return(!attribute.Name.Contains("PicturesTags"));
 }
Ejemplo n.º 13
0
 protected bool FilterWorkspaces(WorkspaceAttribute attribute)
 {
     return !attribute.Name.Contains("PicturesTags");
 }
Ejemplo n.º 14
0
 protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
 {
     // TODO: need a way to make sure all containers exist
     return true;
 }
Ejemplo n.º 15
0
 protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
 {
     // only run on standard workspaces
     return(attribute.Standard && attribute.Name.Equals("Aruba", StringComparison.InvariantCultureIgnoreCase));
 }
Ejemplo n.º 16
0
 protected virtual bool WorkspacePredicate(WorkspaceAttribute attribute)
 {
     return(true);
 }
Ejemplo n.º 17
0
 protected override bool WorkspacePredicate(WorkspaceAttribute attribute)
 {
     // TODO: need a way to make sure all containers exist
     return(true);
 }