/*************************************************************************************
* Copyright (c) 2014 Red Hat, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* JBoss by Red Hat - Initial implementation.
************************************************************************************/
package org.jboss.tools.arquillian.test;
import static org.junit.Assert.assertNotNull;
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.jboss.tools.arquillian.core.internal.util.ArquillianUtility;
import org.jboss.tools.test.util.JobUtils;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
*
* @author snjeza
*
*/
public class AddArquillianSupportTest extends AbstractArquillianTest {
private static final String TEST_PROJECT_NAME = "addArquillianSupport";
@BeforeClass
public static void init() throws Exception {
importMavenProject("projects/addArquillianSupport.zip", TEST_PROJECT_NAME);
JobUtils.waitForIdle(1000);
IProject project = getProject(TEST_PROJECT_NAME);
addArquillianSupport(project);
JobUtils.waitForIdle();
}
@Test
public void testAddArquillianSupport() throws CoreException {
IProject project = getProject(TEST_PROJECT_NAME);
IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project, new NullProgressMonitor());
MavenProject mavenProject = facade.getMavenProject(new NullProgressMonitor());
String version = ArquillianUtility.getArquillianVersion(mavenProject);
assertNotNull("Arquillian support isn't added.", version);
}
@AfterClass
public static void dispose() throws Exception {
JobUtils.waitForIdle();
getProject(TEST_PROJECT_NAME).delete(true, true, null);
}
}