Package org.socialmusicdiscovery.server.business.model.config

Examples of org.socialmusicdiscovery.server.business.model.config.ConfigurationParameterEntity


    String pluginConfigurationPath = "org.socialmusicdiscovery.server.plugins.mediaimport."
        + ami.getId() + ".";
    Set<ConfigurationParameter> defaultConfiguration = new HashSet<ConfigurationParameter>();
    for (ConfigurationParameter parameter : ami.getDefaultConfiguration()) {
      ConfigurationParameterEntity entity = new ConfigurationParameterEntity(
          parameter);
      if (!entity.getId().startsWith(pluginConfigurationPath)) {
        entity.setId(pluginConfigurationPath + entity.getId());
      }
      entity.setDefaultValue(true);
      defaultConfiguration.add(entity);
    }

    defaultValueConfigurationManager.setParametersForPath(
        pluginConfigurationPath, defaultConfiguration);
View Full Code Here


        };
        String pluginConfigurationPath = "org.socialmusicdiscovery.server.plugins.mediaimport." + tagImporter.getId() + ".";

        Set<ConfigurationParameter> defaultConfiguration = new HashSet<ConfigurationParameter>();
        for (ConfigurationParameter parameter : tagImporter.getDefaultConfiguration()) {
            ConfigurationParameterEntity entity = new ConfigurationParameterEntity(parameter);
            if (!entity.getId().startsWith(pluginConfigurationPath)) {
                entity.setId(pluginConfigurationPath + entity.getId());
            }
            entity.setDefaultValue(true);
            defaultConfiguration.add(entity);
        }
        defaultValueConfigurationManager.setParametersForPath(pluginConfigurationPath, defaultConfiguration);
        tagImporter.setConfiguration(new MappedConfigurationContext(pluginConfigurationPath, defaultValueConfigurationManager));
        try {
View Full Code Here

        fileSystem = new FileSystem();

        String pluginConfigurationPath = "org.socialmusicdiscovery.server.plugins.mediaimport." + fileSystem.getId() + ".";
        Set<ConfigurationParameter> defaultConfiguration = new HashSet<ConfigurationParameter>();
        for (ConfigurationParameter parameter : fileSystem.getDefaultConfiguration()) {
            ConfigurationParameterEntity entity = new ConfigurationParameterEntity(parameter);
            if (!entity.getId().startsWith(pluginConfigurationPath)) {
                entity.setId(pluginConfigurationPath + entity.getId());
            }
            entity.setDefaultValue(true);
            defaultConfiguration.add(entity);
        }
        defaultValueConfigurationManager.setParametersForPath(pluginConfigurationPath, defaultConfiguration);
        fileSystem.setConfiguration(new MappedConfigurationContext(pluginConfigurationPath, defaultValueConfigurationManager));
        Map<String, String> parameters = new HashMap<String, String>();
View Full Code Here

    @Test
    public void testConfigCreation() throws Exception {
        loadTestData(getClass().getPackage().getName(),"Empty Tables.xml");
        em.getTransaction().begin();
        try {
            ConfigurationParameterEntity booleanParameter = new ConfigurationParameterEntity();
            booleanParameter.setId("somebooleanparameter");
            booleanParameter.setType(ConfigurationParameter.Type.BOOLEAN);
            booleanParameter.setValue("true");
            configurationParameterRepository.create(booleanParameter);

            ConfigurationParameterEntity stringParameter = new ConfigurationParameterEntity();
            stringParameter.setId("somestringparameter");
            stringParameter.setType(ConfigurationParameter.Type.STRING);
            stringParameter.setValue("hello");
            configurationParameterRepository.create(stringParameter);

            ConfigurationParameterEntity numberParameter = new ConfigurationParameterEntity();
            numberParameter.setId("somenumberparameter");
            numberParameter.setType(ConfigurationParameter.Type.INTEGER);
            numberParameter.setValue("42");
            configurationParameterRepository.create(numberParameter);
        }
        finally{
            if(!em.getTransaction().getRollbackOnly()) {
                em.getTransaction().commit();
View Full Code Here

    @Test
    public void testConfigUpdate() throws Exception {
        loadTestData(getClass().getPackage().getName(),"Empty Tables.xml");
        em.getTransaction().begin();
        try {
            ConfigurationParameterEntity booleanParameter = new ConfigurationParameterEntity();
            booleanParameter.setId("somebooleanparameter");
            booleanParameter.setType(ConfigurationParameter.Type.BOOLEAN);
            booleanParameter.setValue("true");
            configurationParameterRepository.create(booleanParameter);

            ConfigurationParameterEntity stringParameter = new ConfigurationParameterEntity();
            stringParameter.setId("somestringparameter");
            stringParameter.setType(ConfigurationParameter.Type.STRING);
            stringParameter.setValue("helllo");
            configurationParameterRepository.create(stringParameter);

            booleanParameter = new ConfigurationParameterEntity();
            booleanParameter.setId("somebooleanparameter");
            booleanParameter.setType(ConfigurationParameter.Type.BOOLEAN);
            booleanParameter.setValue("false");
            configurationParameterRepository.merge(booleanParameter);

            stringParameter = configurationParameterRepository.findById("somestringparameter");
            stringParameter.setValue("good bye");

        }
        finally{
            if(!em.getTransaction().getRollbackOnly()) {
                em.getTransaction().commit();
View Full Code Here

    @Test
    public void testUpperCase() {

        assert SortAsHelper.getSortAsForValue("Artist", "äöåéíü").equals("ÄÖÅÉÍÜ");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.uppercase", ConfigurationParameter.Type.BOOLEAN, "false"));

        assert SortAsHelper.getSortAsForValue("Artist", "äöåéíü").equals("äöåéíü");
    }
View Full Code Here

    @Test
    void testAccented() {
        assert SortAsHelper.getSortAsForValue("Artist", "äöåéíü").equals("ÄÖÅÉÍÜ");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.removeAccents", ConfigurationParameter.Type.BOOLEAN, "true"));

        assert SortAsHelper.getSortAsForValue("Artist", "äöåéíü").equals("AOAEIU");
    }
View Full Code Here

        assert SortAsHelper.getSortAsForValue("Artist", "äöåéíü").equals("AOAEIU");
    }

    @Test
    public void testMatching() {
        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsExpression", ConfigurationParameter.Type.STRING, "^(.*) ([^ ]*)$"));
        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsValue", ConfigurationParameter.Type.STRING, "$2 $1"));

        assert SortAsHelper.getSortAsForValue("Artist", "Frank Zappa").equals("ZAPPA FRANK");

        assert SortAsHelper.getSortAsForValue("Artist", "Wolfgang Amadeus Mozart").equals("MOZART WOLFGANG AMADEUS");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsExpression", ConfigurationParameter.Type.STRING, "^(.*) ([^ ]*)$"));
        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsValue", ConfigurationParameter.Type.STRING, "$2"));

        assert SortAsHelper.getSortAsForValue("Artist", "Frank Zappa").equals("ZAPPA");

        assert SortAsHelper.getSortAsForValue("Artist", "Wolfgang Amadeus Mozart").equals("MOZART");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsExpression", ConfigurationParameter.Type.STRING, ""));
        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Artist.sortAsValue", ConfigurationParameter.Type.STRING, ""));

        assert SortAsHelper.getSortAsForValue("Artist", "Frank Zappa").equals("FRANK ZAPPA");

        assert SortAsHelper.getSortAsForValue("Artist", "Wolfgang Amadeus Mozart").equals("WOLFGANG AMADEUS MOZART");
    }
View Full Code Here

        assert SortAsHelper.getSortAsForValue("Artist", "Wolfgang Amadeus Mozart").equals("WOLFGANG AMADEUS MOZART");
    }

    @Test
    public void testIgnoredArticles() {
        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Work.ignoredArticles", ConfigurationParameter.Type.STRING, "(?i)(The|El|La|Los|Las|Le|Les)"));

        assert SortAsHelper.getSortAsForValue("Work", "The Final Countdown").equals("FINAL COUNTDOWN");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Work.ignoredArticles", ConfigurationParameter.Type.STRING, ""));

        assert SortAsHelper.getSortAsForValue("Work", "The Final Countdown").equals("THE FINAL COUNTDOWN");
    }
View Full Code Here

    @Test
    public void testRemovePunctuation() {
        assert SortAsHelper.getSortAsForValue("Work", "...Baby One More Time").equals("BABY ONE MORE TIME");
        assert SortAsHelper.getSortAsForValue("Work", "U & Me = Love").equals("U ME LOVE");

        configurationParameterRepository.merge(new ConfigurationParameterEntity(PREFIX + "Work.removePunctuation", ConfigurationParameter.Type.BOOLEAN, "false"));

        assert SortAsHelper.getSortAsForValue("Work", "...Baby One More Time").equals("...BABY ONE MORE TIME");
    }
View Full Code Here

TOP

Related Classes of org.socialmusicdiscovery.server.business.model.config.ConfigurationParameterEntity

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.