Search in sources :

Example 1 with WarModel

use of org.jetbrains.plugins.gradle.model.web.WebConfiguration.WarModel in project intellij-community by JetBrains.

the class WebConfigurationBuilderImplTest method testDefaultWarModel.

@Test
public void testDefaultWarModel() throws Exception {
    DomainObjectSet<? extends IdeaModule> ideaModules = allModels.getIdeaProject().getModules();
    List<WebConfiguration> ideaModule = ContainerUtil.mapNotNull(ideaModules, new Function<IdeaModule, WebConfiguration>() {

        @Override
        public WebConfiguration fun(IdeaModule module) {
            return allModels.getExtraProject(module, WebConfiguration.class);
        }
    });
    assertEquals(1, ideaModule.size());
    WebConfiguration webConfiguration = ideaModule.get(0);
    assertEquals(1, webConfiguration.getWarModels().size());
    final WarModel warModel = webConfiguration.getWarModels().iterator().next();
    assertEquals("src/main/webapp", warModel.getWebAppDirName());
    assertArrayEquals(new String[] { "MANIFEST.MF", "additionalWebInf", "rootContent" }, ContainerUtil.map2Array(warModel.getWebResources(), new Function<WebResource, Object>() {

        @Override
        public String fun(WebResource resource) {
            return resource.getFile().getName();
        }
    }));
}
Also used : Function(com.intellij.util.Function) IdeaModule(org.gradle.tooling.model.idea.IdeaModule) WebResource(org.jetbrains.plugins.gradle.model.web.WebConfiguration.WebResource) WarModel(org.jetbrains.plugins.gradle.model.web.WebConfiguration.WarModel) WebConfiguration(org.jetbrains.plugins.gradle.model.web.WebConfiguration) Test(org.junit.Test)

Aggregations

Function (com.intellij.util.Function)1 IdeaModule (org.gradle.tooling.model.idea.IdeaModule)1 WebConfiguration (org.jetbrains.plugins.gradle.model.web.WebConfiguration)1 WarModel (org.jetbrains.plugins.gradle.model.web.WebConfiguration.WarModel)1 WebResource (org.jetbrains.plugins.gradle.model.web.WebConfiguration.WebResource)1 Test (org.junit.Test)1