use of org.jboss.pnc.mock.repository.BuildConfigurationRepositoryMock 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();
}
use of org.jboss.pnc.mock.repository.BuildConfigurationRepositoryMock in project pnc by project-ncl.
the class OutsideGroupDependentConfigsTest method initialize.
@Before
public void initialize() throws DatastoreException, ConfigurationParseException {
config1 = buildConfig("1");
configA = buildConfig("A", config1);
configB = buildConfig("B", configA);
BuildConfiguration configC = buildConfig("C");
configSet = configSet(configA, configB, configC);
buildConfigurationRepository = spy(new BuildConfigurationRepositoryMock());
when(buildConfigurationRepository.queryWithPredicates(any())).thenReturn(new ArrayList<>(configSet.getBuildConfigurations()));
super.initialize();
saveConfig(config1);
configSet.getBuildConfigurations().forEach(this::saveConfig);
insertNewBuildRecords(config1, configA, configB, configC);
makeResult(configA).dependOn(config1);
}
Aggregations