// Path: centrepoint/modules/model/src/main/java/com/effectivemaven/centrepoint/model/plugin/PluginManager.java
// public interface PluginManager
// {
//     /**
//      * Retrieve all plugins available (whether they are configurable or not).
//      * 
//      * @return the list of plugins
//      */
//     Collection<PanelPlugin> getPlugins();
// 
//     /**
//      * Retrieve all plugins available that take configuration options.
//      * 
//      * @return the list of configurable plugins
//      */
//     Collection<ConfigurablePanel<? extends ExtensionModel>> getConfigurablePlugins();
// 
//     /**
//      * Retrieve a specific configurable plugin, based on the ID of the configuration model.
//      * 
//      * @param id the ID of the plugin's configuration model, which should match the value of
//      *            {@link ConfigurablePanel#getId()}
//      * @return the plugin, or <tt>null</tt> if not found
//      */
//     ConfigurablePanel<? extends ExtensionModel> getConfigurablePlugin( String id );
// }


import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.util.tester.FormTester;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.effectivemaven.centrepoint.model.ExtensionModel;
import com.effectivemaven.centrepoint.model.MavenCoordinates;
import com.effectivemaven.centrepoint.model.Project;
import com.effectivemaven.centrepoint.model.plugin.PluginManager;
import com.effectivemaven.centrepoint.store.MemoryProjectStore;
import com.google.inject.Guice;
import com.google.inject.Module;
import com.google.inject.name.Names;
    {
        PageParameters params = new PageParameters();
        params.add( "id", "idValue" );
        params.add( "panel", "badValue" );
        wicketTester.startPage( EditPanelConfigurationPage.class, params );
        assert 404 == wicketTester.getServletResponse().getStatus();
    }

    @Test
    public void testCreateSettings()
    {
        PageParameters params = createParams( "idValue", "my-plugin" );
        wicketTester.startPage( EditPanelConfigurationPage.class, params );

        FormTester formTester = wicketTester.newFormTester( EDIT_PANEL_CONFIG_FORM );
        formTester.setValue( "row:1:value", "http://www.effectivemaven.com/" );
        formTester.submit();

        wicketTester.assertRenderedPage( ViewProjectPage.class );
        wicketTester.assertNoErrorMessage();

        Project project = projectStore.getProjectById( "idValue" );
        ExtensionModel model = project.getExtensionModel( "my-plugin" );
        assert model != null;
        assert "http://www.effectivemaven.com/".equals( model.getValuesAsMap().get( "link" ) );
    }
    
    @Test
    public void testPrePopulateAndUpdate()
    {
// Path: centrepoint/modules/model/src/main/java/com/effectivemaven/centrepoint/model/plugin/PluginManager.java
// public interface PluginManager
// {
//     /**
//      * Retrieve all plugins available (whether they are configurable or not).
//      * 
//      * @return the list of plugins
//      */
//     Collection<PanelPlugin> getPlugins();
// 
//     /**
//      * Retrieve all plugins available that take configuration options.
//      * 
//      * @return the list of configurable plugins
//      */
//     Collection<ConfigurablePanel<? extends ExtensionModel>> getConfigurablePlugins();
// 
//     /**
//      * Retrieve a specific configurable plugin, based on the ID of the configuration model.
//      * 
//      * @param id the ID of the plugin's configuration model, which should match the value of
//      *            {@link ConfigurablePanel#getId()}
//      * @return the plugin, or <tt>null</tt> if not found
//      */
//     ConfigurablePanel<? extends ExtensionModel> getConfigurablePlugin( String id );
// }


// Path: centrepoint/modules/webapp/src/test/java/com/effectivemaven/centrepoint/web/EditPanelConfigurationPageTest.java
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.repeater.RepeatingView;
import org.apache.wicket.util.tester.FormTester;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.effectivemaven.centrepoint.model.ExtensionModel;
import com.effectivemaven.centrepoint.model.MavenCoordinates;
import com.effectivemaven.centrepoint.model.Project;
import com.effectivemaven.centrepoint.model.plugin.PluginManager;
import com.effectivemaven.centrepoint.store.MemoryProjectStore;
import com.google.inject.Guice;
import com.google.inject.Module;
import com.google.inject.name.Names;

    {
        PageParameters params = new PageParameters();
        params.add( "id", "idValue" );
        params.add( "panel", "badValue" );
        wicketTester.startPage( EditPanelConfigurationPage.class, params );
        assert 404 == wicketTester.getServletResponse().getStatus();
    }

    @Test
    public void testCreateSettings()
    {
        PageParameters params = createParams( "idValue", "my-plugin" );
        wicketTester.startPage( EditPanelConfigurationPage.class, params );

        FormTester formTester = wicketTester.newFormTester( EDIT_PANEL_CONFIG_FORM );
        formTester.setValue( "row:1:value", "http://www.effectivemaven.com/" );
        formTester.submit();

        wicketTester.assertRenderedPage( ViewProjectPage.class );
        wicketTester.assertNoErrorMessage();

        Project project = projectStore.getProjectById( "idValue" );
        ExtensionModel model = project.getExtensionModel( "my-plugin" );
        assert model != null;
        assert "http://www.effectivemaven.com/".equals( model.getValuesAsMap().get( "link" ) );
    }
    
    @Test
    public void testPrePopulateAndUpdate()
    {
        PluginManager manager = injector.getInstance( PluginManager.class );