Package org.candlepin.model

Examples of org.candlepin.model.Rules


        MockitoAnnotations.initMocks(this);

        // Load the default production rules:
        InputStream is = this.getClass().getResourceAsStream(
            RulesCurator.DEFAULT_RULES_FILE);
        Rules rules = new Rules(Util.readFile(is));
        when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
        when(rulesCuratorMock.getRules()).thenReturn(rules);
        provider = new JsRunnerProvider(rulesCuratorMock);
        quantityRules = new QuantityRules(provider.get());
View Full Code Here


    public void setUp() {
        MockitoAnnotations.initMocks(this);
        // Load the default production rules:
        InputStream is = this.getClass().getResourceAsStream(
            RulesCurator.DEFAULT_RULES_FILE);
        Rules rules = new Rules(Util.readFile(is));
        when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
        when(rulesCuratorMock.getRules()).thenReturn(rules);
        provider = new JsRunnerProvider(rulesCuratorMock);
        poolTypeRules = new PoolComplianceTypeRules(provider.get());
    }
View Full Code Here

        i18n = I18nFactory.getI18n(getClass(), "org.candlepin.i18n.Messages", locale,
            I18nFactory.FALLBACK);
        // Load the default production rules:
        InputStream is = this.getClass().getResourceAsStream(
            RulesCurator.DEFAULT_RULES_FILE);
        Rules rules = new Rules(Util.readFile(is));
        when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
        when(rulesCuratorMock.getRules()).thenReturn(rules);
        provider = new JsRunnerProvider(rulesCuratorMock);
        actKeyRules = new ActivationKeyRules(provider.get(), i18n);
    }
View Full Code Here

    public void rulesCompatibilityVsNull() throws Exception {
        assertFalse(VersionUtil.getRulesVersionCompatibility("0.5.15", null));
    }

    public static void writeoutVersion(String version, String release) throws Exception {
        PrintStream ps = new PrintStream(new File(new Rules().getClass()
            .getClassLoader().getResource("version.properties").toURI()));
        ps.println("version=" + version);
        ps.println("release=" + release);
        ps.close();
    }
View Full Code Here

        // Force all events to have exact same timestamp:
        Date forcedDate = new Date();

        EventBuilder builder = eventFactory.getEventBuilder(Event.Target.RULES,
                Event.Type.DELETED);
        Event rulesDeletedEvent = builder.setOldEntity(new Rules()).buildEvent();
        rulesDeletedEvent.setTimestamp(forcedDate);

        builder = eventFactory.getEventBuilder(Event.Target.CONSUMER,
                Event.Type.CREATED);
        Event consumerCreatedEvent = builder.setNewEntity(newConsumer).buildEvent();
View Full Code Here

*/
public class RulesCuratorTest extends DatabaseTestFixture {

    @Test
    public void deleteRules() {
        Rules origRules = rulesCurator.getRules();
        Rules rules = new Rules("// Version: 2.0\n//these are the new rules");
        Rules newRules = rulesCurator.update(rules);
        rulesCurator.delete(newRules);
        Rules latestRules = rulesCurator.getRules();
        assertEquals(origRules.getRules(), latestRules.getRules());
    }
View Full Code Here

        assertEquals(origRules.getRules(), latestRules.getRules());
    }

    @Test
    public void ignoreOldRulesInDb() throws Exception {
        Rules oldRules = new Rules("// Version: 1.9\n//oldrules");
        rulesCurator.create(oldRules);
        Rules rules = rulesCurator.getRules();
        assertFalse("1.9".equals(rules.getVersion()));
    }
View Full Code Here

     * of "for each", which is not a part of standard Javascript and thus a problem for
     * those who are using our rules with other interpreters.
     */
    @Test
    public void noForEachInRules() throws Exception {
        Rules rules = rulesCurator.getRules();
        assertEquals(-1, rules.getRules().indexOf("for each"));
    }
View Full Code Here

    }

    @Test
    public void ignoreOldRulesInDbDefaultVersion() throws Exception {
        // Default version set by upgrade script:
        Rules oldRules = new Rules("// Version: 0.0\n//oldrules");
        rulesCurator.create(oldRules);
        Rules rules = rulesCurator.getRules();
        assertFalse("0.0".equals(rules.getVersion()));
    }
View Full Code Here

        rulesCurator.getRules();
    }

    @Test
    public void deleteDefaultRules() {
        Rules rules = rulesCurator.getRules();
        rulesCurator.delete(rules);
        rulesCurator.getRules();
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Rules

Copyright © 2018 www.massapicom. 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.