Package org.candlepin.model

Examples of org.candlepin.model.Rules


    @Test
    public void exportConsumer() throws ExportCreationException, IOException {
        config.setProperty(ConfigProperties.SYNC_WORK_DIR, "/tmp/");
        config.setProperty(ConfigProperties.PREFIX_WEBURL, "localhost:8443/weburl");
        config.setProperty(ConfigProperties.PREFIX_APIURL, "localhost:8443/apiurl");
        Rules mrules = mock(Rules.class);
        Consumer consumer = mock(Consumer.class);
        Principal principal = mock(Principal.class);

        when(mrules.getRules()).thenReturn("foobar");
        when(pki.getSHA256WithRSAHash(any(InputStream.class))).thenReturn(
            "signature".getBytes());
        when(rc.getRules()).thenReturn(mrules);
        when(pprov.get()).thenReturn(principal);
        when(principal.getUsername()).thenReturn("testUser");
View Full Code Here


    @Test
    public void exportDistributorVersions() throws ExportCreationException, IOException {
        config.setProperty(ConfigProperties.SYNC_WORK_DIR, "/tmp/");
        config.setProperty(ConfigProperties.PREFIX_WEBURL, "localhost:8443/weburl");
        config.setProperty(ConfigProperties.PREFIX_APIURL, "localhost:8443/apiurl");
        Rules mrules = mock(Rules.class);
        Consumer consumer = mock(Consumer.class);
        Principal principal = mock(Principal.class);

        when(mrules.getRules()).thenReturn("foobar");
        when(pki.getSHA256WithRSAHash(any(InputStream.class))).thenReturn(
            "signature".getBytes());
        when(rc.getRules()).thenReturn(mrules);
        when(pprov.get()).thenReturn(principal);
        when(principal.getUsername()).thenReturn("testUser");
View Full Code Here

    @Before
    public void setupTest() {
        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);
        overrideRules = new OverrideRules(provider.get());
View Full Code Here

        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);
        when(eventSinkProvider.get()).thenReturn(eventSink);
        provider = new JsRunnerProvider(rulesCuratorMock);
        Locale locale = new Locale("en_US");
View Full Code Here

    }

    @Test
    public void rulesUpdatedShouldEmitSuccessfully()
        throws Exception {
        Rules oldRules = new Rules(TestUtil.createRulesBlob(1));
        Rules newRules = new Rules(TestUtil.createRulesBlob(2));
        eventSinkImpl.emitRulesModified(oldRules, newRules);
        eventSinkImpl.sendEvents();
        verify(mockClientProducer).send(any(ClientMessage.class));
    }
View Full Code Here

    }

    @Test
    public void rulesDeletedShouldEmitSuccessfully()
        throws Exception {
        Rules oldRules = new Rules(TestUtil.createRulesBlob(1));
        eventSinkImpl.emitRulesDeleted(oldRules);
        eventSinkImpl.sendEvents();
        verify(mockClientProducer).send(any(ClientMessage.class));
    }
View Full Code Here

        importer = new RulesImporter(curator, injector.getInstance(EventSink.class));
    }

    @Test
    public void importNewerRulesSameApi() throws IOException {
        Rules currentRules = new Rules("//Version: 2.0");
        when(curator.getRules()).thenReturn(currentRules);

        importer.importObject(new StringReader("//Version: 2.1"));
        verify(curator).update(any(Rules.class));
    }
View Full Code Here

        verify(curator).update(any(Rules.class));
    }

    @Test
    public void importSkipsOlderRulesSameApi() throws IOException {
        Rules currentRules = new Rules("// Version: 2.1");
        when(curator.getRules()).thenReturn(currentRules);

        importer.importObject(new StringReader("// Version: 2.0"));
        verify(curator, never()).update(any(Rules.class));
    }
View Full Code Here

        verify(curator, never()).update(any(Rules.class));
    }

    @Test
    public void importSkipsOlderRulesDifferentApi() throws IOException {
        Rules currentRules = new Rules("// Version: 2.1");
        when(curator.getRules()).thenReturn(currentRules);

        importer.importObject(new StringReader("//Version: 1.0\n//rules"));
        verify(curator, never()).update(any(Rules.class));
    }
View Full Code Here

        verify(curator, never()).update(any(Rules.class));
    }

    @Test
    public void importSkipsNewerRulesDifferentApi() throws IOException {
        Rules currentRules = new Rules("// Version: 2.1");
        when(curator.getRules()).thenReturn(currentRules);

        importer.importObject(new StringReader("//Version: 3.0"));
        verify(curator, never()).update(any(Rules.class));
    }
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.