Search in sources :

Example 11 with BeforeMethod

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

the class FactoryDaoTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    factories = new FactoryImpl[ENTRY_COUNT];
    users = new UserImpl[ENTRY_COUNT];
    for (int i = 0; i < ENTRY_COUNT; i++) {
        users[i] = new UserImpl("userId_" + i, "email_" + i, "name" + i);
    }
    for (int i = 0; i < ENTRY_COUNT; i++) {
        factories[i] = createFactory(i, users[i].getId());
    }
    userTckRepository.createAll(Arrays.asList(users));
    factoryTckRepository.createAll(Stream.of(factories).map(FactoryImpl::new).collect(toList()));
}
Also used : UserImpl(org.eclipse.che.api.user.server.model.impl.UserImpl) FactoryImpl(org.eclipse.che.api.factory.server.model.impl.FactoryImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 12 with BeforeMethod

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

the class JGitConnectionTest method setup.

@BeforeMethod
public void setup() {
    jGitConnection = spy(new JGitConnection(repository, credentialsLoader, sshKeyProvider, userResolver));
    RepositoryState repositoryState = mock(RepositoryState.class);
    GitUser gitUser = mock(GitUser.class);
    when(repositoryState.canAmend()).thenReturn(true);
    when(repositoryState.canCommit()).thenReturn(true);
    when(repository.getRepositoryState()).thenReturn(repositoryState);
    when(gitUser.getName()).thenReturn("username");
    when(gitUser.getEmail()).thenReturn("email");
    when(userResolver.getUser()).thenReturn(gitUser);
}
Also used : RepositoryState(org.eclipse.jgit.lib.RepositoryState) GitUser(org.eclipse.che.api.git.shared.GitUser) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 13 with BeforeMethod

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

the class WorkspaceRuntimeIntegrationTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    CheEnvironmentEngine environmentEngine = new CheEnvironmentEngine(snapshotDao, machineInstanceProviders, "/tmp", 2000, eventService, environmentParser, new DefaultServicesStartStrategy(), instanceProvider, infrastructureProvisioner, "http://localhost:8080/api", recipeDownloader, containerNameGenerator, agentRegistry, sharedPool);
    runtimes = new WorkspaceRuntimes(eventService, environmentEngine, agentSorter, launcherFactory, agentRegistry, snapshotDao, sharedPool);
    executor = Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setNameFormat(this.getClass().toString() + "-%d").build());
    EnvironmentContext.getCurrent().setSubject(new SubjectImpl("name", "id", "token", false));
}
Also used : CheEnvironmentEngine(org.eclipse.che.api.environment.server.CheEnvironmentEngine) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) DefaultServicesStartStrategy(org.eclipse.che.api.environment.server.DefaultServicesStartStrategy) SubjectImpl(org.eclipse.che.commons.subject.SubjectImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 14 with BeforeMethod

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

the class ProfileServiceTest method setUp.

@BeforeMethod
public void setUp() throws NotFoundException, ServerException {
    when(linksInjector.injectLinks(any(), any())).thenAnswer(inv -> inv.getArguments()[0]);
    when(profileManager.getById(SUBJECT.getUserId())).thenReturn(new ProfileImpl(SUBJECT.getUserId()));
}
Also used : ProfileImpl(org.eclipse.che.api.user.server.model.impl.ProfileImpl) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 15 with BeforeMethod

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

the class JpaUserDaoTest method setup.

@BeforeMethod
public void setup() throws Exception {
    EntityManager entityManager = mock(EntityManager.class);
    when(entityManager.createNamedQuery(anyString(), anyObject())).thenReturn(typedQuery);
    when(managerProvider.get()).thenReturn(entityManager);
    when(typedQuery.setMaxResults(anyInt())).thenReturn(typedQuery);
    when(typedQuery.setFirstResult(anyInt())).thenReturn(typedQuery);
    when(typedQuery.setFirstResult(anyInt())).thenReturn(typedQuery);
}
Also used : EntityManager(javax.persistence.EntityManager) 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