Search in sources :

Example 6 with BeforeMethod

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);
}
Also used : DependencySupplierImpl(org.everrest.core.tools.DependencySupplierImpl) ApplicationProviderBinder(org.everrest.core.impl.ApplicationProviderBinder) ApplicationContext.anApplicationContext(org.everrest.core.ApplicationContext.anApplicationContext) ApplicationContext(org.everrest.core.ApplicationContext) EverrestConfiguration(org.everrest.core.impl.EverrestConfiguration) RequestHandlerImpl(org.everrest.core.impl.RequestHandlerImpl) ResourceBinderImpl(org.everrest.core.impl.ResourceBinderImpl) ContainerRequest(org.everrest.core.impl.ContainerRequest) URI(java.net.URI) EverrestProcessor(org.everrest.core.impl.EverrestProcessor) ResourceLauncher(org.everrest.core.tools.ResourceLauncher) RequestDispatcher(org.everrest.core.impl.RequestDispatcher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 7 with BeforeMethod

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");
}
Also used : JdbcDataSource(org.h2.jdbcx.JdbcDataSource) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 8 with BeforeMethod

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);
}
Also used : NotFoundException(org.eclipse.che.api.core.NotFoundException) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 9 with BeforeMethod

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);
}
Also used : ContainerConfig(org.eclipse.che.plugin.docker.client.json.ContainerConfig) DockerRegistryAuthResolver(org.eclipse.che.plugin.docker.client.DockerRegistryAuthResolver) ContainerCreated(org.eclipse.che.plugin.docker.client.json.ContainerCreated) DockerConnector(org.eclipse.che.plugin.docker.client.DockerConnector) DockerConnectorConfiguration(org.eclipse.che.plugin.docker.client.DockerConnectorConfiguration) InitialAuthConfig(org.eclipse.che.plugin.docker.client.InitialAuthConfig) DockerApiVersionPathPrefixProvider(org.eclipse.che.plugin.docker.client.DockerApiVersionPathPrefixProvider) DefaultNetworkFinder(org.eclipse.che.plugin.docker.client.helper.DefaultNetworkFinder) DockerConnectionFactory(org.eclipse.che.plugin.docker.client.connection.DockerConnectionFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 10 with BeforeMethod

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);
}
Also used : ZendDbgSettings(org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings) 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