Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
import java.io.ByteArrayOutputStream; import java.util.zip.DeflaterOutputStream; import com.twitter.mesos.gen.Attribute; import com.twitter.mesos.gen.HostAttributes; import com.twitter.mesos.gen.ScheduleStatus; import com.twitter.mesos.gen.TwitterTaskInfo; Snapshot snapshot = createSnapshot(); @Test public void testReadDeflatedEntry() throws Exception { Snapshot snapshot = createSnapshot(); LogEntry snapshotLogEntry = LogEntry.snapshot(snapshot); ByteArrayOutputStream deflated = new ByteArrayOutputStream(); DeflaterOutputStream deflater = new DeflaterOutputStream(deflated); deflater.write(encode(snapshotLogEntry)); deflater.flush(); deflater.close(); LogEntry deflatedSnapshotEntry = LogEntry.deflatedEntry(ByteBuffer.wrap(deflated.toByteArray())); Entry snapshotEntry = createMock(Entry.class); expect(snapshotEntry.contents()).andReturn(encode(deflatedSnapshotEntry)); expect(stream.readAll()).andReturn(ImmutableList.of(snapshotEntry).iterator()); Closure<LogEntry> reader = createMock(new Clazz<Closure<LogEntry>>() { }); reader.execute(snapshotLogEntry); control.replay(); createNoMessagesStreamManager().readFromBeginning(reader); } private Snapshot createSnapshot() { .setHostAttributes(ImmutableSet.of(new HostAttributes("host", ImmutableSet.of(new Attribute("hostname", ImmutableSet.of("abc")))))) .setTasks(ImmutableSet.of( new ScheduledTask().setStatus(ScheduleStatus.RUNNING) .setAssignedTask(new AssignedTask().setTaskId("task_id") .setTask(new TwitterTaskInfo().setJobName("job_name"))))); @Override public ScheduledTask apply(String taskId) {
0
return SVG_MASK_MASK_UNITS_DEFAULT_VALUE; SVGAnimatedLength result; if (xReference == null || (result = (SVGAnimatedLength)xReference.get()) == null) { result = new SVGOMAnimatedLength(this, null, SVG_X_ATTRIBUTE, null); xReference = new WeakReference(result); } return result; } SVGAnimatedLength result; if (yReference == null || (result = (SVGAnimatedLength)yReference.get()) == null) { result = new SVGOMAnimatedLength(this, null, SVG_Y_ATTRIBUTE, null); yReference = new WeakReference(result); } return result; } SVGAnimatedLength result; if (widthReference == null || (result = (SVGAnimatedLength)widthReference.get()) == null) { result = new SVGOMAnimatedLength(this, null, SVG_WIDTH_ATTRIBUTE, null); widthReference = new WeakReference(result); } return result; } SVGAnimatedLength result; if (heightReference == null || (result = (SVGAnimatedLength)heightReference.get()) == null) { result = new SVGOMAnimatedLength(this, null, SVG_HEIGHT_ATTRIBUTE, null); heightReference = new WeakReference(result); } return result; }
0
import org.apache.commons.collections4.map.LRUMap;
0
import static org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse.BindingHostGroup; import static org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse.HostGroup; import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorException; import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRequest; import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorRunner; import org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
0
* <p> * AccumuloClient objects are intended to be thread-safe, and can be used by multiple threads. * However, care should be taken to ensure that the client is eventually closed, to clean up any * resources in use in the client application when all threads are finished with the AccumuloClient * object. Additionally, while the client itself is thread-safe, it is not necessarily true that all * objects produced from the client (such as Scanners) are thread-safe. *
0
import org.apache.felix.sigil.common.osgi.VersionRange; import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
0
return asyncExecCallback.handleResponse(response, entityDetails);
0
suite.addTest(MVSFTPEntryParserTest.suite());
0
public void test_SimpleComponent_service() throws Exception public void test_DelayedSimpleComponent_service_single_use() throws Exception public void test_DelayedSimpleComponent_service_multi_use() throws Exception public void test_DelayedSimpleComponent_service_keep_instance() throws Exception
0
package org.apache.felix.sigil.eclipse.ui.internal.editors.project;
0
import org.apache.http.auth.ChallengeState; this.authCache.put(host, new BasicScheme(ChallengeState.TARGET)); return this; } public Executor authPreemptiveProxy(final HttpHost host) { this.authCache.put(host, new BasicScheme(ChallengeState.PROXY));
0
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/src/java/org/apache/commons/jelly/impl/StaticTag.java,v 1.11 2002/09/30 17:38:16 jstrachan Exp $ * $Revision: 1.11 $ * $Date: 2002/09/30 17:38:16 $ * $Id: StaticTag.java,v 1.11 2002/09/30 17:38:16 jstrachan Exp $ import org.apache.commons.jelly.DynaTagSupport; * @version $Revision: 1.11 $ public class StaticTag extends DynaTagSupport {
0
throw new TransientStorageException("Storage is not " + state);
0
final int fragementSizeHint, super(new HttpTransportMetricsImpl(), buffersize, fragementSizeHint, encoder); this(buffer, buffersize, buffersize, null); this(new ByteArrayOutputStream(), BUFFER_SIZE, BUFFER_SIZE, encoder); this(new ByteArrayOutputStream(), BUFFER_SIZE, BUFFER_SIZE, charset != null ? charset.newEncoder() : null); this(buffer, BUFFER_SIZE, BUFFER_SIZE, null);
0
public Object execute(JexlContext context) {
0
import org.apache.commons.lang.ClassUtils; return ClassUtils.getClass(name);
0
@Override @Override
0
import org.apache.hc.core5.http.ClassicHttpRequest; import org.apache.hc.core5.http.ClassicHttpResponse;
0
* </p> * </p>
0
/* * Copyright 2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.cocoon.portal.event.layout; import org.apache.cocoon.portal.layout.Layout; /** * This event is fired when a layout has been removed. * * @version $Id$ * @since 2.2 */ public class LayoutRemovedEvent extends AbstractLayoutEvent { public LayoutRemovedEvent(Layout target) { super(target); } }
0
suite.addTest(new TestSuite(CausedIOExceptionTestCase.class));
0
package org.apache.commons.codec2.binary;
0
URL url = f.toURI().toURL();
0
* (there are no defaults for a general Beam pipeline). // ExampleUtils will try to cancel the pipeline and the injector before the program exists.
0
if (batches < 0) {
0
* Little class to carry in info such as a file or template name, line and column for * information error reporting from the uberspector implementations. * Originally taken from velocity for self-sufficiency. public class Info implements DebugInfo { private final int line; private final int column; private final String name; name = tn; * Formats this info in the form 'name&#064;line:column'. * @return the formatted info */ @Override public String toString() { StringBuilder sb = new StringBuilder(name != null? name : ""); if (line > 0) { sb.append("@"); sb.append(line); if (column > 0) { sb.append(":"); sb.append(column); } } return sb.toString(); } /** {@inheritDoc} */ public String debugString() { return toString(); } /** * Gets the file/script/url name. * @return template name */ public String getName() { return name; } /** @Deprecated return name;
0
import com.google.common.annotations.VisibleForTesting; import org.apache.beam.sdk.extensions.euphoria.core.translate.coder.EuphoriaCoderProvider; this(name, pipeline, true); } /** * Construct the {@link BeamFlow}. * * @param pipeline pipeline to wrap into this flow */ private BeamFlow(String name, Pipeline pipeline, boolean allowKryoCoderAsFallback) { org.joda.time.Duration.millis(allowedLateness.toMillis()), allowKryoCoderAsFallback); this(name, inputPCollection, true); } private <T> BeamFlow( String name, PCollection<T> inputPCollection, boolean allowKryoCoderAsFallback) { org.joda.time.Duration.millis(allowedLateness.toMillis()), allowKryoCoderAsFallback); * @param pipeline the pipeline to wrap into new flow * @return constructed flow */ public static BeamFlow of(Pipeline pipeline, boolean allowKryoCoderAsFallback) { return new BeamFlow(null, pipeline, allowKryoCoderAsFallback); } /** * Create flow from pipeline. * * Create flow from pipeline. * * @param name name of the flow * @param pipeline the pipeline to wrap into new flow * @return constructed flow */ public static BeamFlow of(String name, Pipeline pipeline, boolean allowKryoCoderAsFallback) { return new BeamFlow(name, pipeline, allowKryoCoderAsFallback); } /** org.joda.time.Duration.millis(allowedLateness.toMillis()), context.isUseOfKryoCoderAsFallbackAllowed()); public boolean useKryoCoderAsFallback() { return context.isUseOfKryoCoderAsFallbackAllowed(); } public void setEuphoriaCoderProvider(EuphoriaCoderProvider coderProvider) { context.setEuphoriaCoderProvider(coderProvider); } @VisibleForTesting public TranslationContext getTranslationContext() { return context; }
0
* @version $Revision$ $Date$
0
final String uri = request.getRequestUri();
0
public static class Result { public int getExitCode() { public String getStdout() { public String getStderr() {
0
import org.apache.batik.ext.awt.image.renderable.AffineRable; import org.apache.batik.ext.awt.image.renderable.Filter; import org.apache.batik.ext.awt.image.renderable.FilterChainRable; import org.apache.batik.ext.awt.image.renderable.PadMode; import org.apache.batik.ext.awt.image.renderable.PadRable; import org.apache.batik.ext.awt.image.renderable.AffineRable8Bit; import org.apache.batik.ext.awt.image.renderable.PadRable8Bit; PadRable pad = new PadRable8Bit(in, AffineRable offset = new AffineRable8Bit(pad, offsetTransform);
0
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @BeforeEach @Disabled @Disabled @Disabled @Disabled
0
class LoggingConnFactory implements HttpConnectionFactory<LoggingBHttpServerConnection> {
0
* Copyright 1999-2005 The Apache Software Foundation. * * * * This object holds a set of objects for an environment. * * * @version $Id$
0
@Override public int execute(String fullCommand, CommandLine cl, Shell shellState) { AccumuloClassLoader.printClassPath(); return 0; } @Override public String description() { return "lists the current files on the classpath"; } @Override public int numArgs() { return 0; }
1
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/primitives/Attic/RandomAccessCharList.java,v 1.2 2003/04/16 19:03:39 rwaldhoff Exp $ * @version $Revision: 1.2 $ $Date: 2003/04/16 19:03:39 $ // could cache these like StringBuffer does return new String(toArray());
0
.mergeStatesBy(WordCountState::combine) assertNotNull(reduce.getStateMerger()); .mergeStatesBy(WordCountState::combine) .mergeStatesBy(WordCountState::combine) .mergeStatesBy(WordCountState::combine) .mergeStatesBy(WordCountState::combine) static void combine(WordCountState target, Iterable<WordCountState> others) { for (WordCountState other : others) { target.add(other.sum.get());
0
final Map<String, String> kerberosEnvProperties = createNiceMock(Map.class); expect(kerberosEnvProperties.get("realm")).andReturn("EXAMPLE.COM").once(); final Map<String, String> kerberosEnvProperties = createMock(Map.class); expect(kerberosEnvProperties.get("realm")).andReturn("FOOBAR.COM").once(); final Map<String, String> krb5ConfProperties = createMock(Map.class); final Cluster cluster = createMock(Cluster.class); expect(cluster.getClusterId()).andReturn(1L).anyTimes(); expect(kerberosEnvProperties.get("realm")).andReturn("FOOBAR.COM").once(); expect(kerberosEnvProperties.get("realm")).andReturn("FOOBAR.COM").once(); expect(kerberosEnvProperties.get("realm")).andReturn("FOOBAR.COM").once();
0
protected static final String RESOURCES = if (gdt.getOwnerDocument() == null) * The trimming of id's is used by the 'use' element to keep IdSoftRef(Object o, String id) { this.id = id; if (list != null) } if ((oldId == newId) || ((oldId != null) && (oldId.equals(newId)))) int whatToShow, NodeFilter filter, public TreeWalker createTreeWalker(Node root, int whatToShow, NodeFilter filter, HashMap names = new HashMap(); // todo names is not used ? private void readObject(ObjectInputStream s)
1
import org.apache.ambari.logsearch.common.Marker; @Marker public interface AuditLogRequest extends BaseLogRequest, LastPageParamDefinition, UserParamDefinition {
0
@Parameter(names = {"-readonly", "--readonly"}, description = "read only") @Parameter(names = {"-count", "--count"}, description = "count", required = true) Opts() { super("mrtest1"); }
0
/* * Copyright 2016-2018 Seznam.cz, a.s.
0
import java.util.Comparator; /** * Compares 2 {@link NamedResource}s according to their {@link #getName()} * value case <U>insensitive</U> */ Comparator<NamedResource> BY_NAME_COMPARATOR=new Comparator<NamedResource>() { @Override public int compare(NamedResource r1, NamedResource r2) { String n1=r1.getName(), n2=r2.getName(); return String.CASE_INSENSITIVE_ORDER.compare(n1, n2); } }; /** * Returns the value of {@link #getName()} - or {@code null} if argument is {@code null} */ Transformer<NamedResource,String> NAME_EXTRACTOR=new Transformer<NamedResource,String>() { @Override public String transform(NamedResource input) { if (input == null) { return null; } else { return input.getName(); } } };
0
import org.apache.hc.core5.http.impl.bootstrap.HttpRequester; import org.apache.hc.core5.http.impl.bootstrap.HttpServer; import org.apache.hc.core5.http.impl.bootstrap.RequesterBootstrap; import org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
0
* $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/RunTag.java,v 1.8 2002/07/06 13:53:39 dion Exp $ * $Id: RunTag.java,v 1.8 2002/07/06 13:53:39 dion Exp $ public class RunTag extends TagSupport {
0
import org.apache.commons.logging.Log; import org.apache.cocoon.caching.CachedResponse; import org.apache.cocoon.components.sax.XMLByteStreamCompiler; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.util.AbstractLogEnabled; * @since 2.1 * @version $Id$ public final class PreemptiveLoader extends AbstractLogEnabled { private static final PreemptiveLoader INSTANCE = new PreemptiveLoader(); boolean alive; * return INSTANCE; */ public void process(SourceResolver resolver) { process(resolver, getLogger()); } /** * Start the preemptive loading * @param resolver A source resolver public void process(SourceResolver resolver, Log logger) { XMLByteStreamCompiler serializer;
0
interface StepStateAndTimers<K> { interface Provider { <K> StepStateAndTimers<K> forStepAndKey(PTransformNode transform, StructuralKey<K> key); } CopyOnAccessInMemoryStateInternals<K> stateInternals(); DirectTimerInternals timerInternals();
0
import org.apache.sshd.common.util.threads.ExecutorService; InternalScpCommand(String command, ExecutorService executorService, super(command, executorService, sendSize, receiveSize, opener, eventListener); getExecutorService(),
1
.setSkew(Duration.ZERO)
0
String name, Flow flow, Dataset<IN> input, UnaryFunction<KIN, KEY> extractor, UnaryFunction<WIN, Long> eventTimeAssigner /* optional */, super(name, flow, windowing, eventTimeAssigner, extractor, partitioning); String name, Flow flow, Dataset<IN> input, UnaryFunction<KIN, KEY> extractor, Windowing<WIN, W> windowing /* optional */, UnaryFunction<WIN, Long> eventTimeAssigner /* optional */) { this(name, flow, input, extractor, windowing, eventTimeAssigner, input.getPartitioning());
0
// do nothing - exclude persistence from perf
0
private static class GeoToWktConverter { /** * {@link com.thinkaurelius.titan.core.attribute.Geoshape} stores Points in the String format: point[X.0,Y.0]. * Solr needs it to be in Well-Known Text format: POINT(X.0 Y.0) */ static String convertToWktString(Geoshape fieldValue) throws BackendException { if (fieldValue.getType() == Geoshape.Type.POINT) { Geoshape.Point point = fieldValue.getPoint(); return "POINT(" + point.getLongitude() + " " + point.getLatitude() + ")"; } else { throw new PermanentBackendException("Cannot index " + fieldValue.getType()); } } }
0
import org.apache.cocoon.woody.FormContext; * @deprecated use the new &lt;wd:repeater-action&gt; widgets. public void handleActionEvent(FormContext context, ActionEvent actionEvent) { Form form = actionEvent.getSourceWidget().getForm(); Repeater repeater = (Repeater) form.getWidget(this.repeaterName); form.endProcessing(true); removeSelectedRows(form); form.endProcessing(true); private void removeSelectedRows(Form form) {
0
filterRegion,
0
public static AfterProcessingTime pastFirstElementInPane() {
0
import org.apache.beam.runners.core.construction.PipelineResources; prepareFilesToStageForRemoteClusterExecution(mOptions); /** * Local configurations work in the same JVM and have no problems with improperly formatted files * on classpath (eg. directories with .class files or empty directories). Prepare files for * staging only when using remote cluster (passing the master address explicitly). */ private static void prepareFilesToStageForRemoteClusterExecution(SparkPipelineOptions options) { if (!options.getSparkMaster().matches("local\\[?\\d*\\]?")) { options.setFilesToStage( PipelineResources.prepareFilesForStaging( options.getFilesToStage(), options.getTempLocation())); } }
0
if (a.length>0) { port=Integer.parseInt(a[0]); } if (a.length>1) { this.directory=a[1]; } else { this.directory="/tmp"; } if (!this.stopping) { e.printStackTrace(System.err); }
0
static class KeyTokenInvalidFn extends DoFn<KV<String, String>, KV<String, String>> { private static final long serialVersionUID = 0; static boolean thrown = false; @Override public void processElement(ProcessContext c) { if (!thrown) { thrown = true; throw new StreamingDataflowWorker.KeyTokenInvalidException("key"); } else { c.output(c.element()); } } } @Test public void testKeyTokenInvalidException() throws Exception { KvCoder<String, String> kvCoder = KvCoder.of(StringUtf8Coder.of(), StringUtf8Coder.of()); List<ParallelInstruction> instructions = Arrays.asList( makeSourceInstruction(kvCoder), makeDoFnInstruction(new KeyTokenInvalidFn(), 0, kvCoder), makeSinkInstruction(kvCoder, 1)); FakeWindmillServer server = new FakeWindmillServer(); server.addWorkToOffer(makeInput(0, 0, "key")); StreamingDataflowWorker worker = new StreamingDataflowWorker( Arrays.asList(defaultMapTask(instructions)), server, createTestingPipelineOptions()); worker.start(); server.waitForEmptyWorkQueue(); server.addWorkToOffer(makeInput(1, 0, "key")); Map<Long, Windmill.WorkItemCommitRequest> result = server.waitForAndGetCommits(1); assertEquals(makeExpectedOutput(1, 0, "key", "key").build(), stripCounters(result.get(1L))); assertEquals(1, result.size()); }
0
package org.apache.zookeeper;
0
// With the current implementation of MESOS-313, Mesos is also reporting clean terminations of // custom executors via the executorLost callback. if (status != 0) { log.warn("Lost executor " + executorID + " on slave " + slaveID + " with status " + status); counters.get("scheduler_lost_executors").incrementAndGet(); }
0
import static org.apache.beam.vendor.guava.v20_0.com.google.common.base.Preconditions.checkArgument;
0
import org.apache.aurora.GuavaUtils; task -> task.getJob().getRole(), java.util.Optional.ofNullable(mutableLock).map(ILock::build)); java.util.Optional.ofNullable(mutableLock).map(ILock::build)); java.util.Optional.ofNullable(mutableLock).map(ILock::build)); private void validateLockForTasks(java.util.Optional<ILock> lock, Iterable<IScheduledTask> tasks) java.util.Optional.ofNullable(mutableLock).map(ILock::build), java.util.Optional.ofNullable(mutableLock).map(ILock::build)); java.util.Optional.ofNullable(mutableLock).map(ILock::build)); lockManager.validateIfLocked(lock.getKey(), java.util.Optional.of(lock)); return ranges.stream() .map(range -> new org.apache.aurora.gen.Range(range.lowerEndpoint(), range.upperEndpoint())) .collect(GuavaUtils.toImmutableSet()); Maps.transformValues(instancesByConfig.asMap(), Numbers::toRanges); return changeJobUpdateState( mutableKey, session, JobUpdateController::pause, Optional.fromNullable(message)); return changeJobUpdateState( mutableKey, session, JobUpdateController::resume, Optional.fromNullable(message)); return changeJobUpdateState( mutableKey, session, JobUpdateController::abort, Optional.fromNullable(message));
0
* @param logLevel the maximum allowed log level. If message is logged with * lower level it will not be forwarded to the logger. String str = IOUtils.toString( templateStream, "UTF-8" ); switch ( str.charAt(0) ) { // skip BOM case 0xFEFF: // UTF-16/UTF-32, big-endian case 0xFFFE: // UTF-16, little-endian case 0xEFBB: // UTF-8 return str.substring(1); } return str;
0
* Autogenerated by Thrift Compiler (0.11.0)
0
* "License"); you may not use this file except in compliance * distributed under the License is distributed on an "AS IS" BASIS,
0
* @version CVS $Id: TempRepeaterJXPathBinding.java,v 1.4 2004/04/23 11:42:58 mpo Exp $ Repeater repeater = (Repeater) selectWidget(frmModel, this.repeaterId); Repeater repeater = (Repeater) selectWidget(frmModel, this.repeaterId);
0
* @throws IOException If failed to send identification protected IoWriteFuture sendServerIdentification(String... headerLines) throws IOException { ioSession.writePacket(new ByteArrayBuffer((errorMessage + "\n").getBytes(StandardCharsets.UTF_8)))
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/jelly-tags/quartz/src/java/org/apache/commons/jelly/tags/quartz/WaitForSchedulerTag.java,v 1.1 2003/01/07 14:54:15 dion Exp $ * $Revision: 1.1 $ * $Date: 2003/01/07 14:54:15 $
0
import java.io.Serializable; public interface FieldValueGetter<ObjectT, ValueT> extends Serializable {
0
URL result = getEntry(name); return result != null ? result : m_classLoader.getResource(name != null ? name.trim().startsWith("/") ? name.substring(1) : name : null); Enumeration<String> result = new EntryFilterEnumeration<String>(m_revision, false, path, null, false, return result.hasMoreElements() ? result : null; Enumeration<URL> result = new EntryFilterEnumeration<URL>(m_revision, true, path, filePattern, recurse, true); return result.hasMoreElements() ? result : null;
0
/* * Copyright 1999-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.cocoon.woody.event; /** * Listeners for {@link ActionEvent}s * * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a> * @version CVS $Id: ActionListener.java,v 1.5 2004/03/09 13:54:13 reinhard Exp $ */ public interface ActionListener extends WidgetListener { void actionPerformed(ActionEvent event); }
0
ambariContext.createAmbariResources(isA(ClusterTopology.class), eq(CLUSTER_NAME), (SecurityType) isNull(), eq("1"), anyLong());
0
* @version $Id: DoubleMetaphone.java,v 1.21 2004/05/24 00:25:22 ggregory Exp $ } return doubleMetaphone((String) obj);
0
import org.apache.ambari.server.orm.entities.ClusterVersionEntity; import org.apache.ambari.server.state.StackId; import org.junit.Assert; import com.google.inject.Guice; import com.google.inject.Injector; import com.google.inject.persist.PersistService; private final static StackId HDP_22_STACK = new StackId("HDP", "2.2.0"); private final static StackId BAD_STACK = new StackId("BADSTACK", "1.0"); cvA = new ClusterVersionEntity(cluster, helper.getOrCreateRepositoryVersion(HDP_22_STACK, "2.2.0.0-995"), RepositoryVersionState.CURRENT, System.currentTimeMillis(), System.currentTimeMillis(), "admin"); cvB = new ClusterVersionEntity(cluster, helper.getOrCreateRepositoryVersion(HDP_22_STACK, "2.2.0.1-998"), RepositoryVersionState.INSTALLED, System.currentTimeMillis(), System.currentTimeMillis(), "admin"); cvC = new ClusterVersionEntity(cluster, helper.getOrCreateRepositoryVersion(HDP_22_STACK, "2.2.1.0-100"), RepositoryVersionState.UPGRADING, System.currentTimeMillis(), "admin"); lastStep = currStep; Assert.assertEquals( 0, clusterVersionDAO.findByStackAndVersion("non existing", "non existing", "non existing").size()); Assert.assertEquals( 1, clusterVersionDAO.findByStackAndVersion(HDP_22_STACK.getStackName(), HDP_22_STACK.getStackVersion(), "2.2.0.0-995").size()); Assert.assertNull(clusterVersionDAO.findByClusterAndStackAndVersion( cluster.getClusterName(), BAD_STACK, "non existing")); Assert.assertNotNull(clusterVersionDAO.findByClusterAndStackAndVersion( cluster.getClusterName(), HDP_22_STACK, "2.2.0.0-995"));
0
if (!(pObject instanceof String)) {
0
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.
0
import java.util.Collection; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; * Implements a {@link MultiValuedMap}, using a {@link LinkedHashMap} to provide * data storage. This MultiValuedMap implementation the allows insertion order * to be maintained. * @version $Id: $ super(new LinkedHashMap<K, Collection<V>>(initialCapacity, loadFactor), collectionClazz, initialCollectionCapacity);
0
import java.util.concurrent.CopyOnWriteArraySet; protected final Collection<SessionListener> sessionListeners = new CopyOnWriteArraySet<>(); protected final Collection<ChannelListener> channelListeners = new CopyOnWriteArraySet<>(); protected final Collection<PortForwardingEventListener> tunnelListeners = new CopyOnWriteArraySet<>(); SessionListener.validateListener(listener); if (listener == null) { return; } SessionListener.validateListener(listener); ChannelListener.validateListener(listener); if (listener == null) { return; } ChannelListener.validateListener(listener); PortForwardingEventListener.validateListener(listener); PortForwardingEventListener.validateListener(listener);
0
/** * Tests that when there are no tasks and all counts are 0, that the returned * status is {@link HostRoleStatus#COMPLETED}. * * @throws Exception */ @Test public void testGetCompletedStatusForNoTasks() throws Exception { // no status / no tasks CalculatedStatus status = CalculatedStatus.statusFromTaskEntities( new ArrayList<HostRoleCommandEntity>(), false); assertEquals(HostRoleStatus.COMPLETED, status.getStatus()); // empty summaries status = CalculatedStatus.statusFromStageSummary( new HashMap<Long, HostRoleCommandStatusSummaryDTO>(), new HashSet<Long>()); assertEquals(HostRoleStatus.COMPLETED, status.getStatus()); // generate a map of 0's - COMPLETED=0, IN_PROGRESS=0, etc Map<HostRoleStatus, Integer> counts = CalculatedStatus.calculateStatusCounts(new ArrayList<HostRoleStatus>()); Map<HostRoleStatus, Integer> displayCounts = CalculatedStatus.calculateStatusCounts(new ArrayList<HostRoleStatus>()); HostRoleStatus hostRoleStatus = CalculatedStatus.calculateSummaryStatusOfUpgrade(counts, 0); HostRoleStatus hostRoleDisplayStatus = CalculatedStatus.calculateSummaryDisplayStatus(displayCounts, 0, false); assertEquals(HostRoleStatus.COMPLETED, hostRoleStatus); assertEquals(HostRoleStatus.COMPLETED, hostRoleDisplayStatus); }
0
private final String excludeString;
0
printMessage("stdout", outputFile);
0
public boolean hasTask(String taskId); public boolean isRunning(String taskId); public void deleteCompletedTask(String taskId);
0
public class UserAuthPasswordFactory extends AbstractUserAuthFactory { public static final String NAME = PASSWORD; super(NAME);
0
if (!instructions.containsKey(Analyzer.PRIVATE_PACKAGE)) { properties.put(Analyzer.EXPORT_PACKAGE, bsn + ".*"); }
0
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at
0
.getStepContext(stepName, stepName);
0
* limitations under the License.
0
* limitations under the License.
0
entityManagerProvider.get().getEntityManagerFactory().getCache().evictAll();
0
* @version $Id$
0
import static org.easymock.EasyMock.anyLong; import org.apache.ambari.server.agent.stomp.HostLevelParamsHolder; import org.apache.ambari.server.events.HostLevelParamsUpdateEvent; import org.apache.ambari.server.state.Host; import org.easymock.MockType; private Provider<HostLevelParamsHolder> m_hostLevelParamsHolder; @Mock @Mock(type = MockType.NICE) private HostLevelParamsHolder hostLevelParamsHolder; private StackVersionListener listener; expect(m_hostLevelParamsHolder.get()).andReturn(hostLevelParamsHolder).anyTimes(); expect(hostLevelParamsHolder.getCurrentData(anyLong())).andReturn(createNiceMock(HostLevelParamsUpdateEvent.class)).anyTimes(); listener = new StackVersionListener(publisher, ambariMetaInfoProvider, m_hostLevelParamsHolder); Host host = createMock(Host.class); expect(host.getHostId()).andReturn(1L).anyTimes(); expect(sch.getHost()).andReturn(host).anyTimes(); Host host = createMock(Host.class); expect(host.getHostId()).andReturn(1L).anyTimes(); expect(sch.getHost()).andReturn(host).anyTimes();
0
import org.apache.ambari.view.hive.utils.SharedObjectsFactory; private SharedObjectsFactory sharedObjectsFactory; public SharedObjectsFactory getSharedObjectsFactory() { if (sharedObjectsFactory == null) { sharedObjectsFactory = new SharedObjectsFactory(context); return sharedObjectsFactory; public void setSharedObjectsFactory(SharedObjectsFactory sharedObjectsFactory) { this.sharedObjectsFactory = sharedObjectsFactory;
0
if (zcpa != null) { } if (!cacheAndWatch) { } if (getPropCacheAccessor().isPropertySet(prop, getPath())) { } this.tableIters = List.copyOf(ii); var imb = ImmutableMap.<String,Map<String,String>>builder(); imb.put(entry.getKey(), Map.copyOf(entry.getValue())); var builder = ImmutableMap.<String,String>builder();
0
import com.google.common.io.Files; import java.nio.charset.StandardCharsets; public void testGetSizeBytes() throws Exception { String data = "TestData"; File file = tmpFolder.newFile(); Files.write(data, file, StandardCharsets.UTF_8); assertEquals(data.length(), IOChannelUtils.getSizeBytes(file.getPath())); } @Test
0
// If this is an attempt to create a connection to the root of // the bundle, then throw an exception since this isn't possible. // We only allow "/" as a valid URL so it can be used as context // for creating other URLs. String path = url.getPath(); if ((path == null) || (path.length() == 0) || path.equals("/")) { throw new IOException("Resource does not exist: " + url); }
0
try (FileWriter w = new FileWriter(new File(pkgdir, TYPE_NAME + ".java"))) {
0
/** * @author $Id: bbac24ccf55921dd04c219987d75ec0ebb16484a $ */
0
Field field = fields[j]; Class type = field.getType(); if ((instanceName == null && type.equals(clazz)) || (instanceName != null && field.getName().equals(instanceName) && type.isAssignableFrom(clazz))) { field.setAccessible(true); field.set(serviceInstance, instance); m_logger.log(Logger.LOG_ERROR, "Could not set field " + field, e);
0
/* * Copyright 2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.configuration; import java.net.URL; import junit.framework.TestCase; /** * @author Emmanuel Bourg * @version $Revision: 1.1 $, $Date: 2004/10/04 21:45:11 $ */ public class TestFileConfiguration extends TestCase { public void testSetURL() throws Exception { // http URL FileConfiguration config = new PropertiesConfiguration(); config.setURL(new URL("http://jakarta.apache.org/commons/configuration/index.html")); assertEquals("base path", "http://jakarta.apache.org/commons/configuration/", config.getBasePath()); assertEquals("file name", "index.html", config.getFileName()); // file URL config.setURL(new URL("file:/temp/test.properties")); assertEquals("base path", "/temp/", config.getBasePath()); assertEquals("file name", "test.properties", config.getFileName()); } }
0