Esempio n. 1
0
 /// <summary>
 /// Creates instance of the <see cref="Action"></see> class with properties initialized with specified parameters.
 /// </summary>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="Action"/>.</param>
 protected Action(Return returnType, When when, Step step, Condition condition)
 {
     Return = returnType;
     Step = step;
     When = when;
     Condition = condition;
 }
        private static ScenarioStep ConvertToCompatibleStep(SpecFlowStep step)
        {
            ScenarioStep result = null;
            if (step.StepKeyword == StepKeyword.Given)
                result = new Given {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.When)
                result = new When {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.Then)
                result = new Then {StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.And)
                result = new And { StepKeyword = step.StepKeyword };
            else if (step.StepKeyword == StepKeyword.But)
                result = new But {StepKeyword = step.StepKeyword };

            if (result == null)
                throw new NotSupportedException();

            result.Keyword = step.Keyword;
            result.Text = step.Text;
            result.ScenarioBlock = step.ScenarioBlock;
            result.MultiLineTextArgument = step.Argument is global::Gherkin.Ast.DocString ? ((global::Gherkin.Ast.DocString) step.Argument).Content : null;
            result.TableArg = step.Argument is global::Gherkin.Ast.DataTable ? ConvertToCompatibleTable(((global::Gherkin.Ast.DataTable) step.Argument).Rows) : null;
            result.FilePosition = ConvertToCompatibleFilePosition(step.Location);

            return result;
        }
            public bool StringSet(FileBasedKey key, FileBasedValue value, TimeSpan? expiry, When when)
            {
                if (ContainsKey(key) && when == When.NotExists)
                    return false;

                if (expiry.HasValue)
                    value = new FileBasedValueWithExpiry(value, DateTime.Now, expiry);

                this[key] = value;

                return true;
            }
Esempio n. 4
0
 private ShowProcessingOutput(string serialized)
 {
     this.Shown = When.Never;
     this.BiggerThanThisBytes = 0L;
     if (!string.IsNullOrEmpty(serialized))
     {
         serialized = serialized.Trim();
         if (serialized.EndsWith("a", StringComparison.OrdinalIgnoreCase))
         {
             this.AutocloseOnSuccess = true;
             serialized = (serialized.Length == 1) ? "" : serialized.Substring(0, serialized.Length - 1);
         }
         if (serialized == "-1")
         {
             this.Shown = When.Always;
         }
         else
         {
             Match m = Regex.Match(serialized, @"^\s*(?<num>[1-9]\d*)\s*(?<unit>B|KB|MB|GB)\s*$", RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
             if (m.Success)
             {
                 this.Shown = When.BiggerThan;
                 this.BiggerThanThisBytes = UInt64.Parse(m.Groups["num"].Value);
                 switch (m.Groups["unit"].Value.ToUpperInvariant())
                 {
                     case "KB":
                         this.BiggerThanThisBytes = this.BiggerThanThisBytes << 10;
                         break;
                     case "MB":
                         this.BiggerThanThisBytes = this.BiggerThanThisBytes << 20;
                         break;
                     case "GB":
                         this.BiggerThanThisBytes = this.BiggerThanThisBytes << 30;
                         break;
                 }
             }
         }
     }
 }
 public ImmutableFacetAnnotation(When value, IFacetHolder holder)
     : base(value, holder) {}
Esempio n. 6
0
 public Task <long> ListLeftPushAsync(RedisKey key, RedisValue[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.ListLeftPushAsync(ToInner(key), values, when, flags));
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 public BinaryFileAction(string key, string args, Return returnType, When when, Step step, Condition condition)
     : base(returnType, when, step, condition)
 {
     Key = key;
     Args = args;
     Name = "Action" + (++count) + "_" + key;
 }
 public Task <bool> AddAsync(T member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None) => Wrapper.Database.SortedSetAddAsync(_realKey, Wrapper.Wrap(member), score, when, flags);
Esempio n. 9
0
 /// <summary>
 /// Creates instance of the <see cref="Action"></see> class with properties initialized with specified parameters.
 /// </summary>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="Action"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 protected Action(Return returnType, When when, Step step, Condition condition, Sequence sequence)
 {
     Sequence = sequence;
     Return = returnType;
     Step = step;
     When = when;
     Condition = condition;
 }
Esempio n. 10
0
 public bool HashSet(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.HashSet(ToInner(key), hashField, value, when, flags));
 }
 public HiddenFacetImpl(When when, IFacetHolder holder)
     : base(when, holder) {}
Esempio n. 12
0
 public bool StringSet(KeyValuePair <RedisKey, RedisValue>[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.StringSet(ToInner(values), when, flags));
 }
Esempio n. 13
0
 public bool StringSet(RedisKey key, RedisValue value, TimeSpan?expiry = null, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.StringSet(ToInner(key), value, expiry, when, flags));
 }
Esempio n. 14
0
 public long ListRightPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.ListRightPush(ToInner(key), value, when, flags));
 }
Esempio n. 15
0
 public bool KeyRename(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.KeyRename(ToInner(key), ToInner(newKey), when, flags));
 }
 public Task <long> AddAsync(SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None) => Wrapper.Database.SortedSetAddAsync(_realKey, values, when, flags);
		/// <summary>
		/// When a action ( e.g. a click ) on the declaired element occures. We will wait for these elements until they have the desired visibility.
		/// </summary>
		/// <param name="when">Wait before or after the action.</param>
		/// <param name="waitForPageElementWithName">The memberName of the page element. E.g. type 'Availabilitybutton' for pageObject.Availabilitybutton with the Id 'AvailButton'.</param>
		/// <param name="visibility">The desired visibility for the object we wait for.</param>
		internal WaitForElementsOnActionAttribute(When when, string waitForPageElementWithName, Visibility visibility)
		{
			When = when;
			WaitForPageElementWithName = waitForPageElementWithName;
			Visibility = visibility;
		}
Esempio n. 18
0
 public async Task <bool> HashInsertAsync(string key, string property, string propertyValue, When when, CommandFlags flags)
 {
     return(await _database.HashSetAsync(key, property, propertyValue, when : when, flags : flags));
 }
Esempio n. 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly 
 /// is in the Wix# script.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 public ElevatedManagedAction(string name, string actionAssembly, Return returnType, When when, Step step, Condition condition)
     : base(name, actionAssembly, returnType, when, step, condition)
 {
     Impersonate = false;
     Execute = Execute.deferred;
 }
Esempio n. 20
0
        public void open_persisted_stream_in_new_store_with_same_settings(DocumentTracking sessionType, TenancyStyle tenancyStyle, string[] tenants)
        {
            var store   = InitStore(tenancyStyle);
            var questId = Guid.NewGuid();

            When.CalledForEach(tenants, (tenantId, index) =>
            {
                using (var session = store.OpenSession(tenantId, sessionType))
                {
                    //Note "Id = questId" @see live_aggregate_equals_inlined_aggregate...
                    var started = new QuestStarted {
                        Id = questId, Name = "Destroy the One Ring"
                    };
                    var joined1 = new MembersJoined(1, "Hobbiton", "Frodo", "Merry");

                    session.Events.StartStream <Quest>(questId, started, joined1);
                    session.SaveChanges();
                }

                // events-aggregate-on-the-fly - works with same store
                using (var session = store.OpenSession(tenantId, sessionType))
                {
                    // questId is the id of the stream
                    var party = session.Events.AggregateStream <QuestParty>(questId);

                    party.Id.ShouldBe(questId);
                    party.ShouldNotBeNull();

                    var party_at_version_3 = session.Events
                                             .AggregateStream <QuestParty>(questId, 3);

                    party_at_version_3.ShouldNotBeNull();

                    var party_yesterday = session.Events
                                          .AggregateStream <QuestParty>(questId, timestamp: DateTime.UtcNow.AddDays(-1));
                    party_yesterday.ShouldNotBeNull();
                }

                using (var session = store.OpenSession(tenantId, sessionType))
                {
                    var party = session.Load <QuestParty>(questId);
                    party.Id.ShouldBe(questId);
                }

                var newStore = InitStore(tenancyStyle, false);

                //Inline is working
                using (var session = store.OpenSession(tenantId, sessionType))
                {
                    var party = session.Load <QuestParty>(questId);
                    party.ShouldNotBeNull();
                }
                //GetAll
                using (var session = store.OpenSession(tenantId, sessionType))
                {
                    var parties = session.Events.QueryRawEventDataOnly <QuestParty>().ToArray();
                    foreach (var party in parties)
                    {
                        party.ShouldNotBeNull();
                    }
                }
                //This AggregateStream fail with NPE
                using (var session = newStore.OpenSession(tenantId, sessionType))
                {
                    // questId is the id of the stream
                    var party = session.Events.AggregateStream <QuestParty>(questId);//Here we get NPE
                    party.Id.ShouldBe(questId);

                    var party_at_version_3 = session.Events
                                             .AggregateStream <QuestParty>(questId, 3);
                    party_at_version_3.Id.ShouldBe(questId);

                    var party_yesterday = session.Events
                                          .AggregateStream <QuestParty>(questId, timestamp: DateTime.UtcNow.AddDays(-1));
                    party_yesterday.Id.ShouldBe(questId);
                }
            }).ShouldThrowIf(
                (tenancyStyle == TenancyStyle.Single && tenants.Length > 1) || (tenancyStyle == TenancyStyle.Conjoined && tenants.SequenceEqual(SameTenants))
                );
        }
Esempio n. 21
0
        public ScenarioStep CreateStep(string keyword, StepKeyword stepKeyword, string text, FilePosition position, ScenarioBlock scenarioBlock)
        {
            ScenarioStep step;
            switch (stepKeyword)
            {
                case StepKeyword.Given:
                    step = new Given();
                    break;
                case StepKeyword.When:
                    step = new When();
                    break;
                case StepKeyword.Then:
                    step = new Then();
                    break;
                case StepKeyword.And:
                    step = new And();
                    break;
                case StepKeyword.But:
                    step = new But();
                    break;
                default:
                    throw new NotSupportedException();
            }

            step.Keyword = keyword;
            step.Text = text;
            step.FilePosition = position;
            step.ScenarioBlock = scenarioBlock;
            step.StepKeyword = stepKeyword;
            return step;
        }
 public Task <bool> KeyRenameAsync(RedisKey key, RedisKey newKey, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(this.Inner.KeyRenameAsync(this.ToInner(key), this.ToInner(newKey), when, flags));
 }
Esempio n. 23
0
 public Task <long> SortedSetAddAsync(RedisKey key, SortedSetEntry[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.SortedSetAddAsync(ToInner(key), values, when, flags));
 }
 public Task <long> ListRightPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(this.Inner.ListRightPushAsync(this.ToInner(key), value, when, flags));
 }
Esempio n. 25
0
 public WhenSemantics When(When when)
 {
     return When(metadataParser.TranslateToText(when), () => { when(); });
 }
 public Task <bool> StringSetAsync(KeyValuePair <RedisKey, RedisValue>[] values, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(this.Inner.StringSetAsync(this.ToInner(values), when, flags));
 }
Esempio n. 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstalledFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="InstalledFileAction"/> instance.</param>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="InstalledFileAction"/>.</param>
 public InstalledFileAction(Id id, string key, string args, Return returnType, When when, Step step, Condition condition)
     : base(id, returnType, when, step, condition)
 {
     Key = key;
     Args = args;
     Name = "Action" + (++count) + "_" + key;
 }
 public Task <bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan?expiry = null, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(this.Inner.StringSetAsync(this.ToInner(key), value, expiry, when, flags));
 }
        private ScenarioStep CloneTo(ScenarioStep step, string currentBlock)
        {
            ScenarioStep newStep = null;
            if (currentBlock == "When")
                newStep = new When();
            else if (currentBlock == "Then")
                newStep = new Then();
            else // Given or empty
                newStep = new Given();

            Debug.Assert(newStep != null);

            newStep.Text = step.Text;
            newStep.MultiLineTextArgument = step.MultiLineTextArgument;
            newStep.TableArg = Clone(step.TableArg);
            return newStep;
        }
 public Task <bool> HashSetAsync(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(this.Inner.HashSetAsync(this.ToInner(key), hashField, value, when, flags));
 }
Esempio n. 31
0
 protected virtual When VisitWhen(When when)
 {
     var newCondition = Visit(when.Condition);
     var newValue = Visit(when.Value);
     if (when.Condition != newCondition || newValue != when.Value)
         return new When(newCondition, newValue);
     return when;
 }
Esempio n. 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomActionRef" /> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="when">The When.</param>
 /// <param name="step">The Step.</param>
 public CustomActionRef(string id, When when, Step step)
     : base(new Id(id))
 {
     When = when;
     Step = step;
 }
    // $ANTLR end "steps"


    // $ANTLR start "step"
    // SpecFlowLangWalker.g:156:1: step returns [ScenarioStep step] : ( ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) );
    public ScenarioStep step() // throws RecognitionException [1]
    {   
        ScenarioStep step = default(ScenarioStep);

        Text text_ = default(Text);

        MultilineText mlt_ = default(MultilineText);

        Table table_ = default(Table);

        FilePosition fp_ = default(FilePosition);


        try 
    	{
            // SpecFlowLangWalker.g:160:5: ( ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) | ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition ) )
            int alt24 = 5;
            switch ( input.LA(1) ) 
            {
            case GIVEN:
            	{
                alt24 = 1;
                }
                break;
            case WHEN:
            	{
                alt24 = 2;
                }
                break;
            case THEN:
            	{
                alt24 = 3;
                }
                break;
            case AND:
            	{
                alt24 = 4;
                }
                break;
            case BUT:
            	{
                alt24 = 5;
                }
                break;
            	default:
            	    NoViableAltException nvae_d24s0 =
            	        new NoViableAltException("", 24, 0, input);

            	    throw nvae_d24s0;
            }

            switch (alt24) 
            {
                case 1 :
                    // SpecFlowLangWalker.g:160:9: ^( GIVEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,GIVEN,FOLLOW_GIVEN_in_step1055); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1071);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:162:17: (mlt_= multilineText )?
                    	int alt14 = 2;
                    	int LA14_0 = input.LA(1);

                    	if ( (LA14_0 == MULTILINETEXT) )
                    	{
                    	    alt14 = 1;
                    	}
                    	switch (alt14) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:162:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1087);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:163:19: (table_= table )?
                    	int alt15 = 2;
                    	int LA15_0 = input.LA(1);

                    	if ( (LA15_0 == TABLE) )
                    	{
                    	    alt15 = 1;
                    	}
                    	switch (alt15) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:163:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1104);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1121);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new Given(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 2 :
                    // SpecFlowLangWalker.g:169:9: ^( WHEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,WHEN,FOLLOW_WHEN_in_step1152); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1168);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:171:17: (mlt_= multilineText )?
                    	int alt16 = 2;
                    	int LA16_0 = input.LA(1);

                    	if ( (LA16_0 == MULTILINETEXT) )
                    	{
                    	    alt16 = 1;
                    	}
                    	switch (alt16) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:171:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1184);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:172:19: (table_= table )?
                    	int alt17 = 2;
                    	int LA17_0 = input.LA(1);

                    	if ( (LA17_0 == TABLE) )
                    	{
                    	    alt17 = 1;
                    	}
                    	switch (alt17) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:172:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1201);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1218);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new When(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 3 :
                    // SpecFlowLangWalker.g:178:9: ^( THEN text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,THEN,FOLLOW_THEN_in_step1249); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1265);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:180:17: (mlt_= multilineText )?
                    	int alt18 = 2;
                    	int LA18_0 = input.LA(1);

                    	if ( (LA18_0 == MULTILINETEXT) )
                    	{
                    	    alt18 = 1;
                    	}
                    	switch (alt18) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:180:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1281);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:181:19: (table_= table )?
                    	int alt19 = 2;
                    	int LA19_0 = input.LA(1);

                    	if ( (LA19_0 == TABLE) )
                    	{
                    	    alt19 = 1;
                    	}
                    	switch (alt19) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:181:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1298);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1315);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new Then(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 4 :
                    // SpecFlowLangWalker.g:187:9: ^( AND text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,AND,FOLLOW_AND_in_step1346); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1362);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:189:17: (mlt_= multilineText )?
                    	int alt20 = 2;
                    	int LA20_0 = input.LA(1);

                    	if ( (LA20_0 == MULTILINETEXT) )
                    	{
                    	    alt20 = 1;
                    	}
                    	switch (alt20) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:189:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1378);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:190:19: (table_= table )?
                    	int alt21 = 2;
                    	int LA21_0 = input.LA(1);

                    	if ( (LA21_0 == TABLE) )
                    	{
                    	    alt21 = 1;
                    	}
                    	switch (alt21) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:190:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1395);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1412);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new And(text_, mlt_, table_);
                    	        

                    }
                    break;
                case 5 :
                    // SpecFlowLangWalker.g:196:9: ^( BUT text_= text (mlt_= multilineText )? (table_= table )? fp_= fileposition )
                    {
                    	Match(input,BUT,FOLLOW_BUT_in_step1443); 

                    	Match(input, Token.DOWN, null); 
                    	PushFollow(FOLLOW_text_in_step1459);
                    	text_ = text();
                    	state.followingStackPointer--;

                    	// SpecFlowLangWalker.g:198:17: (mlt_= multilineText )?
                    	int alt22 = 2;
                    	int LA22_0 = input.LA(1);

                    	if ( (LA22_0 == MULTILINETEXT) )
                    	{
                    	    alt22 = 1;
                    	}
                    	switch (alt22) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:198:17: mlt_= multilineText
                    	        {
                    	        	PushFollow(FOLLOW_multilineText_in_step1475);
                    	        	mlt_ = multilineText();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	// SpecFlowLangWalker.g:199:19: (table_= table )?
                    	int alt23 = 2;
                    	int LA23_0 = input.LA(1);

                    	if ( (LA23_0 == TABLE) )
                    	{
                    	    alt23 = 1;
                    	}
                    	switch (alt23) 
                    	{
                    	    case 1 :
                    	        // SpecFlowLangWalker.g:199:19: table_= table
                    	        {
                    	        	PushFollow(FOLLOW_table_in_step1492);
                    	        	table_ = table();
                    	        	state.followingStackPointer--;


                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_fileposition_in_step1509);
                    	fp_ = fileposition();
                    	state.followingStackPointer--;


                    	Match(input, Token.UP, null); 

                    				step =  new But(text_, mlt_, table_);
                    	        

                    }
                    break;

            }

                step.FilePosition = fp_;

        }
        catch (RecognitionException re) 
    	{
            ReportError(re);
            Recover(input,re);
        }
        finally 
    	{
        }
        return step;
    }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomActionRef" /> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="when">The When.</param>
 /// <param name="step">The Step.</param>
 public CustomActionRef(Id id, When when, Step step)
     : base(id)
 {
     When = when;
     Step = step;
 }
Esempio n. 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 public ElevatedManagedAction(string name, Return returnType, When when, Step step, Condition condition)
     : base(name, returnType, when, step, condition)
 {
     Impersonate = false;
     Execute = Execute.deferred;
     UsesProperties = "INSTALLDIR";
 }
Esempio n. 36
0
 /// <summary>
 /// Sets a string in redis to a particular value and returns whether or not the string was updated.
 /// </summary>
 public Task <bool> StringSetAsync(Context context, string stringKey, RedisValue redisValue, TimeSpan?expiry, When when, CancellationToken cancellationToken)
 {
     using (Counters[RedisOperation.All].Start())
         using (Counters[RedisOperation.StringSet].Start())
         {
             return(_redisRetryStrategy.ExecuteAsync(
                        async() =>
             {
                 var database = await GetDatabaseAsync(context);
                 return await database.StringSetAsync(stringKey, redisValue, expiry, when);
             }, cancellationToken));
         }
 }
Esempio n. 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ElevatedManagedAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="ElevatedManagedAction"/> instance.</param>
 /// <param name="name">Name of the CustomAction. The name should match the method implementing the custom action functionality.</param>
 /// <param name="actionAssembly">Path to the assembly containing the CustomAction implementation. Specify <c>"%this%"</c> if the assembly 
 /// is in the Wix# script.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="ManagedAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public ElevatedManagedAction(Id id, string name, string actionAssembly, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, name, actionAssembly, returnType, when, step, condition, sequence)
 {
     Impersonate = false;
     Execute = Execute.deferred;
     UsesProperties = "INSTALLDIR";
 }
Esempio n. 38
0
 public Task <bool> StringSetAsync(Context context, string stringKey, RedisValue redisValue, TimeSpan?expiry, When when, CancellationToken cancellationToken)
 => PerformDatabaseOperationAsync(context, db => db.StringSetAsync(stringKey, redisValue, expiry, when), Counters[RedisOperation.StringSet], cancellationToken);
 public DisabledFacetAnnotation(When value, IFacetHolder holder)
     : base(value, holder) {}
Esempio n. 40
0
 public Task <bool> SetHashValueAsync(Context context, RedisKey key, RedisValue hashField, RedisValue value, When when, CancellationToken token)
 => PerformDatabaseOperationAsync(context, db => db.HashSetAsync(key, hashField, value, when), Counters[RedisOperation.HashSetValue], token);
 protected DisabledFacetAbstract(When when, IFacetHolder holder)
     : base(Type, holder, when) {}
Esempio n. 42
0
 public override string ToString()
 {
     return(string.Join(";", When.ToUniversalTime().ToString("u"), "r", ChangeId, string.Join(",", Filenames), Reviewer, ActivityId));
 }
 protected HiddenFacetAbstract(When when, IFacetHolder holder)
     : base(Type, holder, when) {}
 public void Setup()
 {
     When.ExecutingThumbnailCommand();
 }
Esempio n. 45
0
        public void AddCondition(When when)
        {
            if (IsFallbackDefined) {
                throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                    "The <otherwise> element must be defined as the last nested"
                    + " element in the <{0} ... /> task.", Name), Location);
            }

            _elementContainers.Add(when);
        }
Esempio n. 46
0
 /// <summary>
 /// Executes a new instance of the <see cref="QtCmdLineAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="QtCmdLineAction"/> instance.</param>
 /// <param name="appPath">Path to the application to be executed. This can be a file name only if the location of the application is well-known.</param>
 /// <param name="args">The arguments to be passed to the application during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="QtCmdLineAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public QtCmdLineAction(Id id, string appPath, string args, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     AppPath = appPath;
     Args = args;
     Name = "Action" + (++count) + "_QtCmdLine_" + IO.Path.GetFileName(appPath);
 }
Esempio n. 47
0
 /// <summary>
 /// Creates instance of the <see cref="Action"></see> class with properties initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="Action"/> instance.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="Action"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 protected Action(Id id, Return returnType, When when, Step step, Condition condition, Sequence sequence)
 {
     Id = id.Value;
     Sequence = sequence;
     Return = returnType;
     Step = step;
     When = when;
     Condition = condition;
 }
Esempio n. 48
0
        private Boolean SetValue(String key, Object value, TimeSpan? expiration = null, When condition = When.Always)
        {
            if (key == null) throw new ArgumentNullException("key");
            if (value == null) throw new ArgumentNullException("value");

            return Database.StringSet(key, _Serializer.Serialize(value), expiration, condition);
        }
 public void Setup()
 {
     When.ExecutingListCommand();
 }
Esempio n. 50
0
 public Task <bool> SortedSetAddAsync(RedisKey key, RedisValue member, double score, When when = When.Always, CommandFlags flags = CommandFlags.None)
 {
     return(Inner.SortedSetAddAsync(ToInner(key), member, score, when, flags));
 }
Esempio n. 51
0
        private Boolean SetInternal(String key, Object value, CacheItemPolicy policy, When condition = When.Always)
        {
            var result = SetValue(key, value, GetPolicyExpiration(policy), condition); // TODO: (DG) Is this thread-safe?
            if (result)
            {
                ConfigureSlidingExpiration(key, policy);
            }

            return result;
        }
 public void Setup()
 {
     When.ExecutingSplitCommand();
 }
Esempio n. 53
0
 protected override When VisitWhen(When when)
 {
     var newCondition = MakeSqlCondition(Visit(when.Condition));
     var newValue = MakeSqlValue(Visit(when.Value));
     if (when.Condition != newCondition || newValue != when.Value)
         return new When(newCondition, newValue);
     return when;
 }
        private bool SetValueCore(string key, object value, TimeSpan duration, bool requiredNotExists = false)
        {
            if (string.IsNullOrWhiteSpace(key))
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (value == null)
            {
                return(this.Database.KeyDelete(key));
            }

            if (value is RedisObjectBase)
            {
                return(true);
            }

            if (requiredNotExists && this.Database.KeyExists(key))
            {
                return(false);
            }

            When condition = requiredNotExists ? When.NotExists : When.Always;

            Action <IBatch> complete = batch =>
            {
                if (duration > TimeSpan.Zero)
                {
                    batch.KeyExpireAsync(key, duration);
                }
            };

            var set = value as ISet <string>;

            if (set != null)
            {
                return(this.Database.SetAdd(key, set.Select(p => (RedisValue)p).ToArray()) > 0);
            }

            if (this.Batch <DictionaryEntry>(value as IDictionary,
                                             (batch, entry) =>
            {
                if (entry.Key != null)
                {
                    if (entry.Value == null)
                    {
                        batch.HashDeleteAsync(key, entry.Key.ToString());
                    }
                    else
                    {
                        batch.HashSetAsync(key, entry.Key.ToString(), Utility.GetStoredValue(entry.Value), condition);
                    }
                }
            }, complete) ||
                this.Batch <KeyValuePair <string, string> >(value as IDictionary <string, string>,
                                                            (batch, entry) =>
            {
                if (entry.Key != null)
                {
                    if (entry.Value == null)
                    {
                        batch.HashDeleteAsync(key, entry.Key);
                    }
                    else
                    {
                        batch.HashSetAsync(key, entry.Key, entry.Value, condition);
                    }
                }
            }, complete) ||
                this.Batch <KeyValuePair <string, object> >(value as IDictionary <string, object>,
                                                            (batch, entry) =>
            {
                if (entry.Key != null)
                {
                    if (entry.Value == null)
                    {
                        batch.HashDeleteAsync(key, entry.Key);
                    }
                    else
                    {
                        batch.HashSetAsync(key, entry.Key, Utility.GetStoredValue(entry.Value), condition);
                    }
                }
            }, complete) ||
                this.Batch <object>(value as Zongsoft.Collections.IQueue,
                                    (batch, item) =>
            {
                if (item != null)
                {
                    batch.ListRightPushAsync(key, Utility.GetStoredValue(item), condition);
                }
            }, complete))
            {
                return(true);
            }

            if (duration > TimeSpan.Zero)
            {
                return(this.Database.StringSet(key, value.ToString(), duration, condition));
            }
            else
            {
                return(this.Database.StringSet(key, value.ToString(), null, condition));
            }
        }
Esempio n. 55
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BinaryFileAction"/> class with properties/fields initialized with specified parameters.
 /// </summary>
 /// <param name="id">The explicit <see cref="Id"></see> to be associated with <see cref="BinaryFileAction"/> instance.</param>
 /// <param name="key">The key (file name) of the installed file to be executed.</param>
 /// <param name="args">The arguments to be passed to the file during the execution.</param>
 /// <param name="returnType">The return type of the action.</param>
 /// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
 /// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
 /// <param name="condition">The launch condition for the <see cref="BinaryFileAction"/>.</param>
 /// <param name="sequence">The MSI sequence the action belongs to.</param>
 public BinaryFileAction(Id id, string key, string args, Return returnType, When when, Step step, Condition condition, Sequence sequence)
     : base(id, returnType, when, step, condition, sequence)
 {
     Key = key;
     Args = args;
     Name = "Action" + (++count) + "_" + key;
 }
        public Task <bool> StringSetAsync(RedisKey key, RedisValue value, When condition)
        {
            var database = GetDatabase();

            return(database.StringSetAsync(key, value, null, condition));
        }
        private ScenarioStep Clone(ScenarioStep step)
        {
            ScenarioStep newStep = null;
            if (step is Given)
                newStep = new Given();
            else if (step is When)
                newStep = new When();
            else if (step is Then)
                newStep = new Then();
            else if (step is And)
                newStep = new And();
            else if (step is But)
                newStep = new But();

            Debug.Assert(newStep != null);

            newStep.Text = step.Text;
            newStep.MultiLineTextArgument = step.MultiLineTextArgument;
            newStep.TableArg = Clone(step.TableArg);
            return newStep;
        }
        public Task <bool> StringSetAsync(RedisKey key, RedisValue value, TimeSpan?expiryTimespan, When condition)
        {
            var database = GetDatabase();

            return(database.StringSetAsync(key, value, expiryTimespan, condition));
        }
 protected SingleWhenValueFacetAbstract(Type facetType, IFacetHolder holder, When when)
     : base(facetType, holder) {
     this.when = when;
 }
        public Task <bool> HashSetAsync(RedisKey key, RedisValue hashField, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None)
        {
            var database = GetDatabase();

            return(database.HashSetAsync(key, hashField, value, when, flags));
        }