Package fr.ippon.tatami.bot.config

Examples of fr.ippon.tatami.bot.config.TatamibotConfiguration


        ReflectionTestUtils.setField(commonRouteBuilder, "tatamiStatusProcessor", processor);
        ReflectionTestUtils.setField(commonRouteBuilder, "lastUpdateDateTatamibotConfigurationUpdater", lastUpdateDateTatamibotConfigurationUpdater);

        // common mock configuration :
        when(userService.getUserByLogin("tatamibot@ippon.fr")).thenReturn(tatamibotUser);
        when(tatamibotConfigurationRepository.findTatamibotConfigurationById(Mockito.anyString())).thenReturn(new TatamibotConfiguration());
    }
View Full Code Here


    }

    @Test
    public void testRssRouteOnly() throws Exception {

        TatamibotConfiguration configuration = getRssBotConfiguration();
        configuration.setTag("BlogIppon")// <<<  ==== TAG

        setupAndLaunchContext(configuration);

        await().until(statusUpdateServiceWasCallAtLeast3Times());

        String msg1 = "[Ippevent Mobilité – Applications mobiles – ouverture des inscriptions](http://feedproxy.google.com/~r/LeBlogDesExpertsJ2ee/~3/GcJYERHTfoQ/)";
        String msg2 = "[Business – Ippon Technologies acquiert Atomes et renforce son offre Cloud](http://feedproxy.google.com/~r/LeBlogDesExpertsJ2ee/~3/wK-Y47WGZBQ/)";
        String msg3 = "[Les Méthodes Agiles – Définition de l’Agilité](http://feedproxy.google.com/~r/LeBlogDesExpertsJ2ee/~3/hSqyt1MCOoo/)";

        verify(statusUpdateService).postStatusAsUser(msg1 + " #BlogIppon", tatamibotUser);
        verify(statusUpdateService).postStatusAsUser(msg2 + " #BlogIppon", tatamibotUser);
        verify(statusUpdateService).postStatusAsUser(msg3 + " #BlogIppon", tatamibotUser);
        verifyNoMoreInteractions(statusUpdateService);

        // TODO : the repository is updated three times ...
        ArgumentCaptor<TatamibotConfiguration> argumentCaptor = ArgumentCaptor.forClass(TatamibotConfiguration.class);
        verify(tatamibotConfigurationRepository, times(3)).updateTatamibotConfiguration(argumentCaptor.capture());
        TatamibotConfiguration value = argumentCaptor.getValue();
        assertThat(value.getLastUpdateDate(), is(DateTime.parse("2012-12-17T17:35:51Z").toDate()));

        assertTrue(idempotentRepository.contains("ippon.fr-" + msg1));
    }
View Full Code Here


    private TatamibotConfiguration getRssBotConfiguration() {
        final String fileUrl = this.getClass().getResource("route/rss.xml").toExternalForm();

        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTatamibotConfigurationId("TEST_CONFIG_ID");
        configuration.setType(TatamibotConfiguration.TatamibotType.RSS);
        configuration.setDomain("ippon.fr");
//        configuration.setUrl("http://feeds.feedburner.com/LeBlogDesExpertsJ2ee?format=xml");
        configuration.setUrl(fileUrl);
        configuration.setPollingDelay(60); // not used here
        configuration.setLastUpdateDate(DateTime.parse("2010-01-01T00:00:00").toDate());
        return configuration;
    }
View Full Code Here

        return sut;
    }

    @Test
    public void commonRouteSendStatusAndUpdateConfiguration() throws Exception {
        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTag("MyTag");

        sendAMessage(configuration);

        await().until(lastProcessorWasCalled());
View Full Code Here

    }

    @Test
    public void commonRouteShouldAddTagIfPresent() throws Exception {
        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTag("MyTag");

        sendAMessage(configuration);

        await().until(lastProcessorWasCalled());
View Full Code Here

    }


    @Test
    public void commonRouteDoesNotModifyMessageIfTagIsAbsent() throws Exception {
        TatamibotConfiguration configuration = new TatamibotConfiguration();

        sendAMessage(configuration);

        await().until(lastProcessorWasCalled());
View Full Code Here

    @Override
    protected TatamibotConfiguration getBotConfiguration() {
        final String fileUrl = this.getClass().getResource("rss.xml").toExternalForm(); // spécifique ...

        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTatamibotConfigurationId("TEST_CONFIG_ID");
        configuration.setType(TatamibotConfiguration.TatamibotType.RSS);     // spécifique ... mais pas utilisé ici
        configuration.setDomain("ippon.fr");
//        configuration.setUrl("http://feeds.feedburner.com/LeBlogDesExpertsJ2ee?format=xml");
        configuration.setUrl(fileUrl);
        configuration.setPollingDelay(60); // not used here
        configuration.setLastUpdateDate(DateTime.parse("2010-01-01T00:00:00").toDate());
        return configuration;
    }
View Full Code Here

    }

    @Override
    protected TatamibotConfiguration getBotConfiguration() {

        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTatamibotConfigurationId("TEST_CONFIG_ID");
        configuration.setType(TatamibotConfiguration.TatamibotType.TWITTER);
        configuration.setDomain("ippon.fr");
//        configuration.setUrl("??");
        configuration.setPollingDelay(60); // not used here
        configuration.setLastUpdateDate(DateTime.parse("2010-01-01T00:00:00").toDate());
        return configuration;
    }
View Full Code Here

        assertThat(uri, startsWith("rss:http://whatever?lastUpdate="));
    }

    private TatamibotConfiguration getRssBotConfiguration(String url) {
        TatamibotConfiguration configuration = new TatamibotConfiguration();
        configuration.setTatamibotConfigurationId("TEST_CONFIG_ID");
        configuration.setType(TatamibotConfiguration.TatamibotType.RSS);     // spécifique ... mais pas utilisé ici
        configuration.setDomain("ippon.fr");
        configuration.setUrl(url);
        configuration.setPollingDelay(60); // not used here
        configuration.setLastUpdateDate(DateTime.parse("2010-01-01T00:00:00").toDate());
        return configuration;
    }
View Full Code Here

        if (userService.getUserByLogin(tatamiBotLogin) == null) {
            log.info("Tatami Bot user does not exist for domain " + domain.getName() + " - creating it");
            userService.createTatamibot(domain.getName());
            if (domain.getName().equals("ippon.fr")) {
                log.info("Creating a default RSS robot for ippon.fr");
                TatamibotConfiguration configuration = new TatamibotConfiguration();
                configuration.setType(TatamibotConfiguration.TatamibotType.RSS);
                configuration.setDomain("ippon.fr");
                configuration.setUrl("http://feeds.feedburner.com/LeBlogDesExpertsJ2ee?format=xml");
                configuration.setPollingDelay(60);
                DateTime lastUpdateDate = DateTime.parse("2013-01-01T00:00:00");
                configuration.setLastUpdateDate(lastUpdateDate.toDate());
                configuration.setTag("BlogIppon");
                tatamibotConfigurationRepository.insertTatamibotConfiguration(configuration);
            }
        }
    }
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.bot.config.TatamibotConfiguration

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.