protected void setupPostBuildCheckIn(AbstractBuild<?, ?> build) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); buildListener = new StreamBuildListener(out); IntegrityConfigurable configObj = DescriptorImpl.INTEGRITY_DESCRIPTOR.getConfigurations().get(0); IntegrityCheckinTask ciTask = new IntegrityCheckinTask("#/Vipin_main", ".", "*.*", "", build, buildListener, configObj); build.getWorkspace().act(ciTask); }
protected void setupIntegrityConfigurable() { IntegrityConfigurable configObj = new IntegrityConfigurable( "server1", "ppumsv-ipdc16d.ptcnet.ptc.com", 7001, "ppumsv-ipdc16d.ptcnet.ptc.com", 7001, false, "developer", "password"); FakeAPISession api = FakeAPISession.create(configObj); List<IntegrityConfigurable> configurations = new ArrayList<IntegrityConfigurable>(); configurations.add(configObj); DescriptorImpl.INTEGRITY_DESCRIPTOR.setConfigurations(configurations); }
/** * Parses the output from the si viewproject command to get a list of members and updates Derby DB * * @param workItems WorkItemIterator * @throws APIException * @throws SQLException * @throws InterruptedException * @throws ExecutionException */ public void parseProject(WorkItemIterator workItems) throws APIException, SQLException, InterruptedException, ExecutionException { ExecutorService executor = null; Map<String, String> pjConfigHash = new Hashtable<String, String>(); List<Future<Void>> futures = new ArrayList<Future<Void>>(); // Setup the Derby DB for this Project // Create a fresh set of tables for this project DerbyUtils.createCMProjectTables( DescriptorImpl.INTEGRITY_DESCRIPTOR.getDataSource(), this.getProjectCacheTable()); LOGGER.log(Level.INFO, "Starting Parse tasks for Derby DB"); final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("Parse-Derby-Project-Task-%d").build(); // Initialize executor for folder path processing executor = Executors.newFixedThreadPool(10, threadFactory); pjConfigHash.put(this.getProjectName(), this.getConfigurationPath()); while (workItems.hasNext()) { WorkItem wi = workItems.next(); if (wi.getModelType().equals(SIModelTypeName.SI_SUBPROJECT)) { // Parse folders separately from members in an asynchronous environment. This is to be // executed before member parsing! LOGGER.log( Level.FINE, "Executing parse folder task :" + wi.getField("name").getValueAsString()); Map<String, String> future = executor.submit(new ParseProjectFolderTask(wi, this)).get(); for (String key : future.keySet()) { LOGGER.log( Level.FINE, "Adding folder key in project configuration. Key: " + key + ", Value: " + future.get(key)); pjConfigHash.put(key, future.get(key)); } } else if (wi.getModelType().equals(SIModelTypeName.MEMBER)) { // Parse member tasks LOGGER.log( Level.FINE, "Executing parse member task :" + wi.getField("name").getValueAsString()); futures.add(executor.submit(new ParseProjectMemberTask(wi, pjConfigHash, this))); } else { LOGGER.log( Level.WARNING, "View project output contains an invalid model type: " + wi.getModelType()); } } for (Future<Void> f : futures) { // Wait for all threads to finish f.get(); } LOGGER.log(Level.INFO, "Parsing project " + this.getConfigurationPath() + " complete!"); if (null != executor) { executor.shutdown(); executor.awaitTermination(2, TimeUnit.MINUTES); LOGGER.log(Level.FINE, "Parse Project Executor shutdown."); } }