blob: 0433971771ba00f73132b42a67e3d5939ebbf4bd [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.web.project;
import java.io.File;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectManager;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.j2ee.dd.api.web.WebAppMetadata;
import org.netbeans.modules.j2ee.dd.api.webservices.WebservicesMetadata;
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider;
import org.netbeans.modules.web.project.test.TestUtil;
import org.netbeans.spi.project.support.ant.AntProjectHelper;
import org.openide.filesystems.FileUtil;
import org.openide.util.test.MockLookup;
/**
*
* @author Andrei Badea
*/
public class ProjectWebModuleTest extends NbTestCase {
private Project project;
private AntProjectHelper helper;
public ProjectWebModuleTest(String testName) {
super(testName);
}
@Override
protected void setUp() throws Exception {
MockLookup.setLayersAndInstances();
}
/**
* Tests that the metadata models are returned correctly.
*/
public void testMetadataModel() throws Exception {
File f = new File(getDataDir().getAbsolutePath(), "projects/WebApplication1");
project = ProjectManager.getDefault().findProject(FileUtil.toFileObject(f));
J2eeModuleProvider provider = project.getLookup().lookup(J2eeModuleProvider.class);
J2eeModule j2eeModule = provider.getJ2eeModule();
assertNotNull(j2eeModule.getMetadataModel(WebAppMetadata.class));
assertNotNull(j2eeModule.getMetadataModel(WebservicesMetadata.class));
}
}