Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.PluginProperty


    }

    @Test
    public void applyConfigurationWithCorrectValuesShouldBeSuccessful() throws PluginConfigurationException {
        List<PluginProperty> properties = new ArrayList<>();
        properties.add(new PluginProperty(KaptchaPlugin.WIDTH_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.HEIGHT_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.LENGTH_PROPERTY, PluginProperty.Type.INT, "4"));
        properties.add(new PluginProperty(KaptchaPlugin.POSSIBLE_SYMBOLS_PROPERTY,
                PluginProperty.Type.STRING, "0123456789"));

        Map<PluginProperty, String> errors = kaptchaPlugin.applyConfiguration(properties);

        assertEquals(errors.size(), 0);
View Full Code Here


    }

    @Test(expectedExceptions = PluginConfigurationException.class)
    public void applyConfigurationWithInvalidPropertiesShouldBeFailed() throws PluginConfigurationException {
        List<PluginProperty> properties = new ArrayList<>();
        properties.add(new PluginProperty(KaptchaPlugin.WIDTH_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.HEIGHT_PROPERTY, PluginProperty.Type.INT, "400"));
        properties.add(new PluginProperty(KaptchaPlugin.LENGTH_PROPERTY, PluginProperty.Type.INT, "ABC4"));

        kaptchaPlugin.applyConfiguration(properties);
    }
View Full Code Here

     */
    @Override
    public void updateProperties(List<PluginProperty> properties) {

        for (PluginProperty property: properties) {
            PluginProperty persistedProperty = (PluginProperty) session().load(property.getClass(), property.getId());
            persistedProperty.setValue(property.getValue());
            session().saveOrUpdate(persistedProperty);
        }

        session().flush();
    }
View Full Code Here

        return userDto;
    }

    private PluginConfiguration createConfiguration(String url, String login, String password) {

        PluginProperty urlProperty =
                new PluginProperty("URL", STRING, url);
        urlProperty.setName("Url");
        PluginProperty loginProperty = new PluginProperty("LOGIN", STRING, login);
        loginProperty.setName("Login");
        PluginProperty passwordProperty = new PluginProperty("PASSWORD", STRING, password);
        passwordProperty.setName("Password");
        return new PluginConfiguration("Poulpe Auth Plugin", true,
                Arrays.asList(urlProperty, loginProperty, passwordProperty));
    }
View Full Code Here

        return pluginProperties;
    }

    @Override
    public List<PluginProperty> getDefaultConfiguration() {
        PluginProperty url = new PluginProperty(URL_PROPERTY, STRING, "http://localhost:8080");
        PluginProperty login = new PluginProperty(LOGIN_PROPERTY, STRING, "user");
        PluginProperty password = new PluginProperty(PASSWORD_PROPERTY, STRING, "1234");
        return Arrays.asList(url, login, password);
    }
View Full Code Here

    @Test
    public void updateConfigurationShouldSaveConfigurationProperties()
            throws NotFoundException, UnexpectedErrorException {
        //GIVEN
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        PluginConfiguration configuration = new PluginConfiguration("Dummy", false, properties);
        when(pluginLoader.getPlugins()).thenReturn(Arrays.asList((Plugin) new DummyPlugin("Dummy")));
        //WHEN
        pluginService.updateConfiguration(configuration, FAKE_COMPONENT_ID);
        //THEN
View Full Code Here

        return Collections.emptyMap();
    }

    @Override
    public List<PluginProperty> getDefaultConfiguration() {
        PluginProperty url = new PluginProperty("URL", STRING, "http://localhost:1234");
        return Arrays.asList(url);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public List<PluginProperty> getConfiguration() {
        PluginProperty orderProperty = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT,
                String.valueOf(order));
        orderProperty.setHint(ORDER_HINT);
        return Arrays.asList(orderProperty);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public List<PluginProperty> getDefaultConfiguration() {
        PluginProperty orderProperty = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT,
                String.valueOf(DEFAULT_ORDER_VALUE));
        orderProperty.setHint(ORDER_HINT);
        return Arrays.asList(orderProperty);
    }
View Full Code Here

        return pluginProperties;
    }

    @Override
    public List<PluginProperty> getDefaultConfiguration() {
        PluginProperty width = new PluginProperty(WIDTH_PROPERTY, INT, "100");
        PluginProperty height = new PluginProperty(HEIGHT_PROPERTY, INT, "50");
        PluginProperty length = new PluginProperty(LENGTH_PROPERTY, INT, "4");
        PluginProperty possibleSymbols = new PluginProperty(POSSIBLE_SYMBOLS_PROPERTY, STRING, "0123456789");
        return Arrays.asList(width, height, length, possibleSymbols);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.PluginProperty

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.