Search in sources :

Example 81 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project che by eclipse.

the class CheBootstrapTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    systemPropertiesHelper = overrideSystemProperties();
    cheBootstrap = new CheBootstrap();
    servletContext = mock(ServletContext.class);
    URL classesDirUrl = Thread.currentThread().getContextClassLoader().getResource(".");
    File classesDir = new File(classesDirUrl.toURI());
    che = new File(classesDir, "che");
    che.mkdir();
    userCongDir = new File(System.getenv(CHE_LOCAL_CONF_DIR));
    userCongDir.mkdirs();
    mockServletContext();
}
Also used : ServletContext(javax.servlet.ServletContext) File(java.io.File) URL(java.net.URL) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 82 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project che by eclipse.

the class SshMachineInstanceProviderTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    machine = createMachine();
    recipe = new RecipeImpl().withType("ssh-config").withScript(RECIPE_SCRIPT);
}
Also used : RecipeImpl(org.eclipse.che.api.machine.server.recipe.RecipeImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 83 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project che by eclipse.

the class ProjectResolverTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    MavenServerContext.setLoggerAndListener(new MavenServerLogger() {

        @Override
        public void warning(Throwable t) throws RemoteException {
        }

        @Override
        public void info(Throwable t) throws RemoteException {
        }

        @Override
        public void error(Throwable t) throws RemoteException {
        }
    }, (file, relativePath) -> {
        System.out.println(file.getAbsolutePath());
    });
    MavenSettings mavenSettings = new MavenSettings();
    mavenSettings.setLoggingLevel(MavenTerminal.LEVEL_INFO);
    mavenSettings.setMavenHome(new File(System.getenv("M2_HOME")));
    mavenSettings.setGlobalSettings(new File(System.getProperty("user.home"), ".m2/settings.xml"));
    File localRepository = new File("target/localrepo");
    localRepository.mkdirs();
    mavenSettings.setLocalRepository(localRepository);
    mavenServer = new MavenServerImpl(mavenSettings);
    mavenServer.setComponents(null, true, (level, message, throwable) -> {
        System.out.println(message);
    }, new MavenServerProgressNotifier() {

        @Override
        public void setText(String text) throws RemoteException {
            System.out.println(text);
        }

        @Override
        public void setPercent(double percent) throws RemoteException {
        }

        @Override
        public void setPercentUndefined(boolean undefined) throws RemoteException {
        }

        @Override
        public boolean isCanceled() throws RemoteException {
            return false;
        }
    }, true);
}
Also used : RemoteException(java.rmi.RemoteException) File(java.io.File) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 84 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project che by eclipse.

the class MachineProviderImplTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    when(dockerConnectorConfiguration.getDockerHostIp()).thenReturn("123.123.123.123");
    provider = spy(new MachineProviderBuilder().build());
    EnvironmentContext envCont = new EnvironmentContext();
    envCont.setSubject(new SubjectImpl(USER_NAME, "userId", USER_TOKEN, false));
    EnvironmentContext.setCurrent(envCont);
    when(recipeRetriever.getRecipe(any(MachineConfig.class))).thenReturn(new RecipeImpl().withType(DOCKER_FILE_TYPE).withScript("FROM codenvy"));
    when(dockerMachineFactory.createNode(anyString(), anyString())).thenReturn(dockerNode);
    when(dockerConnector.createContainer(any(CreateContainerParams.class))).thenReturn(new ContainerCreated(CONTAINER_ID, new String[0]));
    when(dockerConnector.inspectContainer(any(InspectContainerParams.class))).thenReturn(containerInfo);
    when(containerInfo.getState()).thenReturn(containerState);
    when(containerState.isRunning()).thenReturn(false);
}
Also used : EnvironmentContext(org.eclipse.che.commons.env.EnvironmentContext) ContainerCreated(org.eclipse.che.plugin.docker.client.json.ContainerCreated) InspectContainerParams(org.eclipse.che.plugin.docker.client.params.InspectContainerParams) MachineConfig(org.eclipse.che.api.core.model.machine.MachineConfig) RecipeImpl(org.eclipse.che.api.machine.server.recipe.RecipeImpl) CreateContainerParams(org.eclipse.che.plugin.docker.client.params.CreateContainerParams) Matchers.anyString(org.mockito.Matchers.anyString) SubjectImpl(org.eclipse.che.commons.subject.SubjectImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 85 with BeforeMethod

use of org.testng.annotations.BeforeMethod in project orientdb by orientechnologies.

the class ReadWriteCacheConcurrentTest method beforeMethod.

@BeforeMethod
public void beforeMethod() throws IOException {
    if (writeBuffer != null && readBuffer != null)
        readBuffer.closeStorage(writeBuffer);
    else if (writeBuffer != null)
        writeBuffer.close();
    if (readBuffer != null) {
        readBuffer.clear();
        deleteUsedFiles(FILE_COUNT);
    }
    initBuffer();
    Random random = new Random();
    seed = (byte) (random.nextInt() & 0xFF);
}
Also used : Random(java.util.Random) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

BeforeMethod (org.testng.annotations.BeforeMethod)1078 File (java.io.File)60 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)52 IOException (java.io.IOException)49 DateTime (org.joda.time.DateTime)46 NavigationHelper (org.mifos.test.acceptance.framework.testhelpers.NavigationHelper)42 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)41 LoanTestHelper (org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper)38 Enumeration (java.util.Enumeration)37 Project (com.google.refine.model.Project)33 StringWriter (java.io.StringWriter)26 Properties (java.util.Properties)26 EntityType (org.molgenis.data.meta.model.EntityType)25 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)23 ServletConfig (jakarta.servlet.ServletConfig)22 ServletContext (jakarta.servlet.ServletContext)22 HttpServletRequest (javax.servlet.http.HttpServletRequest)22 AppLauncher (org.mifos.test.acceptance.framework.AppLauncher)22 Subject (javax.security.auth.Subject)21 Attribute (org.molgenis.data.meta.model.Attribute)21