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