use of org.testng.annotations.BeforeMethod in project che by eclipse.
the class ETagResponseFilterTest method before.
/**
* Setup env for launching requests
* @throws Exception
*/
@BeforeMethod
public void before() throws Exception {
//set up launcher
final ResourceBinderImpl resources = new ResourceBinderImpl();
resources.addResource(MyJaxRSService.class, null);
final DependencySupplierImpl dependencies = new DependencySupplierImpl();
final ApplicationProviderBinder providers = new ApplicationProviderBinder();
providers.addExceptionMapper(ApiExceptionMapper.class);
providers.addResponseFilter(ETagResponseFilter.class);
final URI uri = new URI(BASE_URI);
final ContainerRequest req = new ContainerRequest(null, uri, uri, null, null, null);
final ApplicationContext contextImpl = anApplicationContext().withRequest(req).withProviders(providers).build();
contextImpl.setDependencySupplier(dependencies);
ApplicationContext.setCurrent(contextImpl);
final EverrestProcessor processor = new EverrestProcessor(new EverrestConfiguration(), dependencies, new RequestHandlerImpl(new RequestDispatcher(resources), providers), null);
resourceLauncher = new ResourceLauncher(processor);
}
use of org.testng.annotations.BeforeMethod in project che by eclipse.
the class FlywaySchemaInitializerTest method setUp.
@BeforeMethod
public void setUp() throws URISyntaxException {
dataSource = new JdbcDataSource();
dataSource.setUrl("jdbc:h2:mem:flyway_test;DB_CLOSE_DELAY=-1");
}
use of org.testng.annotations.BeforeMethod in project che by eclipse.
the class DockerAbandonedResourcesCleanerTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
networks = new ArrayList<>();
abandonedNetworkContainers = new HashMap<>();
usedNetworkContainers = new HashMap<>();
when(dockerConnectorProvider.get()).thenReturn(dockerConnector);
cleaner = spy(new DockerAbandonedResourcesCleaner(environmentEngine, dockerConnectorProvider, nameGenerator, workspaceRuntimes, additionalNetworks));
when(environmentEngine.getMachine(workspaceId1, machineId1)).thenReturn(instance);
when(environmentEngine.getMachine(workspaceId2, machineId2)).thenThrow(new NotFoundException("test"));
when(machineImpl1.getId()).thenReturn(machineId1);
when(machineImpl1.getWorkspaceId()).thenReturn(workspaceId1);
when(dockerConnector.listContainers()).thenReturn(asList(container1, container2, container3));
when(container1.getNames()).thenReturn(new String[] { containerName1 });
when(container1.getStatus()).thenReturn(RUNNING_STATUS);
when(container1.getId()).thenReturn(containerId1);
when(container2.getNames()).thenReturn(new String[] { containerName2 });
when(container2.getStatus()).thenReturn(RUNNING_STATUS);
when(container2.getId()).thenReturn(containerId2);
when(container3.getNames()).thenReturn(new String[] { containerName3 });
when(container3.getStatus()).thenReturn(RUNNING_STATUS);
when(container3.getId()).thenReturn(containerId3);
when(nameGenerator.parse(containerName1)).thenReturn(of(containerNameInfo1));
when(nameGenerator.parse(containerName2)).thenReturn(of(containerNameInfo2));
when(nameGenerator.parse(containerName3)).thenReturn(of(containerNameInfo3));
when(containerNameInfo1.getMachineId()).thenReturn(machineId1);
when(containerNameInfo1.getWorkspaceId()).thenReturn(workspaceId1);
when(containerNameInfo2.getMachineId()).thenReturn(machineId2);
when(containerNameInfo2.getWorkspaceId()).thenReturn(workspaceId2);
when(containerNameInfo3.getMachineId()).thenReturn(machineId2);
when(containerNameInfo3.getWorkspaceId()).thenReturn(workspaceId2);
when(dockerConnector.getNetworks(any())).thenReturn(networks);
when(abandonedNetwork.getId()).thenReturn(abandonedNetworkId);
when(usedNetwork.getId()).thenReturn(usedNetworkId);
when(additionalNetwork.getId()).thenReturn(abandonedNetworkId);
when(abandonedNetwork.getName()).thenReturn(abandonedNetworkName);
when(usedNetwork.getName()).thenReturn(usedNetworkName);
when(additionalNetwork.getName()).thenReturn(abandonedNetworkName);
when(abandonedNetwork.getContainers()).thenReturn(abandonedNetworkContainers);
when(usedNetwork.getContainers()).thenReturn(usedNetworkContainers);
when(additionalNetwork.getContainers()).thenReturn(additionalNetworkContainers);
}
use of org.testng.annotations.BeforeMethod in project che by eclipse.
the class DockerProcessTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
dockerConnectorConfiguration = new DockerConnectorConfiguration(new InitialAuthConfig(), new DefaultNetworkFinder());
docker = new DockerConnector(dockerConnectorConfiguration, new DockerConnectionFactory(dockerConnectorConfiguration), new DockerRegistryAuthResolver(null, null), new DockerApiVersionPathPrefixProvider("1.18"));
final ContainerCreated containerCreated = docker.createContainer(CreateContainerParams.create(new ContainerConfig().withImage("ubuntu").withCmd("tail", "-f", "/dev/null")));
container = containerCreated.getId();
docker.startContainer(StartContainerParams.create(containerCreated.getId()));
when(dockerConnectorProvider.get()).thenReturn(docker);
}
use of org.testng.annotations.BeforeMethod in project che by eclipse.
the class ZendDbgConfigurationTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
ZendDbgSettings dbgSettings = new ZendDbgSettings(DEBUG_PORT, DEBUG_HOST, true, false);
debugger = new ZendDebugger(dbgSettings, null, null);
}
Aggregations