package jetbrains.buildServer.eclipse.tests; import java.io.File; import java.util.LinkedList; import jetbrains.buildServer.agent.BuildRunnerContext; import jetbrains.buildServer.eclipse.EclipseConstants; import jetbrains.buildServer.eclipse.java.BuildDescriptor; import jetbrains.buildServer.eclipse.tests.helper.SWTBotTestingServiceAdapter; import org.junit.Assert; import org.junit.Test; public class SWTBotTestingServiceTest extends AbstractEclipseBuilderTest { @Test public void afterInitialized_validation_ok() throws Exception { //TODO: final SWTBotTestingServiceAdapter testAdapter = new SWTBotTestingServiceAdapter(); } @Test public void afterInitialized_validation_fail() throws Exception { //TODO: final SWTBotTestingServiceAdapter testAdapter = new SWTBotTestingServiceAdapter(); } @Test public void mountTestingBase() throws Exception { final SWTBotTestingServiceAdapter testAdapter = new SWTBotTestingServiceAdapter(); final BuildRunnerContext context = createRunnerContext(); context.getRunnerParameters().put(EclipseConstants.SETTINGS_RELATIVE_PATH_TO_PROJECT, new File(getEclipseProjectsHome(), "projects-structured/project-feature-project/plugins/pplugin.core/.project").getPath()); context.getRunnerParameters().put(EclipseConstants.SETTINGS_ARTIFACTS_OUTPUT_PATH, new File(getEclipseProjectsHome(), "projects-structured/project-feature-project").getPath()); BuildDescriptor buildDescriptor = testAdapter.getBuildDescriptor(ourPlatform, context); Assert.assertNotNull(buildDescriptor); //mounted LinkedList args = testAdapter.mountTestingBase(ourPlatform, buildDescriptor, context, new LinkedList()); Assert.assertNotNull(args); Assert.assertTrue(args.size() == 1); //set final String dropinsPath = args.getFirst().split("=")[1]; Assert.assertNotNull(dropinsPath); //copied final File dropins = new File(dropinsPath); Assert.assertTrue(dropins.exists()); //check 'features' Assert.assertTrue(new File(dropins, "features/pfeature/.project").exists()); Assert.assertTrue(new File(dropins, "features/pfeature/build.properties").exists()); Assert.assertTrue(new File(dropins, "features/pfeature/feature.xml").exists()); //check 'plugins' Assert.assertTrue(new File(dropins, "plugins/pplugin.core/.classpath").exists()); Assert.assertTrue(new File(dropins, "plugins/pplugin.core/.project").exists()); Assert.assertTrue(new File(dropins, "plugins/pplugin.core/build.properties").exists()); Assert.assertTrue(new File(dropins, "plugins/pplugin.ui/.classpath").exists()); Assert.assertTrue(new File(dropins, "plugins/pplugin.ui/.project").exists()); Assert.assertTrue(new File(dropins, "plugins/pplugin.ui/build.properties").exists()); } }