Examples of MatchRulePair


Examples of org.zanata.service.impl.CopyTransWork.MatchRulePair

    public void contentStateWithIgnoreRule() {
        // If the rule is IGNORE, the state should not change no matter what the
        // result is
        for (ContentState state : validTranslatedStates) {
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(true), IGNORE)), true, state
                    ), is(state));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(false), IGNORE)), true, state
                    ), is(state));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(true), IGNORE)), false, state
                    ), is(Translated));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(false), IGNORE)), false, state
                    ), is(Translated));
        }
    }
View Full Code Here

Examples of org.zanata.service.impl.CopyTransWork.MatchRulePair

    public void contentStateWithRejectRule() {
        // If the rule is Reject, then the match should be rejected only when
        // the evaluation fails
        for (ContentState state : validTranslatedStates) {
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(true), REJECT)), true, state
                    ), is(state));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(false), REJECT)), true, state
                    ), is(New));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(true), REJECT)), false, state
                    ), is(Translated));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(false), REJECT)), false, state
                    ), is(New));
        }
    }
View Full Code Here

Examples of org.zanata.service.impl.CopyTransWork.MatchRulePair

    public void contentStateWithDowngradeRule() {
        // If the rule is downgrade, then the match should be downgraded when
        // the evaluation fails
        for (ContentState state : validTranslatedStates) {
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(new MatchRulePair(
                            Suppliers.ofInstance(true), DOWNGRADE_TO_FUZZY)),
                    true, state
                    ), is(state));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(
                            new MatchRulePair(
                                    Suppliers.ofInstance(false),
                                    DOWNGRADE_TO_FUZZY)), true,
                    state
                    ),
                    is(NeedReview));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(
                            new MatchRulePair(
                                    Suppliers.ofInstance(true),
                                    DOWNGRADE_TO_FUZZY)), false,
                    state
                    ),
                    is(Translated));
            assertThat(CopyTransWork.determineContentStateFromRuleList(
                    Lists.newArrayList(
                            new MatchRulePair(
                                    Suppliers.ofInstance(false),
                                    DOWNGRADE_TO_FUZZY)), false,
                    state
                    ),
                    is(NeedReview));
View Full Code Here

Examples of org.zanata.service.impl.CopyTransWork.MatchRulePair

    public void failedRejectionRule() {
        // A single rejection should reject the whole translation no matter what
        // the other rules say
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(
                        new MatchRulePair(Suppliers.ofInstance(false),
                                DOWNGRADE_TO_FUZZY),
                        new MatchRulePair(Suppliers.ofInstance(false),
                                REJECT)
                ),
                true, Translated
                ), is(New));
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(new MatchRulePair(Suppliers.ofInstance(true),
                        IGNORE), new MatchRulePair(Suppliers.ofInstance(false),
                        REJECT)), false, Translated), is(New));

        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(new MatchRulePair(Suppliers.ofInstance(false),
                        REJECT), new MatchRulePair(Suppliers.ofInstance(false),
                        DOWNGRADE_TO_FUZZY)), true, Translated), is(New));
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(new MatchRulePair(Suppliers.ofInstance(false),
                        REJECT), new MatchRulePair(Suppliers.ofInstance(true),
                        IGNORE)), false, Translated), is(New));
    }
View Full Code Here

Examples of org.zanata.service.impl.CopyTransWork.MatchRulePair

    public void failedDowngradeRule() {
        // A failed Downgrade rule should cause the content state to be fuzzy in
        // all cases, except if a rejection is encountered
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(
                        new MatchRulePair(Suppliers.ofInstance(false),
                                DOWNGRADE_TO_FUZZY),
                        new MatchRulePair(Suppliers.ofInstance(true),
                                REJECT)
                ),
                true, Translated
                ), is(NeedReview));
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(
                        new MatchRulePair(Suppliers.ofInstance(false),
                                DOWNGRADE_TO_FUZZY),
                        new MatchRulePair(Suppliers.ofInstance(true),
                                REJECT)
                ),
                false, Translated
                ), is(NeedReview));
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(
                        new MatchRulePair(Suppliers.ofInstance(false),
                                DOWNGRADE_TO_FUZZY),
                        new MatchRulePair(Suppliers.ofInstance(false),
                                IGNORE)
                ),
                true, Approved
                ), is(NeedReview));
        assertThat(CopyTransWork.determineContentStateFromRuleList(Lists
                .newArrayList(
                        new MatchRulePair(Suppliers.ofInstance(false),
                                DOWNGRADE_TO_FUZZY),
                        new MatchRulePair(Suppliers.ofInstance(false),
                                IGNORE)
                ),
                true, Approved
                ), is(NeedReview));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.