jetbrains.buildServer.serverSide.BuildServerListener Java Examples
The following examples show how to use
jetbrains.buildServer.serverSide.BuildServerListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KubePodNameGeneratorImpl.java From teamcity-kubernetes-plugin with Apache License 2.0 | 6 votes |
public KubePodNameGeneratorImpl(@NotNull ServerPaths serverPaths, @NotNull ExecutorServices executorServices, @NotNull EventDispatcher<BuildServerListener> eventDispatcher ){ myIdxStorage = new File(serverPaths.getPluginDataDirectory(), "kubeIdx"); if (!myIdxStorage.exists()){ myIdxStorage.mkdirs(); } if (!myIdxStorage.isDirectory()){ throw new CloudException("Unable to create a directory for kube plugin VM indexes"); } myIsAvailable = new AtomicBoolean(true); loadIdxes(myIdxStorage); eventDispatcher.addListener(new BuildServerAdapter(){ @Override public void serverShutdown() { myIsAvailable.set(false); storeIdxes(); } }); executorServices.getNormalExecutorService().scheduleWithFixedDelay(this::storeIdxes, 60, 60, TimeUnit.SECONDS); }
Example #2
Source File: SimpleRunContainerProviderTest.java From teamcity-kubernetes-plugin with Apache License 2.0 | 6 votes |
@BeforeMethod public void setUp() throws Exception { super.setUp(); myServerSettings = new ServerSettingsImpl(){ @Nullable @Override public String getServerUUID() { return "SERVER-UUID"; } }; final TempFiles tempFiles = new TempFiles(); myServerPaths = new ServerPaths(tempFiles.createTempDir()); myExecutorServices = new SimpleExecutorServices(); myEventDispatcher = EventDispatcher.create(BuildServerListener.class); myNameGenerator = new KubePodNameGeneratorImpl(myServerPaths, myExecutorServices, myEventDispatcher); myContainerProvider = new SimpleRunContainerProvider(myServerSettings); myPodTemplateProviders = new BuildAgentPodTemplateProvidersImpl(myServerSettings, (name, kubeClientParams) -> null); }
Example #3
Source File: DeploymentBuildAgentPodTemplateProviderTest.java From teamcity-kubernetes-plugin with Apache License 2.0 | 6 votes |
@BeforeMethod @Override protected void setUp() throws Exception { super.setUp(); m = new Mockery(); ServerSettings serverSettings = m.mock(ServerSettings.class); KubeAuthStrategyProvider authStrategies = m.mock(KubeAuthStrategyProvider.class); myDeploymentContentProvider = m.mock(DeploymentContentProvider.class); final ExecutorServices executorServices = m.mock(ExecutorServices.class); m.checking(new Expectations(){{ allowing(serverSettings).getServerUUID(); will(returnValue("server uuid")); allowing(authStrategies).get(with(UnauthorizedAccessStrategy.ID)); will(returnValue(myAuthStrategy)); ScheduledExecutorService ses = new ScheduledThreadPoolExecutor(1); allowing(executorServices).getNormalExecutorService(); will(returnValue(ses)); }}); TempFiles tempFiles = new TempFiles(); final ServerPaths serverPaths = new ServerPaths(tempFiles.createTempDir()); final EventDispatcher<BuildServerListener> eventDispatcher = EventDispatcher.create(BuildServerListener.class); myNameGenerator = new KubePodNameGeneratorImpl(serverPaths, executorServices, eventDispatcher); myPodTemplateProvider = new DeploymentBuildAgentPodTemplateProvider(serverSettings, myDeploymentContentProvider); }
Example #4
Source File: ReportsFeature.java From appengine-tck with Apache License 2.0 | 6 votes |
public ReportsFeature(EventDispatcher<BuildServerListener> dispatcher, @NotNull ReportsDescriptor descriptor, @NotNull ReportsConstants constants) { this.editParametersUrl = descriptor.getFeaturePath(); this.constants = constants; this.jsonFactory = JacksonFactory.getDefaultInstance(); try { this.httpTransport = GoogleNetHttpTransport.newTrustedTransport(); } catch (GeneralSecurityException | IOException e) { throw new RuntimeException(e); } if (dispatcher != null) { dispatcher.addListener(new BuildServerAdapter() { @Override public void buildFinished(SRunningBuild build) { handleBuildFinished(build); } }); } }