Search in sources :

Example 11 with SystemConfig

use of org.jboss.pnc.common.json.moduleconfig.SystemConfig in project pnc by project-ncl.

the class MessageSenderProviderTest method shouldNotGetMessageSenderWithInvalidId.

@Test
public void shouldNotGetMessageSenderWithInvalidId() {
    // given
    Instance<MessageSender> messageSenders = getMessageSenders();
    SystemConfig systemConfig = Mockito.mock(SystemConfig.class);
    Mockito.when(systemConfig.getMessageSenderId()).thenReturn("invalidId");
    Exception exception = null;
    // when
    try {
        new MessageSenderProvider(messageSenders, systemConfig);
    } catch (MessagingConfigurationException e) {
        exception = e;
    }
    // expect
    Assert.assertTrue(exception instanceof MessagingConfigurationException);
}
Also used : SystemConfig(org.jboss.pnc.common.json.moduleconfig.SystemConfig) MessageSender(org.jboss.pnc.messaging.spi.MessageSender) MessagingConfigurationException(org.jboss.pnc.messaging.spi.MessagingConfigurationException) MessagingConfigurationException(org.jboss.pnc.messaging.spi.MessagingConfigurationException) Test(org.junit.Test)

Example 12 with SystemConfig

use of org.jboss.pnc.common.json.moduleconfig.SystemConfig 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)

Example 13 with SystemConfig

use of org.jboss.pnc.common.json.moduleconfig.SystemConfig in project pnc by project-ncl.

the class KeycloakServiceClientTest method shouldObtainAuthToken.

@Test
public void shouldObtainAuthToken() throws ConfigurationParseException, IOException {
    SystemConfig systemConfig = SystemConfigMock.withKeycloakServiceAccount();
    KeycloakServiceClient keycloakServiceClient = new DefaultKeycloakServiceClient(systemConfig);
    String authToken = keycloakServiceClient.getAuthToken();
    Assertions.assertThat(authToken).isNotEmpty();
}
Also used : SystemConfig(org.jboss.pnc.common.json.moduleconfig.SystemConfig) DefaultKeycloakServiceClient(org.jboss.pnc.auth.DefaultKeycloakServiceClient) DefaultKeycloakServiceClient(org.jboss.pnc.auth.DefaultKeycloakServiceClient) KeycloakServiceClient(org.jboss.pnc.auth.KeycloakServiceClient) DebugTest(org.jboss.pnc.test.category.DebugTest) Test(org.junit.Test)

Aggregations

SystemConfig (org.jboss.pnc.common.json.moduleconfig.SystemConfig)13 Test (org.junit.Test)9 BuildExecutionConfiguration (org.jboss.pnc.spi.executor.BuildExecutionConfiguration)6 Consumer (java.util.function.Consumer)5 CompletedBuild (org.jboss.pnc.spi.builddriver.CompletedBuild)5 RunningBuild (org.jboss.pnc.spi.builddriver.RunningBuild)5 BuildDriverException (org.jboss.pnc.spi.builddriver.exception.BuildDriverException)5 RunningEnvironment (org.jboss.pnc.spi.environment.RunningEnvironment)5 BuildExecutionSession (org.jboss.pnc.spi.executor.BuildExecutionSession)5 Mockito.doReturn (org.mockito.Mockito.doReturn)5 Mockito.mock (org.mockito.Mockito.mock)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 Status (org.jboss.pnc.buildagent.api.Status)4 TaskStatusUpdateEvent (org.jboss.pnc.buildagent.api.TaskStatusUpdateEvent)4 IOException (java.io.IOException)3 MethodHandles (java.lang.invoke.MethodHandles)3 Files (java.nio.file.Files)3 Path (java.nio.file.Path)3 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)3