use of org.jboss.pnc.spi.datastore.repositories.TargetRepositoryRepository in project pnc by project-ncl.
the class AbstractDependentBuildTest method initialize.
@Before
@SuppressWarnings("unchecked")
public void initialize() throws DatastoreException, ConfigurationParseException {
MockitoAnnotations.initMocks(this);
builtTasks = new ArrayList<>();
user = new User();
user.setId(375939);
user.setUsername("username");
Configuration config = mock(Configuration.class);
SystemConfig systemConfig = mock(SystemConfig.class);
when(systemConfig.getCoordinatorThreadPoolSize()).thenReturn(1);
when(systemConfig.getCoordinatorMaxConcurrentBuilds()).thenReturn(1);
when(systemConfig.getTemporaryBuildsLifeSpan()).thenReturn(1);
when(config.getModuleConfig(any())).thenReturn(systemConfig);
buildQueue = new BuildQueue(config.getModuleConfig(new PncConfigProvider<>(SystemConfig.class)));
if (buildConfigurationRepository == null) {
buildConfigurationRepository = new BuildConfigurationRepositoryMock();
}
buildRecordRepository = new BuildRecordRepositoryMock();
buildConfigurationAuditedRepository = new BuildConfigurationAuditedRepositoryMock();
TargetRepositoryRepository targetRepositoryRepository = new TargetRepositoryRepositoryMock();
DefaultDatastore datastore = new DefaultDatastore(new ArtifactRepositoryMock(), buildRecordRepository, buildConfigurationRepository, buildConfigurationAuditedRepository, new BuildConfigSetRecordRepositoryMock(), new UserRepositoryMock(), targetRepositoryRepository);
DatastoreAdapter datastoreAdapter = new DatastoreAdapter(datastore);
if (buildSchedulerFactory == null) {
buildSchedulerFactory = new MockBuildSchedulerFactory();
}
coordinator = new DefaultBuildCoordinator(datastoreAdapter, mock(Event.class), mock(Event.class), buildSchedulerFactory, buildQueue, systemConfig, mock(GroupBuildMapper.class), mock(BuildMapper.class));
buildQueue.initSemaphore();
coordinator.start();
}
Aggregations