auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Factory updateFactory(@ApiParam(value = "Factory ID", required = true) @PathParam("id") String id, Factory newFactory) throws ForbiddenException, NotFoundException, ApiException { final User user = EnvironmentContext.getCurrent().getUser(); if (user == null) { throw new ForbiddenException("No authenticated user"); } Factory existingFactory = factoryStore.getFactory(id); if (existingFactory == null) { throw new NotFoundException("Factory with id " + id + " does not exist."); } String userId = user.getId(); factoryEditValidator.validate(existingFactory, userId); Author newAuthor = newFactory.getCreator(); if (newAuthor == null) { newAuthor = DtoFactory.getInstance().createDto(Author.class); newFactory.setCreator(newAuthor); } if (newAuthor.getUserId() == null) { newAuthor.setUserId(user.getId()); } newFactory.getCreator().withCreated(existingFactory.getCreator().getCreated()); newFactory.setId(existingFactory.getId()); createValidator.validateOnCreate(newFactory); try { newFactory.setLinks(linksHelper.createLinks(newFactory, factoryStore.getFactoryImages(id, null), uriInfo)); } catch (UnsupportedEncodingException e) { throw new ConflictException(e.getLocalizedMessage()); } factoryStore.updateFactory(id, newFactory); return newFactory; }

Target:
public Factory updateFactory(@ApiParam(value = "Factory ID", required = true) @PathParam("id") String id, Factory newFactory) throws ForbiddenException, NotFoundException, ApiException { if (newFactory == null) { throw new ServerException("The updating factory shouldn't be null"); } Factory existingFactory = factoryStore.getFactory(id); if (existingFactory == null) { throw new NotFoundException("Factory with id " + id + " does not exist."); } final User user = EnvironmentContext.getCurrent().getUser(); String userId = user.getId(); factoryEditValidator.validate(existingFactory, userId); Author newAuthor = newFactory.getCreator(); if (newAuthor == null || newAuthor.getUserId() == null) { newAuthor = DtoFactory.getInstance().createDto(Author.class); newFactory.setCreator(newAuthor); } if (newAuthor.getUserId() == null) { newAuthor.setUserId(user.getId()); } newFactory.getCreator().withCreated(existingFactory.getCreator().getCreated()); newFactory.setId(existingFactory.getId()); createValidator.validateOnCreate(newFactory); factoryStore.updateFactory(id, newFactory); try { newFactory.setLinks(linksHelper.createLinks(newFactory, factoryStore.getFactoryImages(id, null), uriInfo)); } catch (UnsupportedEncodingException e) { throw new ServerException(e.getLocalizedMessage()); } return newFactory; }
Source:
public boolean create(String roomName, String subject, HashMap<String, String> customConfigs, List<Jid> occupants) throws NotConnectedException, XmppStringprepException, InterruptedException { MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants); connection.addSyncStanzaListener(messageListener, fromRoomGroupchatFilter); messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter); StanzaFilter responseFilter = new AndFilter(FromMatchesFilter.createBare(room.asDomainBareJid()), new StanzaTypeFilter(IQ.class)); try { IQ responseIq = connection.createPacketCollectorAndSend(responseFilter, createMUCLightIQ) .nextResultOrThrow(); return responseIq.getType().equals(IQ.Type.result); } catch (NoResponseException | XMPPErrorException e) { removeConnectionCallbacks(); return false; } catch (InterruptedException e) { removeConnectionCallbacks(); return false; } }

Target:
public void create(String roomName, String subject, HashMap<String, String> customConfigs, List<Jid> occupants) throws Exception { MUCLightCreateIQ createMUCLightIQ = new MUCLightCreateIQ(room, roomName, occupants); messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter); try { connection.createPacketCollectorAndSend(createMUCLightIQ).nextResultOrThrow(); } catch (InterruptedException | NoResponseException | XMPPErrorException e) { removeConnectionCallbacks(); throw e; } }
Source:
public CustomParseSpec( @JsonProperty("timestampSpec") TimestampSpec timestampSpec, @JsonProperty("dimensionsSpec") DimensionsSpec dimensionsSpec, @JsonProperty("parserClass") String parserClass, @JsonProperty("properties") Map<String, Object> properties ) { super(timestampSpec, dimensionsSpec); this.parserClass = parserClass; this.properties = properties == null ? ImmutableMap.<String, Object>of() : properties; ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = ParseSpec.class.getClassLoader(); } try { constructor = Class.forName(parserClass, true, loader) .getConstructor(TimestampSpec.class, DimensionsSpec.class, Map.class); } catch (Exception e) { throw new IllegalArgumentException(e); } }

Target:
public CustomParseSpec( @JsonProperty("timestampSpec") TimestampSpec timestampSpec, @JsonProperty("dimensionsSpec") DimensionsSpec dimensionsSpec, @JsonProperty("parserClass") String parserClass, @JsonProperty("properties") Map<String, Object> properties ) { super(timestampSpec, dimensionsSpec); this.parserClass = parserClass; this.properties = properties == null ? ImmutableMap.<String, Object>of() : properties; ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { loader = ParseSpec.class.getClassLoader(); } try { constructor = Class.forName(parserClass, true, loader) .getConstructor(TimestampSpec.class, DimensionsSpec.class, Map.class); } catch (Exception e) { throw new IllegalArgumentException( "Failed to find proper constructor of parser `" + parserClass + "` by exception " + e, e ); } }
Source:
public void testCourseInfoPaths() throws Exception { String url = "edxapp://course_info?path_id=course/cosmology-anux-anu-astro4x"; String pathId = Uri.parse(url).getQueryParameter(URLInterceptorWebViewClient.PARAM_PATH_ID); if(pathId.startsWith(URLInterceptorWebViewClient.COURSE)){ pathId = pathId.replaceFirst(URLInterceptorWebViewClient.COURSE,"").trim(); } assertNotNull(pathId); assertEquals("cosmology-anux-anu-astro4x", pathId); print("Path Id - "+pathId); }

Target:
public void testCourseInfoPaths() throws Exception { String url = "edxapp://course_info?path_id=course/cosmology-anux-anu-astro4x"; String pathId = Uri.parse(url).getQueryParameter(URLInterceptorWebViewClient.PARAM_PATH_ID); if(pathId.startsWith(URLInterceptorWebViewClient.COURSE)){ pathId = pathId.replaceFirst(URLInterceptorWebViewClient.COURSE,"").trim(); } assertNotNull(pathId); assertEquals("cosmology-anux-anu-astro4x", pathId); }
Source:
public static String getConcatedTypeNameValues(List<String> typeNames, String typeNameStr, String separator) { if ((typeNames == null) || (typeNames.size() == 0)) { return null; } Map<String, String> typeNameValueMap = getTypeNameValueMap(typeNameStr); StringBuilder sb = new StringBuilder(); for (String key : typeNames) { String result = typeNameValueMap.get(key); if (result != null && !StringUtils.isBlank(result)) { sb.append(result); sb.append(separator); } } return org.apache.commons.lang.StringUtils.chomp(sb.toString(), separator); }

Target:
public static String getConcatedTypeNameValues(List<String> typeNames, String typeNameStr, String separator) { if ((typeNames == null) || (typeNames.size() == 0)) { return null; } Map<String, String> typeNameValueMap = getTypeNameValueMap(typeNameStr); StringBuilder sb = new StringBuilder(); for (String key : typeNames) { String result = typeNameValueMap.get(key); if (result != null) { sb.append(result); sb.append(separator); } } return org.apache.commons.lang.StringUtils.chomp(sb.toString(), separator); }
Source:
protected void activate() { tabsSynchronizer = new SashTabDecorationSynchronizer(sashContainer); sashContainer.addPageLifeCycleListener(pageLifeCycleEventListener); }

Target:
protected void activate() { sashContainer = new SashWindowsContainer(this); sashContainer.setContentProvider(getContentProvider()); sashContainer.createPartControl(parentComposite); tabMouseEventListener = new TabMouseEventListener(sashContainer, getSite()); tabsSynchronizer = new SashTabDecorationSynchronizer(sashContainer); sashContainer.addPageLifeCycleListener(pageLifeCycleEventListener); }
Source:
private void writeThreadPool(XMLExtendedStreamWriter writer, String name, ThreadPoolConfiguration threadPoolConfiguration) throws XMLStreamException { ThreadPoolExecutorFactory<?> threadPoolFactory = threadPoolConfiguration.threadPoolFactory(); if (threadPoolFactory != null) { writer.writeStartElement(THREAD_POOL_FACTORIES.get(threadPoolFactory.getClass().getName())); writer.writeAttribute(Attribute.NAME, name); ThreadFactory threadFactory = threadPoolConfiguration.threadFactory(); if (threadFactory instanceof DefaultThreadFactory) { DefaultThreadFactory tf = (DefaultThreadFactory) threadFactory; writer.writeAttribute(Attribute.THREAD_FACTORY, tf.getName()); } if (threadPoolFactory instanceof BlockingThreadPoolExecutorFactory) { BlockingThreadPoolExecutorFactory pool = (BlockingThreadPoolExecutorFactory) threadPoolFactory; writer.writeAttribute(Attribute.MAX_THREADS, Integer.toString(pool.maxThreads())); writer.writeAttribute(Attribute.CORE_THREADS, Integer.toString(pool.coreThreads())); writer.writeAttribute(Attribute.QUEUE_LENGTH, Integer.toString(pool.queueLength())); writer.writeAttribute(Attribute.KEEP_ALIVE_TIME, Long.toString(pool.keepAlive())); } else if (threadPoolFactory instanceof CachedThreadPoolExecutorFactory) { CachedThreadPoolExecutorFactory pool = (CachedThreadPoolExecutorFactory) threadPoolFactory; } writer.writeEndElement(); } }

Target:
private void writeThreadPool(XMLExtendedStreamWriter writer, String name, ThreadPoolConfiguration threadPoolConfiguration) throws XMLStreamException { ThreadPoolExecutorFactory<?> threadPoolFactory = threadPoolConfiguration.threadPoolFactory(); if (threadPoolFactory != null) { writer.writeStartElement(THREAD_POOL_FACTORIES.get(threadPoolFactory.getClass().getName())); writer.writeAttribute(Attribute.NAME, name); ThreadFactory threadFactory = threadPoolConfiguration.threadFactory(); if (threadFactory instanceof DefaultThreadFactory) { DefaultThreadFactory tf = (DefaultThreadFactory) threadFactory; writer.writeAttribute(Attribute.THREAD_FACTORY, tf.getName()); } if (threadPoolFactory instanceof BlockingThreadPoolExecutorFactory) { BlockingThreadPoolExecutorFactory pool = (BlockingThreadPoolExecutorFactory) threadPoolFactory; writer.writeAttribute(Attribute.MAX_THREADS, Integer.toString(pool.maxThreads())); writer.writeAttribute(Attribute.CORE_THREADS, Integer.toString(pool.coreThreads())); writer.writeAttribute(Attribute.QUEUE_LENGTH, Integer.toString(pool.queueLength())); writer.writeAttribute(Attribute.KEEP_ALIVE_TIME, Long.toString(pool.keepAlive())); } writer.writeEndElement(); } }
Source:
public static Set<?> toSet( Object value ) { if ( value == null || value instanceof NoValue ) { return Collections.emptySet(); } else if ( value instanceof SequenceValue ) { SequenceValue sequenceValue = (SequenceValue) value; Iterator<AnyValue> iterator = sequenceValue.iterator(); Set<AnyValue> set = sequenceValue.iterationPreference() == RANDOM_ACCESS ? new HashSet<>( sequenceValue.length() ) : new HashSet<>(); while ( iterator.hasNext() ) { AnyValue element = iterator.next(); set.add( element ); } return set; } else if ( value instanceof Collection<?> ) { return new HashSet<>( (Collection<?>) value ); } else if ( value instanceof LongStream ) { LongStream stream = (LongStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value instanceof IntStream ) { IntStream stream = (IntStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value instanceof DoubleStream ) { DoubleStream stream = (DoubleStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value.getClass().isArray() ) { int len = Array.getLength( value ); HashSet<Object> collection = new HashSet<>( len ); for ( int i = 0; i < len; i++ ) { collection.add( Array.get( value, i ) ); } return collection; } throw new CypherTypeException( "Don't know how to create a set out of " + value.getClass().getSimpleName(), null ); }

Target:
public static Set<?> toSet( Object value ) { if ( value == null || value == NO_VALUE ) { return Collections.emptySet(); } else if ( value instanceof SequenceValue ) { SequenceValue sequenceValue = (SequenceValue) value; Iterator<AnyValue> iterator = sequenceValue.iterator(); Set<AnyValue> set; if ( sequenceValue.iterationPreference() == RANDOM_ACCESS ) { int length = sequenceValue.length(); set = new HashSet<>( length ); for ( int i = 0; i < length; i++ ) { set.add( sequenceValue.value( i ) ); } } else { set = new HashSet<>(); while ( iterator.hasNext() ) { AnyValue element = iterator.next(); set.add( element ); } } return set; } else if ( value instanceof Collection<?> ) { return new HashSet<>( (Collection<?>) value ); } else if ( value instanceof LongStream ) { LongStream stream = (LongStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value instanceof IntStream ) { IntStream stream = (IntStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value instanceof DoubleStream ) { DoubleStream stream = (DoubleStream) value; return stream.boxed().collect( Collectors.toSet() ); } else if ( value.getClass().isArray() ) { int len = Array.getLength( value ); HashSet<Object> collection = new HashSet<>( len ); for ( int i = 0; i < len; i++ ) { collection.add( Array.get( value, i ) ); } return collection; } throw new CypherTypeException( "Don't know how to create a set out of " + value.getClass().getSimpleName(), null ); }
Source:
public void updateMetadata(String name, String metadataName, Metadata metadata) throws EntityNotFoundException { Product product = null; Metadata updatedMetadata = null; try { product = productManager.load(name); updatedMetadata = product.getMetadata(metadataName); if (updatedMetadata == null || !updatedMetadata.getKey().equals(metadataName)) { log.warning("Exception: metadata not found or wrong " + metadata.getKey()); throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadata)); } } catch (Exception e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class, name, e)); } if (metadata.getDescription()!= null) { updatedMetadata.setDescription(metadata.getDescription()); } updatedMetadata.setValue(metadata.getValue()); try { productManager.update(product); } catch (Exception e) { log.warning("Exception but it works "+ e.getMessage()); } }

Target:
public void updateMetadata(String name, String metadataName, Metadata metadata) throws APIException { Product product = null; Metadata updatedMetadata = null; try { product = productManager.load(name); } catch (Exception e) { log.warning("The product: " + name + " does not exist" + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class, name, e)); } try { updatedMetadata = product.getMetadata(metadataName); } catch (Exception e) { log.warning("Exception: metadata not found or wrong" + metadata.getKey()); throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadata)); } if (metadata.getDescription()!= null) { updatedMetadata.setDescription(metadata.getDescription()); } updatedMetadata.setValue(metadata.getValue()); try { productManager.update(product); } catch (Exception e) { log.warning("Exception but it works " + e.getMessage()); } }
Source:
private ActivityLogEntry(Builder builder) { logTime = builder.logTime; actionServletName = (builder.actionServletName == null) ? Const.ActivityLog.UNKNOWN : builder.actionServletName; actionTimeTaken = builder.actionTimeTaken; actionName = (builder.actionName == null) ? Const.ActivityLog.UNKNOWN : builder.actionName; userRole = (builder.userRole == null) ? Const.ActivityLog.UNKNOWN : builder.userRole; userName = (builder.userName == null) ? Const.ActivityLog.UNKNOWN : builder.userName; userGoogleId = (builder.userGoogleId == null) ? Const.ActivityLog.UNKNOWN : builder.userGoogleId; userEmail = (builder.userEmail == null) ? Const.ActivityLog.UNKNOWN : builder.userEmail; logMessage = (builder.logMessage == null) ? Const.ActivityLog.UNKNOWN : builder.logMessage; actionUrl = (builder.actionUrl == null) ? Const.ActivityLog.UNKNOWN : builder.actionUrl; logId = (builder.logId == null) ? Const.ActivityLog.UNKNOWN : builder.logId; actionTimeTaken = builder.actionTimeTaken; isMasqueradeUserRole = builder.isMasqueradeUserRole; }

Target:
private ActivityLogEntry(Builder builder) { constructFromBuilder(builder); }
Source:
private void archive(Injector injector) throws IOException { ConfigFactory cf = injector.getInstance(ConfigFactory.class); ConfigLoaderManager loader = injector.getInstance(ConfigLoaderManager.class); Path projectPath = (projectDirName == null) ? Paths.get("").toAbsolutePath() : Paths.get(projectDirName).normalize().toAbsolutePath(); injector.getInstance(Archiver.class).createArchive(projectPath, Paths.get(output)); out.println("Created " + output + "."); out.println("Use `" + programName + " upload <path.tar.gz> <project> <revision>` to upload it a server."); out.println(""); out.println(" Examples:"); out.println(" $ " + programName + " upload " + output + " $(basename $(pwd)) -r $(date +%Y%m%d-%H%M%S)"); out.println(" $ " + programName + " upload " + output + " $(git rev-parse --abbrev-ref HEAD) -r $(git rev-parse HEAD)"); out.println(""); }

Target:
private void archive(Injector injector) throws IOException { Path projectPath = (projectDirName == null) ? Paths.get("").toAbsolutePath() : Paths.get(projectDirName).normalize().toAbsolutePath(); injector.getInstance(Archiver.class).createArchive(projectPath, Paths.get(output)); out.println("Created " + output + "."); out.println("Use `" + programName + " upload <path.tar.gz> <project> <revision>` to upload it a server."); out.println(""); out.println(" Examples:"); out.println(" $ " + programName + " upload " + output + " $(basename $(pwd)) -r $(date +%Y%m%d-%H%M%S)"); out.println(" $ " + programName + " upload " + output + " $(git rev-parse --abbrev-ref HEAD) -r $(git rev-parse HEAD)"); out.println(""); }
Source:
public void testEquals() { List args = new ArrayList<String>(); Map map = new HashMap<String,String>(); args.add("foo"); map.put("bar", "baz"); TaskLaunchRequest request = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); TaskLaunchRequest request2 = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(null)); assertFalse(request.equals("nope")); assertTrue(request.equals(request)); assertTrue(request.equals(request2)); TaskLaunchRequest requestDiff = new TaskLaunchRequest("http://oops", Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, args, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, null, null, null); assertTrue(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, map, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, map); assertFalse(request.equals(requestDiff)); assertEquals(request.hashCode(), request.hashCode()); }

Target:
public void testEquals() { List<String> args = new ArrayList<>(); Map<String, String> map = new HashMap<>(); args.add("foo"); map.put("bar", "baz"); TaskLaunchRequest request = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); TaskLaunchRequest request2 = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(null)); assertFalse(request.equals("nope")); assertTrue(request.equals(request)); assertTrue(request.equals(request2)); TaskLaunchRequest requestDiff = new TaskLaunchRequest("http://oops", Collections.EMPTY_LIST, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, args, Collections.EMPTY_MAP, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, null, null, null); assertTrue(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, map, Collections.EMPTY_MAP); assertFalse(request.equals(requestDiff)); requestDiff = new TaskLaunchRequest(URI, Collections.EMPTY_LIST, Collections.EMPTY_MAP, map); assertFalse(request.equals(requestDiff)); assertEquals(request.hashCode(), request.hashCode()); }
Source:
public TmfConstantTransform() { this(new TmfNanoTimestamp(0)); }

Target:
public TmfConstantTransform() { fOffset = 0; }
Source:
public void copyUpdatedMetadata(UpdatedMetaDataTracker other) { int size = updateMetaDataList.size(); for (UpdateMetaData updateMetaData : other.updateMetaDataList) { updateMetaDataList.add(updateMetaData); String key = getKey(normalizeIdentifier(updateMetaData.getDbName()), normalizeIdentifier(updateMetaData.getTableName())); updateMetaDataMap.put(key, size++); } }

Target:
public void copyUpdatedMetadata(UpdatedMetaDataTracker other) { int size = updateMetaDataList.size(); for (UpdateMetaData updateMetaDataOther : other.updateMetaDataList) { String key = getKey(normalizeIdentifier(updateMetaDataOther.getDbName()), normalizeIdentifier(updateMetaDataOther.getTableName())); Integer idx = updateMetaDataMap.get(key); if (idx == null) { updateMetaDataList.add(updateMetaDataOther); updateMetaDataMap.put(key, size++); } else if (updateMetaDataOther.partitionsList != null && updateMetaDataOther.partitionsList.size() != 0) { UpdateMetaData updateMetaData = updateMetaDataList.get(idx); for (Map<String, String> partSpec : updateMetaDataOther.partitionsList) { updateMetaData.addPartition(partSpec); } } } }
Source:
public void addProjectToImport( final ExampleProject exampleProject ) { ListItem li = (ListItem) document.createElement( "li" ); Anchor link = (Anchor) document.createElement( "a" ); link.setTextContent( exampleProject.getName() ); link.setAttribute( "alt", exampleProject.getDescription() ); link.setOnclick( event -> presenter.importProject( exampleProject ) ); li.appendChild( link ); importProjectContainer.appendChild( li ); }

Target:
public void addProjectToImport( final ExampleProject exampleProject ) { final ImportExampleListItemWidget importExampleListItem = importExampleListItemWidgets.get(); importExampleListItem.init( exampleProject.getName(), exampleProject.getDescription(), () -> presenter.importProject( exampleProject ) ); importProjectContainer.appendChild( importExampleListItem.getElement() ); }
Source:
void registerIQ(IQ iq) { for (IQ.Type type : new IQ.Type[]{ IQ.Type.get, IQ.Type.set }) { xmppConnection.registerIQRequestHandler( new AbstractIqRequestHandler(iq.getChildElementName(), iq.getChildElementNamespace(), type, iqHandlerMode) { @Override public IQ handleIQRequest(IQ iqRequest) { if (logger.isDebugEnabled()) { logger.debug( "Received an IQ with type " + type + ": " + iqRequest.toString()); } return handleIq(iqRequest); } } ); } }

Target:
void registerIQ(IQ iq) { for (IQ.Type type : IQ_TYPES) { xmppConnection.registerIQRequestHandler( new AbstractIqRequestHandler(iq.getChildElementName(), iq.getChildElementNamespace(), type, iqHandlerMode) { @Override public IQ handleIQRequest(IQ iqRequest) { if (logger.isDebugEnabled()) { logger.debug( "Received an IQ with type " + type + ": " + iqRequest.toString()); } return handleIq(iqRequest); } } ); } }
Source:
public List<BasicDocumentRevision> leafRevisions(boolean excludeDeleted) { List<BasicDocumentRevision> res = new ArrayList<BasicDocumentRevision>(); for(DocumentRevisionNode obj : leafs()) { BasicDocumentRevision revision = obj.getData(); if(excludeDeleted){ if(!revision.isDeleted()){ res.add(revision); } }else { res.add(revision); } } return res; }

Target:
public List<BasicDocumentRevision> leafRevisions(boolean excludeDeleted) { List<BasicDocumentRevision> res = new ArrayList<BasicDocumentRevision>(); for(DocumentRevisionNode obj : leafs()) { BasicDocumentRevision revision = obj.getData(); if (!excludeDeleted || (excludeDeleted && !revision.isDeleted())){ res.add(revision); } } return res; }
Source:
public void testInitialNamedDeployments() { final String urlSubPathToWebApp = APP_NAME; final String urlSubPathToPageToQuery = ""; log.info("test=initialNamedWarDeployments; entity="+entity+"; app="+entity.getApplication()); Entities.start(entity.getApplication(), ImmutableList.of(loc)); Asserts.succeedsEventually(MutableMap.of("timeout", 60*1000), new Runnable() { public void run() { HttpTestUtils.assertHttpStatusCodeEquals(Urls.mergePaths(entity.getAttribute(WebAppService.ROOT_URL), urlSubPathToWebApp, urlSubPathToPageToQuery), 200); }}); }

Target:
public void testInitialNamedDeployments() { final String urlSubPathToWebApp = APP_NAME; final String urlSubPathToPageToQuery = ""; LOG.info("test=testInitialNamedDeployments; entity="+entity+"; app="+entity.getApplication()); Entities.start(entity.getApplication(), ImmutableList.of(loc)); Asserts.succeedsEventually(MutableMap.of("timeout", 60*1000), new Runnable() { public void run() { String url = Urls.mergePaths(entity.getAttribute(WebAppService.ROOT_URL), urlSubPathToWebApp, urlSubPathToPageToQuery); HttpTestUtils.assertHttpStatusCodeEquals(url, 200); }}); }
Source:
public EnumeratedProperty(String theName, String theDescription, Map<String, E> labelsToChoices, E defaultValue, Class<E> valueType, float theUIOrder) { super(theName, theDescription, defaultValue, theUIOrder); this.valueType = valueType; choicesByLabel = Collections.unmodifiableMap(labelsToChoices); labelsByChoice = Collections.unmodifiableMap(CollectionUtil.invertedMapFrom(choicesByLabel)); }

Target:
public EnumeratedProperty(String theName, String theDescription, Map<String, E> labelsToChoices, E defaultValue, Class<E> valueType, float theUIOrder) { this(theName, theDescription, labelsToChoices, defaultValue, valueType, theUIOrder, false); }
Source:
protected void stop() { if (!isEnabled()) return; long duration = System.nanoTime() - start; requests.update(duration, TimeUnit.NANOSECONDS); if (uri != null) { timer("requests", "uri", uri).update(duration, TimeUnit.NANOSECONDS); } if (method != null) { timer(method + "-requests").update(duration, TimeUnit.NANOSECONDS); if (uri != null) { timer(method + "-requests", uri).update(duration, TimeUnit.NANOSECONDS); } } }

Target:
protected void stop() { if (!isEnabled()) return; long duration = System.nanoTime() - start; requests.update(duration, TimeUnit.NANOSECONDS); if (method != null) { timer(method + "-requests").update(duration, TimeUnit.NANOSECONDS); if (uri != null) { timer(method + "-requests", uri).update(duration, TimeUnit.NANOSECONDS); } } else if (uri != null) { timer("requests", uri).update(duration, TimeUnit.NANOSECONDS); } }
Source:
public List<String> list(final String directory, final String prefix) { try { final List<String> objects = new ArrayList<String>(); final ObjectListing objectListing = amazonS3Client.listObjects(bucketNameForDirectory(directory), prefix); final List<S3ObjectSummary> s3objectSummaries = objectListing.getObjectSummaries(); for (final S3ObjectSummary s3ObjectSummary : s3objectSummaries) { objects.add(s3ObjectSummary.getKey()); } return objects; } catch (final AmazonS3Exception e) { if (missingItemErrorCodes.contains(e.getErrorCode())) { throw new NonExistentItemException("No items found in directory -> " + directory + " with the specified prefix -> " + prefix); } throw e; } }

Target:
public List<FilePath> list(final String directory, final String prefix) { try { final List<FilePath> filePathList = new ArrayList<FilePath>(); final ObjectListing objectListing = amazonS3Client.listObjects(bucketNameForDirectory(directory), prefix); final List<S3ObjectSummary> s3objectSummaries = objectListing.getObjectSummaries(); for (final S3ObjectSummary s3ObjectSummary : s3objectSummaries) { final FilePath filePath = new FilePath(directory, s3ObjectSummary.getKey()); filePathList.add(filePath); } return filePathList; } catch (final AmazonS3Exception e) { throw new PersistenceResourceFailureException("An error occurred obtaining a listing of directory -> " + directory + " with prefix -> " + prefix, e); } }
Source:
public void waitHttp() { String server = String.format("http://localhost:%s", serverPort); httpServer.setPort(serverPort); start(httpServer); parallel().actions( sequential().actions( waitFor() .http() .url(server) ), sequential().actions( http().server(httpServer).receive().head(), http().server(httpServer).respond(HttpStatus.NOT_FOUND), http().server(httpServer).receive().head(), http().server(httpServer).respond(HttpStatus.OK) ) ); doFinally().actions(stop(httpServer)); }

Target:
public void waitHttp() { String server = startHttpServerAndGetUrl(); parallel().actions( sequential().actions( waitFor() .http() .url(server) ), sequential().actions( http().server(httpServer).receive().head(), http().server(httpServer).respond(HttpStatus.NOT_FOUND), http().server(httpServer).receive().head(), http().server(httpServer).respond(HttpStatus.OK) ) ); doFinally().actions(stop(httpServer)); }
Source:
public Network() { vmNetwork = true; description = ""; comment = ""; }

Target:
public Network() { vmNetwork = true; name = ""; description = ""; comment = ""; }
Source:
public void setEnvironment(Cache<Object, Object> cache, Set<Object> inputKeys) { ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry(); PersistenceManager loaderManager = cr.getComponent(PersistenceManager.class); this.stores = loaderManager.getStores(RemoteStore.class); Marshaller marshaller = new MigrationMarshaller(); this.cache = cache; this.cache.addListener(listener); this.executorService = Executors.newFixedThreadPool(threads); try { this.ignoredKey = marshaller.objectToByteBuffer(MIGRATION_MANAGER_HOT_ROD_KNOWN_KEYS); } catch (Exception e) { throw new CacheException(e); } }

Target:
public void setEnvironment(Cache<Object, Object> cache, Set<Object> inputKeys) { ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry(); PersistenceManager loaderManager = cr.getComponent(PersistenceManager.class); this.stores = loaderManager.getStores(RemoteStore.class); Marshaller marshaller = new MigrationMarshaller(); this.cache = cache; this.cache.addFilteredListener(listener, new RemovedFilter<>(), null, Util.asSet(CacheEntryRemoved.class)); DefaultThreadFactory threadFactory = new DefaultThreadFactory(null, 1, THREAD_NAME + "-%t", null, null); this.executorService = Executors.newFixedThreadPool(threads, threadFactory); try { this.ignoredKey = marshaller.objectToByteBuffer(MIGRATION_MANAGER_HOT_ROD_KNOWN_KEYS); } catch (Exception e) { throw new CacheException(e); } }
Source:
public void testExpectedRowsMismatch() throws Exception { XMLConfigParser mockParser = Mockito.mock(XMLConfigParser.class); DataModelResult mockDMR = Mockito.mock(DataModelResult.class); RulesApplier mockRA = Mockito.mock(RulesApplier.class); ThreadTime mockTT = Mockito.mock(ThreadTime.class); Scenario mockScenario = Mockito.mock(Scenario.class); WorkloadExecutor mockWE = Mockito.mock(WorkloadExecutor.class); Query mockQuery = Mockito.mock(Query.class); Mockito.when(mockQuery.getExpectedAggregateRowCount()).thenReturn(1L); MultiThreadedRunner mtr = new MultiThreadedRunner("test", mockQuery, mockDMR, mockTT, 10L, 1000L, true, mockRA, mockScenario, mockWE, mockParser); ResultSet mockRS = Mockito.mock(ResultSet.class); Mockito.when(mockRS.next()).thenReturn(true); Mockito.when(mockRS.getLong(1)).thenReturn(2L); try { mtr.getResults(mockRS, "test_iteration", false); fail(); } catch (RuntimeException e) { } }

Target:
public void testExpectedRowsMismatch() throws Exception { Mockito.when(mockQuery.getExpectedAggregateRowCount()).thenReturn(1L); MultiThreadedRunner mtr = new MultiThreadedRunner("test", mockQuery, mockDMR, mockTT, 10L, 1000L, true, mockRA, mockScenario, mockWE, mockParser); Mockito.when(mockRS.next()).thenReturn(true); Mockito.when(mockRS.getLong(1)).thenReturn(2L); try { mtr.getResults(mockRS, "test_iteration", false,0L); fail(); } catch (RuntimeException e) { } }
Source:
public static Expression rewrite(Expression expression, Session session, Metadata metadata, SqlParser sqlParser, SymbolAllocator symbolAllocator) { requireNonNull(metadata, "metadata is null"); requireNonNull(sqlParser, "sqlParser is null"); checkState(!(expression instanceof GroupingOperation), "GroupingOperation should have been re-written to a FunctionCall before execution"); if (expression instanceof SymbolReference) { return expression; } Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, symbolAllocator.getTypes(), expression, emptyList()); return rewrite(expression, expressionTypes); }

Target:
public static Expression rewrite(Expression expression, Session session, Metadata metadata, SqlParser sqlParser, SymbolAllocator symbolAllocator) { requireNonNull(metadata, "metadata is null"); requireNonNull(sqlParser, "sqlParser is null"); if (expression instanceof SymbolReference) { return expression; } Map<NodeRef<Expression>, Type> expressionTypes = getExpressionTypes(session, metadata, sqlParser, symbolAllocator.getTypes(), expression, emptyList()); return rewrite(expression, expressionTypes); }
Source:
public VariableDeclarationExpr(final Type type, VariableDeclarator var) { setType(type); List<VariableDeclarator> vars = new ArrayList<>(); vars.add(var); setVars(vars); }

Target:
public VariableDeclarationExpr(final Type type, VariableDeclarator var) { setType(type); setVars(Arrays.asList(var)); }
Source:
public UserDataSource(HttpMessage sourceMsg, String param) { super(); String genericUri = createGenericUri(sourceMsg.getRequestHeader().getURI(), param); this.uri = getCachedItem(cachedUris, genericUri); boolean requestUriIsGeneric = sourceMsg.getRequestHeader().getURI().equals(genericUri); if (!requestUriIsGeneric) { this.param = GENERIC_STRING; } else { this.param = getCachedItem(cachedParams, param); } this.stringRepresentation = this.uri + "#" + this.param; }

Target:
public UserDataSource(HttpMessage sourceMsg, String param) { super(); URI originalRequestUri = sourceMsg.getRequestHeader().getURI(); String genericUri = createGenericUri(originalRequestUri, param); this.uri = getCachedItem(cachedUris, genericUri); boolean paramWasReplacedInUri = !originalRequestUri.toString().equals(genericUri); if (paramWasReplacedInUri) { this.param = GENERIC_STRING; } else { this.param = getCachedItem(cachedParams, param); } this.stringRepresentation = this.uri + "#" + this.param; }
Source:
public HashPartitionFunction(final int[] indexes, final int seedIndex) { Preconditions.checkArgument( indexes.length > 0, "HashPartitionFunction requires at least 1 field to hash"); for (int i = 0; i < indexes.length; ++i) { Preconditions.checkArgument( indexes[i] >= 0, "HashPartitionFunction field index %s cannot take negative value %s", i, indexes[i]); } this.indexes = indexes; this.seedIndex = seedIndex % HashUtils.NUM_OF_HASHFUNCTIONS; }

Target:
public HashPartitionFunction(final int[] indexes, final int seedIndex) { Preconditions.checkArgument( indexes.length > 0, "HashPartitionFunction requires at least 1 field to hash"); for (int i = 0; i < indexes.length; ++i) { Preconditions.checkArgument( indexes[i] >= 0, "HashPartitionFunction field index %s cannot take negative value %s", i, indexes[i]); } MyriaArrayUtils.checkSet(indexes); this.indexes = indexes; this.seedIndex = seedIndex % HashUtils.NUM_OF_HASHFUNCTIONS; }
Source:
public int getStateTableIndex(ITimeEvent event) { State state = getEventState(event); if (state != null) { return state.ordinal(); } if (event instanceof TimeEvent) { return INVISIBLE; } return TRANSPARENT; }

Target:
public int getStateTableIndex(ITimeEvent event) { State state = getEventState(event); if (state != null) { return state.ordinal(); } if (event instanceof TimeEvent) { TimeEvent tcEvent = (TimeEvent) event; if (tcEvent.hasValue()) { return INVISIBLE; } } return TRANSPARENT; }
Source:
public void checkpoint() throws TransactionFailureException { Preconditions.checkState(currentTx != null, "Cannot checkpoint tx that has not been started"); persist(); try { currentTx = txClient.checkpoint(currentTx); for (TransactionAware txAware : txAwares) { txAware.startTx(currentTx); } } catch (TransactionNotInProgressException e) { String message = String.format("Transaction %d is not in progress.", currentTx.getWritePointer()); LOG.warn(message, e); abort(new TransactionFailureException(message, e)); } catch (Throwable e) { String message = String.format("Exception from checkpoint for transaction %d.", currentTx.getWritePointer()); LOG.warn(message, e); abort(new TransactionFailureException(message, e)); } }

Target:
public void checkpoint() throws TransactionFailureException { Preconditions.checkState(currentTx != null, "Cannot checkpoint tx that has not been started"); persist(); try { currentTx = txClient.checkpoint(currentTx); for (TransactionAware txAware : txAwares) { txAware.updateTx(currentTx); } } catch (TransactionNotInProgressException e) { String message = String.format("Transaction %d is not in progress.", currentTx.getTransactionId()); LOG.warn(message, e); abort(new TransactionFailureException(message, e)); } catch (Throwable e) { String message = String.format("Exception from checkpoint for transaction %d.", currentTx.getTransactionId()); LOG.warn(message, e); abort(new TransactionFailureException(message, e)); } }
Source:
private static Point getPolygonSansHolesCentroid(Polygon polygon) { final int pointCount = polygon.getPointCount(); double xSum = 0; double ySum = 0; double signedArea = 0; for (int i = 0; i < pointCount; i++) { Point current = polygon.getPoint(i); Point next = (i + 1 == polygon.getPointCount()) ? polygon.getPoint(0) : polygon.getPoint(i + 1); double ladder = current.getX() * next.getY() - next.getX() * current.getY(); xSum += (current.getX() + next.getX()) * ladder; ySum += (current.getY() + next.getY()) * ladder; signedArea += ladder; } return new Point(xSum / (signedArea * 3), ySum / (signedArea * 3)); }

Target:
private static Point getPolygonSansHolesCentroid(Polygon polygon) { int pointCount = polygon.getPointCount(); double xSum = 0; double ySum = 0; double signedArea = 0; for (int i = 0; i < pointCount; i++) { Point current = polygon.getPoint(i); Point next = polygon.getPoint((i + 1) % polygon.getPointCount()); double ladder = current.getX() * next.getY() - next.getX() * current.getY(); xSum += (current.getX() + next.getX()) * ladder; ySum += (current.getY() + next.getY()) * ladder; signedArea += ladder / 2; } return new Point(xSum / (signedArea * 6), ySum / (signedArea * 6)); }
Source:
public void testHasChangeidWithReplacement() throws Exception { assertEquals( "has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: Ibd4de0fdf30dd670b53d123ec1f7036a97fd2687\n", call("has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: I0123456789012345678901234567890123456789\n", true)); }

Target:
public void testHasChangeidWithReplacement() throws Exception { assertEquals( "has changeid\nmore text\n\nSigned-off-by: me@you.too\n" + "Change-Id: I2178563fada5edb2c99a8d8c0d619471b050ec24\nBug: 33\n", call("has changeid\nmore text\n\nSigned-off-by: me@you.too\n" + "Change-Id: I0123456789012345678901234567890123456789\nBug: 33\n", true)); }
Source:
protected void executeQueryCommand() { GlusterVolumeEntity volumeCheck = glusterVolumeDao.getByName(getParameters().getClusterId(), getGlusterVolumeName(getParameters().getVolumeId())); boolean nfs = volumeCheck.isNfsEnabled(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), nfs)); GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) returnValue.getReturnValue(); if (nfs) { populateBrickNames(profileInfo); } getQueryReturnValue().setReturnValue(profileInfo); }

Target:
protected void executeQueryCommand() { GlusterVolumeEntity volumeCheck = glusterVolumeDao.getByName(getParameters().getClusterId(), getGlusterVolumeName(getParameters().getVolumeId())); boolean nfs = volumeCheck.isNfsEnabled() && getParameters().isNfs(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeProfileInfo, new GlusterVolumeProfileInfoVDSParameters(getParameters().getClusterId(), getUpServerId(getParameters().getClusterId()), getGlusterVolumeName(getParameters().getVolumeId()), nfs)); GlusterVolumeProfileInfo profileInfo = (GlusterVolumeProfileInfo) returnValue.getReturnValue(); if (!nfs) { populateBrickNames(profileInfo); } getQueryReturnValue().setReturnValue(profileInfo); }
Source:
public String generateDeviceSpecFile(ITestDevice device) { Path specFilePath = Paths.get( getBundletoolFile().getParentFile().getAbsolutePath(), device.getSerialNumber() + DEVICE_SPEC_FILE_EXTENSION); if (Files.exists(specFilePath)) { return specFilePath.toString(); } String outputDirArg = DEVICE_SPEC_OUTPUT_FLAG + specFilePath.toString(); String[] generateDeviceSpecCmd = new String[] { "java", "-jar", getBundletoolFile().getAbsolutePath(), GET_DEVICE_SPEC_OPTION, outputDirArg }; if (getAdbPath() != null) { String adbArg = "--adb=" + getAdbPath(); List<String> cmdList = new ArrayList<>(Arrays.asList(generateDeviceSpecCmd)); cmdList.add(adbArg); generateDeviceSpecCmd = cmdList.toArray(new String[cmdList.size()]); } CommandResult res = getRunUtil().runTimedCmd(CMD_TIME_OUT, generateDeviceSpecCmd); if (!CommandStatus.SUCCESS.equals(res.getStatus())) { CLog.e( "Failed to generated device spec file. Cmd is %s. Error: %s.", Arrays.toString(generateDeviceSpecCmd), res.getStderr()); return null; } return specFilePath.toString(); }

Target:
public String generateDeviceSpecFile(ITestDevice device) { Path specFilePath = Paths.get( getBundletoolFile().getParentFile().getAbsolutePath(), device.getSerialNumber() + DEVICE_SPEC_FILE_EXTENSION); if (Files.exists(specFilePath)) { return specFilePath.toString(); } String outputDirArg = DEVICE_SPEC_OUTPUT_FLAG + specFilePath.toString(); List<String> generateDeviceSpecCmd = new ArrayList<String>( Arrays.asList( "java", "-jar", getBundletoolFile().getAbsolutePath(), GET_DEVICE_SPEC_OPTION, outputDirArg)); if (getAdbPath() != null) { generateDeviceSpecCmd.add("--adb=" + getAdbPath()); } CommandResult res = getRunUtil() .runTimedCmd( CMD_TIME_OUT, generateDeviceSpecCmd.toArray( new String[generateDeviceSpecCmd.size()])); if (!CommandStatus.SUCCESS.equals(res.getStatus())) { CLog.e( "Failed to generated device spec file. Cmd is %s. Error: %s.", generateDeviceSpecCmd.toString(), res.getStderr()); return null; } return specFilePath.toString(); }
Source:
private static String[] getDependencies(ModelTestControllerVersion version) { switch (version) { case EAP_6_4_0: case EAP_6_4_7: return new String[] { formatEAP6SubsystemArtifact(version), "org.infinispan:infinispan-core:5.2.11.Final-redhat-2", "org.infinispan:infinispan-cachestore-jdbc:5.2.11.Final-redhat-2", }; case EAP_7_0_0: case EAP_7_1_0: case EAP_7_2_0_TEMP: return new String[] { formatEAP7SubsystemArtifact(version), formatArtifact("org.jboss.eap:wildfly-clustering-common:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-infinispan-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-extension:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-singleton-api:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-connector:%s", version), }; default: { throw new IllegalArgumentException(); } } }

Target:
private static String[] getDependencies(ModelTestControllerVersion version) { switch (version) { case EAP_6_4_0: case EAP_6_4_7: return new String[] { formatEAP6SubsystemArtifact(version), "org.infinispan:infinispan-core:5.2.11.Final-redhat-2", "org.infinispan:infinispan-cachestore-jdbc:5.2.11.Final-redhat-2", }; case EAP_7_0_0: case EAP_7_1_0: case EAP_7_2_0: return new String[] { formatEAP7SubsystemArtifact(version), formatArtifact("org.jboss.eap:wildfly-clustering-common:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-infinispan-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-extension:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-jgroups-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-service:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-singleton-api:%s", version), formatArtifact("org.jboss.eap:wildfly-clustering-spi:%s", version), formatArtifact("org.jboss.eap:wildfly-connector:%s", version), }; default: { throw new IllegalArgumentException(); } } }
Source:
private void createCompareModeAction() { final IToolBarManager barManager = getSite().getActionBars() .getToolBarManager(); compareModeAction = new Action(UIText.GitHistoryPage_compareMode, UIIcons.ELCL16_COMPARE_VIEW) { public void run() { compareMode = !compareMode; setChecked(compareMode); } }; compareModeAction.setChecked(compareMode); compareModeAction.setToolTipText(UIText.GitHistoryPage_compareMode); barManager.add(compareModeAction); }

Target:
private void createCompareModeAction() { final IToolBarManager barManager = getSite().getActionBars() .getToolBarManager(); compareModeAction = new Action(UIText.GitHistoryPage_compareMode, IAction.AS_CHECK_BOX) { public void run() { compareMode = !compareMode; setChecked(compareMode); } }; compareModeAction.setImageDescriptor(UIIcons.ELCL16_COMPARE_VIEW); compareModeAction.setChecked(compareMode); compareModeAction.setToolTipText(UIText.GitHistoryPage_compareMode); barManager.add(compareModeAction); }
Source:
public void testThatArtifactPayloadIsCorrect() throws Exception { File basedir = getBasedir("projects/iuWithPayload/"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "iuWithPayload"); MavenSession session = newMavenSession(project, projects); lookupMojoWithDefaultConfiguration(project, session, "build-qualifier").execute(); PackageIUMojo mojo = (PackageIUMojo) lookupMojo("package-iu", project.getFile()); setVariableValueToObject(mojo, "project", project); setVariableValueToObject(mojo, "session", session); mojo.execute(); ZipFile zip = new ZipFile(new File(basedir, "target/iuWithPayload-1.0.0.zip")); try { ZipEntry entry = zip.getEntry("file.txt"); assertNotNull("Missing file in artifact", entry); } finally { zip.close(); } }

Target:
public void testThatArtifactPayloadIsCorrect() throws Exception { File basedir = getBasedir("projects/iuWithPayload/"); File platform = new File("src/test/resources/eclipse"); List<MavenProject> projects = getSortedProjects(basedir, platform); MavenProject project = getProject(projects, "iuWithPayload"); MavenSession session = newMavenSession(project, projects); lookupMojoWithDefaultConfiguration(project, session, "build-qualifier").execute(); PackageIUMojo mojo = (PackageIUMojo) lookupConfiguredMojo(project, "package-iu"); setVariableValueToObject(mojo, "artifactContentFolder", new File(basedir, "src/main/resources").getAbsolutePath()); mojo.execute(); assertThat(getFilesInZip(new File(basedir, "target/iuWithPayload-1.0.0.zip")), hasItem("file.txt")); }