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();
}
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);
}
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);
}
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);
}
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);
}
Aggregations