Search in sources :

Example 6 with DatastoreAdapter

use of org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter in project pnc by project-ncl.

the class DatastoreAdapterTest method shouldStoreRepositoryManagerSuccessResult.

@Test
public void shouldStoreRepositoryManagerSuccessResult() throws DatastoreException {
    // given
    DatastoreMock datastore = new DatastoreMock();
    DatastoreAdapter datastoreAdapter = new DatastoreAdapter(datastore);
    BuildStatus buildStatus = BuildStatus.SUCCESS;
    CompletionStatus completionStatus = CompletionStatus.SUCCESS;
    // when
    storeResult(datastoreAdapter, buildStatus, completionStatus);
    // then
    List<BuildRecord> buildRecords = datastore.getBuildRecords();
    Assert.assertEquals(1, buildRecords.size());
    BuildRecord buildRecord = buildRecords.get(0);
    Assert.assertEquals(buildRecord.getStatus(), BuildStatus.SUCCESS);
    Assert.assertTrue(buildRecord.getBuildLog().contains(BUILD_LOG));
    Assert.assertTrue(buildRecord.getBuildLog().contains(REPOSITORY_MANAGER_LOG));
}
Also used : CompletionStatus(org.jboss.pnc.spi.coordinator.CompletionStatus) DatastoreMock(org.jboss.pnc.mock.datastore.DatastoreMock) BuildStatus(org.jboss.pnc.enums.BuildStatus) DatastoreAdapter(org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter) BuildRecord(org.jboss.pnc.model.BuildRecord) Test(org.junit.Test)

Example 7 with DatastoreAdapter

use of org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter in project pnc by project-ncl.

the class BuildCoordinatorFactory method createBuildCoordinator.

public BuildCoordinatorBeans createBuildCoordinator(DatastoreMock datastore) {
    DatastoreAdapter datastoreAdapter = new DatastoreAdapter(datastore);
    SystemConfig systemConfig = createConfiguration();
    BuildQueue queue = new BuildQueue(systemConfig);
    LocalBuildSchedulerMock localBuildScheduler = new LocalBuildSchedulerMock();
    BuildSchedulerFactory buildSchedulerFactory = new BuildSchedulerFactory() {

        @Override
        public BuildScheduler getBuildScheduler() {
            return localBuildScheduler;
        }
    };
    BuildCoordinator coordinator = new DefaultBuildCoordinator(datastoreAdapter, buildStatusChangedEventNotifier, buildSetStatusChangedEventNotifier, buildSchedulerFactory, queue, systemConfig, groupBuildMapper, buildMapper);
    localBuildScheduler.setBuildCoordinator(coordinator);
    coordinator.start();
    queue.initSemaphore();
    return new BuildCoordinatorBeans(queue, coordinator);
}
Also used : BuildQueue(org.jboss.pnc.coordinator.builder.BuildQueue) BuildCoordinator(org.jboss.pnc.spi.coordinator.BuildCoordinator) DefaultBuildCoordinator(org.jboss.pnc.coordinator.builder.DefaultBuildCoordinator) SystemConfig(org.jboss.pnc.common.json.moduleconfig.SystemConfig) BuildSchedulerFactory(org.jboss.pnc.coordinator.builder.BuildSchedulerFactory) DatastoreAdapter(org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter) DefaultBuildCoordinator(org.jboss.pnc.coordinator.builder.DefaultBuildCoordinator)

Aggregations

DatastoreAdapter (org.jboss.pnc.coordinator.builder.datastore.DatastoreAdapter)7 DatastoreMock (org.jboss.pnc.mock.datastore.DatastoreMock)5 BuildRecord (org.jboss.pnc.model.BuildRecord)5 Test (org.junit.Test)5 SystemConfig (org.jboss.pnc.common.json.moduleconfig.SystemConfig)3 BuildQueue (org.jboss.pnc.coordinator.builder.BuildQueue)3 DefaultBuildCoordinator (org.jboss.pnc.coordinator.builder.DefaultBuildCoordinator)3 BuildStatus (org.jboss.pnc.enums.BuildStatus)2 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)2 BuildCoordinator (org.jboss.pnc.spi.coordinator.BuildCoordinator)2 CompletionStatus (org.jboss.pnc.spi.coordinator.CompletionStatus)2 BuildExecutionConfiguration (org.jboss.pnc.spi.executor.BuildExecutionConfiguration)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 BpmTask (org.jboss.pnc.bpm.BpmTask)1 BuildResultRest (org.jboss.pnc.bpm.model.BuildResultRest)1 Configuration (org.jboss.pnc.common.Configuration)1 BuildSchedulerFactory (org.jboss.pnc.coordinator.builder.BuildSchedulerFactory)1 DefaultDatastore (org.jboss.pnc.datastore.DefaultDatastore)1 TestProjectConfigurationBuilder (org.jboss.pnc.mock.model.builders.TestProjectConfigurationBuilder)1 ArtifactRepositoryMock (org.jboss.pnc.mock.repository.ArtifactRepositoryMock)1