Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
import com.google.common.collect.ImmutableMap; exp.evaluate(input, null, ImmutableMap.of()).getValue())); exp.getKey().evaluate(input, null, ImmutableMap.of()).getValue(), exp.getValue().evaluate(input, null, ImmutableMap.of()).getValue())));
0
import org.apache.sshd.common.util.Pair; import org.apache.sshd.common.util.ValidateUtils; for (Pair<PublicKey, String> pair : agent.getIdentities()) { String keyType = getKeyType(pair); Signature verif = ValidateUtils.checkNotNull( NamedFactory.Utils.create(manager.getSignatureFactories(), keyType), "No signer could be located for key type=%s", keyType); verif.initSigner(pair.getPrivate());
0
* Options that can be used to configure the {@link DirectPipeline}.
0
log.debug("Create " + tableName + " failed, it exists"); } catch (IllegalArgumentException e) { log.debug("Create: " + e.toString());
0
/* * Copyright 1999-2005 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.blocks; import javax.servlet.Servlet; import org.apache.avalon.framework.service.ServiceManager; /** * @version $Id$ */ public interface Block extends Servlet { public static String NAME = Block.class.getName() + "-name"; public static String SUPER = "super"; /** * Get the mount path of the block */ public String getMountPath(); /** * The exported components of the block. Return null if the block doesn't export components. * * @return a ServiceManager containing the blocks exported components */ public ServiceManager getServiceManager(); public Servlet getBlockServlet(); }
0
import static com.google.common.base.Preconditions.checkArgument; import org.apache.beam.sdk.values.TaggedPValue; List<TaggedPValue> outputs = context.getOutputs(transform); transformTupleTagsToLabels(transform.getMainOutputTag(), outputs); UnionCoder outputUnionCoder = createUnionCoder(outputs); UnionCoder outputUnionCoder = createUnionCoder(outputs); for (TaggedPValue output : outputs) { final int outputTag = tagsToLabels.get(output.getTag()); TypeInformation outputTypeInfo = context.getTypeInfo((PCollection<?>) output.getValue()); List<TaggedPValue> allTaggedValues) { for (TaggedPValue taggedPValue : allTaggedValues) { if (!tagToLabelMap.containsKey(taggedPValue.getTag())) { tagToLabelMap.put(taggedPValue.getTag(), count++); private UnionCoder createUnionCoder(Collection<TaggedPValue> taggedCollections) { for (TaggedPValue taggedColl : taggedCollections) { checkArgument( taggedColl.getValue() instanceof PCollection, "A Union Coder can only be created for a Collection of Tagged %s. Got %s", PCollection.class.getSimpleName(), taggedColl.getValue().getClass().getSimpleName()); PCollection<?> coll = (PCollection<?>) taggedColl.getValue(); (WindowingStrategy<T, BoundedWindow>) context.getOutput(transform).getWindowingStrategy(); List<TaggedPValue> allInputs = context.getInputs(transform); for (TaggedPValue input : allInputs) { DataStream<T> current = context.getInputDataStream(input.getValue());
0
/** * Returns the number of registered processes. * * @return the number of register process */ int size();
0
final String method = request.getRequestLine().getMethod().toUpperCase(Locale.ROOT);
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. */ package org.apache.ambari.logsearch.config.api; public class NonLogSearchConfigClass { }
0
import org.apache.ambari.logsearch.config.zookeeper.model.inputconfig.impl.FilterJsonDescriptorImpl; public void init(FilterJsonDescriptorImpl filterJsonDescriptor) throws Exception { filterJson.loadConfig(filterJsonDescriptor); init(new FilterJsonDescriptorImpl()); init(new FilterJsonDescriptorImpl()); init(new FilterJsonDescriptorImpl()); init(new FilterJsonDescriptorImpl());
0
* Copyright (C) 2015 Google Inc.
0
debug("Connection closed: " + conn); debug("Connection open: " + conn); debug("Connection timed out: " + conn); debug("I/O error: " + ex.getMessage()); debug("HTTP error: " + ex.getMessage()); debug("Incoming entity content (bytes): " + entityContent.length); debug("File " + file.getPath() + " not found"); debug("Cannot read file " + file.getPath()); debug("Serving file " + file.getPath()); static final boolean Debug = false; private static void debug(String s) { if (Debug) { System.out.println(s); } } debug("Interrupted"); debug("I/O error: " + e.getMessage()); debug("Shutdown");
0
/** Unit tests of {@link ValueAndCoderLazySerializable}. */ public class ValueAndCoderLazySerializableTest { ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>> accUnderTest = ValueAndCoderLazySerializable.of(accumulatedValue, iterAccumCoder); ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>> materialized = (ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>>) ois.readObject(); ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>> accUnderTest = ValueAndCoderLazySerializable.of(accumulatedValue, iterAccumCoder); ValueAndCoderKryoSerializer kryoSerializer = new ValueAndCoderKryoSerializer(); kryo.register(ValueAndCoderLazySerializable.class, kryoSerializer); ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>> materialized = (ValueAndCoderLazySerializable<Iterable<WindowedValue<Integer>>>) kryo.readObject(input, ValueAndCoderLazySerializable.class);
0
import org.apache.ambari.server.agent.HostInfo; final HostInfo nodeInfo; AgentVersion agentVersion, long registrationTime, HostInfo nodeInfo) {
0
* Indicates whether or not this is a system view. */ private boolean system; /** * Determine whether or not this is a system view. * * @return true if this is a system view */ public boolean isSystem() { return system; } /**
0
@Override @Override
0
import com.google.common.base.Joiner; @Override public String toString() { StringBuilder builder = new StringBuilder("AfterAll.of("); Joiner.on(", ").appendTo(builder, subTriggers); builder.append(")"); return builder.toString(); }
0
import static org.junit.Assert.assertEquals; import java.io.InputStream; import org.junit.After; import org.junit.Before; public abstract class AbstractAnnotatedPojoTestCase { @Before public void setUp() throws Exception { @After public void tearDown() throws Exception {
0
Calendar.MILLISECOND, Calendar.MINUTE, * @throws ParseException if timestamp cannot be parsed this.defaultDateFormat = new SimpleDateFormat(format);
0
@Component @Property(name="type", value="file")
0
* @param sourceName - name of the source of this event. EntityDetail processRetrievedEntity(String sourceName, String metadataCollectionId, * @param sourceName - name of the source of this event. ArrayList<EntityDetail> processRetrievedEntities(String sourceName, String metadataCollectionId, * @param sourceName - name of the source of this event. Relationship processRetrievedRelationship(String sourceName, String metadataCollectionId, * @param sourceName - name of the source of this event. ArrayList<Relationship> processRetrievedRelationships(String sourceName, String metadataCollectionId,
0
package org.apache.atlas.repository.impexp;
0
edge = edge.distributed(); edge = edge.partitioned(new PartitionedKeyExtractor(coder)); this.coder = Utils.isKeyedValueCoder(coder) ? (WindowedValue.WindowedValueCoder<KV<K, V>>) coder : null; if (coder == null) { return "ALL"; } else { WindowedValue<KV<K, V>> windowedValue = CoderUtils.decodeFromByteArray(coder, b); // todo: decoding twice.... KvCoder<K, V> kvCoder = (KvCoder<K, V>) coder.getValueCoder(); return CoderUtils.encodeToByteArray( kvCoder.getKeyCoder(), windowedValue.getValue().getKey()); }
0
* @version CVS $Id: DOMStreamer.java,v 1.11 2003/08/01 17:48:44 vgritsenko Exp $ result.setLexicalHandler(lexicalHandler);
0
* {@link com.google.cloud.dataflow.sdk.transforms.windowing.AfterWatermark} * for details on the estimation.
0
* http://www.apache.org/licenses/LICENSE-2.0
0
/** Tests that Java SDK coders standardized by the Fn API meet the common spec. */ String testname = MoreObjects.toStringHelper(OneCoderTestSpec.class) .add("coder", test.getCoder()) .add("nested", test.getNested()) .add("serialized", test.getSerialized()) .toString(); Object windowValue = convertValue(kvMap.get("value"), coderSpec.getComponents().get(0), valueCoder); windows.add( (BoundedWindow) convertValue(window, coderSpec.getComponents().get(1), windowCoder)); PaneInfo paneInfo = PaneInfo.createPane( (boolean) paneInfoMap.get("is_first"), (boolean) paneInfoMap.get("is_last"), PaneInfo.Timing.valueOf((String) paneInfoMap.get("timing")), (int) paneInfoMap.get("index"), (int) paneInfoMap.get("on_time_index")); return WindowedValue.FullWindowedValueCoder.of( components.get(0), (Coder<BoundedWindow>) components.get(1)); verifyDecodedValue( coder.getComponents().get(0), ((KV) expectedValue).getKey(), ((KV) actualValue).getKey()); verifyDecodedValue( coder.getComponents().get(0), ((KV) expectedValue).getValue(), ((KV) actualValue).getValue()); * Utility for adding new entries to the common coder spec -- prints the serialized bytes of the * given value in the given context using JSON-escaped strings.
1
* Copyright (c) 2002 The Apache Software Foundation. All rights
0
import cz.seznam.euphoria.core.client.dataset.windowing.ElementWindowing; windowBy(ElementWindowing<Either<LEFT, RIGHT>, ?, WLABEL, W> windowing) private final ElementWindowing<Either<LEFT, RIGHT>, ?, WLABEL, W> windowing; ElementWindowing<Either<LEFT, RIGHT>, ?, WLABEL, W> windowing) ElementWindowing<Either<LEFT, RIGHT>, ?, WLABEL, W> windowing,
0
cfSet = new HashSet<>();
1
/* * 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
if (cands instanceof ShadowList) { m_candidateMap.put(r, ShadowList.deepCopy((ShadowList) cands)); } else { m_candidateMap.put(r, cands.copy()); }
0
return String.valueOf(this.docletTag.getContext().getParent().getParentSource().getURL()); } /** * @see org.apache.felix.scrplugin.tags.JavaTag#getLineNumber() */ public int getLineNumber() { return this.docletTag.getLineNumber();
0
public static ByteArrayShufflePosition fromBase64(String position) { public static ByteArrayShufflePosition of(byte[] position) {
0
package org.apache.beam.runners.flink.translation.types; import org.apache.beam.runners.flink.translation.wrappers.DataInputViewWrapper;
0
public FileAlterationObserver(final String directoryName, final FileFilter fileFilter, final IOCase caseSensitivity) { protected FileAlterationObserver(final FileEntry rootEntry, final FileFilter fileFilter, final IOCase caseSensitivity) { /** * List the files * @param file The file to list files for * @param entry the parent entry * @return The child files */
1
* @version CVS $Id$ database.indexOf("ingres") > -1 ||
0
private final String clusterOsType; int requestId, long timeout, String hostName, boolean isVerbose, String clusterOsType) this.clusterOsType = clusterOsType; String commands[] = new String[9]; commands[7] = this.clusterOsType; commands[8] = this.passwordFile.toString(); // Startup a scheduled executor service to look through the logs } finally {
0
// If this changes, it implies the binary format has changed! private static final String EXPECTED_ENCODING_ID = ""; @Test public void testEncodingId() throws Exception { CoderProperties.coderHasEncodingId( KvCoder.of(VarIntCoder.of(), VarIntCoder.of()), EXPECTED_ENCODING_ID); }
0
result = result.replace("\\", "\\\\");
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.processing; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * This component can be used to retrieve information about the current * process. * * @version $Id$ * @since 2.2 */ public interface ProcessInfoProvider { HttpServletRequest getRequest(); HttpServletResponse getResponse(); ServletContext getServletContext(); }
0
conf, options.cryptoService);
0
* HttpCore NIO integration tests using buffering versions of the * protocol handlers.
0
/* * Copyright 2003-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.net.telnet; /*** * The TelnetNotificationHandler interface can be used to handle * notification of options negotiation commands received on a telnet * session. * <p> * The user can implement this interface and register a * TelnetNotificationHandler by using the registerNotificationHandler() * of TelnetClient to be notified of option negotiation commands. * <p> * <p> * @author Bruno D'Avanzo ***/ public interface TelnetNotificationHandler { /*** * The remote party sent a DO command. ***/ public static final int RECEIVED_DO = 1; /*** * The remote party sent a DONT command. ***/ public static final int RECEIVED_DONT = 2; /*** * The remote party sent a WILL command. ***/ public static final int RECEIVED_WILL = 3; /*** * The remote party sent a WONT command. ***/ public static final int RECEIVED_WONT = 4; /*** * Callback method called when TelnetClient receives an option * negotiation command. * <p> * @param negotiation_code - type of negotiation command received * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT) * <p> * @param option_code - code of the option negotiated * <p> ***/ public void receivedNegotiation(int negotiation_code, int option_code); }
0
import org.apache.beam.vendor.grpc.v1p13p1.com.google.protobuf.ByteString;
0
false, true, null), new AttributeDefinition("type", DataTypes.STRING_TYPE.getName(), Multiplicity.REQUIRED, false, false, true, null), false, true, null),}; false, true, null), false, true, null),
0
int connTimeout = HttpConnectionParams.getConnectionTimeout(params); int soTimeout = HttpConnectionParams.getSoTimeout(params); sock.setSoTimeout(soTimeout); sock.connect(remoteAddress, connTimeout);
0
import org.apache.felix.sigil.common.model.IModelElement;
0
assertEquals("1234", buffer.toString()); assertEquals("1212341234", buffer.toString()); } public void testAppendString() throws Exception { CharArrayBuffer buffer = new CharArrayBuffer(8); buffer.append("stuff"); buffer.append(" and more stuff"); assertEquals("stuff and more stuff", buffer.toString()); } public void testAppendNullString() throws Exception { CharArrayBuffer buffer = new CharArrayBuffer(8); buffer.append(null); assertEquals("null", buffer.toString()); } public void testAppendSingleChar() throws Exception { CharArrayBuffer buffer = new CharArrayBuffer(4); buffer.append('1'); buffer.append('2'); buffer.append('3'); buffer.append('4'); buffer.append('5'); buffer.append('6'); assertEquals("123456", buffer.toString());
0
import org.apache.accumulo.core.security.tokens.AccumuloToken; root_conn.securityOperations().createUser(new UserPassToken(user, password.getBytes())); root_conn.securityOperations().createUser(new UserPassToken(user, password.getBytes())); test_user_conn.securityOperations().createUser(new UserPassToken(user, password.getBytes())); root_conn.securityOperations().createUser(new UserPassToken(user, password.getBytes())); root_conn.securityOperations().createUser(new UserPassToken(user, password.getBytes()));
0
NameValuePair parseTokenOrParameter(final CharSequence buffer, final ParserCursor cursor) throws ParseException { public List<AuthChallenge> parse(final CharSequence buffer, final ParserCursor cursor) throws ParseException {
0
import static org.junit.Assert.assertTrue;
0
import java.util.Iterator; import java.util.List; import org.apache.accumulo.core.client.IteratorSetting; List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.remove(tableName); if (tableScanIterators == null) Shell.log.info("Removed the following scan iterators from table " + tableName + ":" + tableScanIterators); List<IteratorSetting> tableScanIterators = shellState.scanIteratorOptions.get(tableName); if (tableScanIterators != null) { boolean found = false; for (Iterator<IteratorSetting> iter = tableScanIterators.iterator(); iter.hasNext();) { if (iter.next().getName().equals(name)) { iter.remove(); found = true; break; } } if (!found) else { Shell.log.info("Removed scan iterator " + name + " from table " + tableName + " (" + shellState.scanIteratorOptions.get(tableName).size() + " left)"); if (shellState.scanIteratorOptions.get(tableName).size() == 0) shellState.scanIteratorOptions.remove(tableName); } }
0
Copyright 2001,2003 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. */
0
PublicKeyEntry entry = PublicKeyEntry.parsePublicKeyEntry( GenericUtils.join( Arrays.asList(getCurrentTestName(), "AAAA", getClass().getSimpleName()), ' ')); PublicKey key = entry.resolvePublicKey(null, resolver);
0
package org.apache.ambari.logsearch.model.response; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @ApiModel public class LogFileData { @ApiModelProperty @ApiModelProperty
0
@Override @Override
0
* @author Apache Software Foundation
0
* * <p>It is recommended to extend {@link PValueBase}
0
import org.apache.commons.vfs.provider.ParsedLayeredUri; public class ZipFileNameParser public ParsedLayeredUri parseZipUri( final String uriStr ) final ParsedLayeredUri uri = new ParsedLayeredUri(); uri.setOuterFileUri( zipName ); public String buildRootUri( final String scheme, final String outerFileUri ) rootUri.append( scheme ); appendEncoded( rootUri, outerFileUri, ZIP_URL_RESERVED_CHARS );
0
import java.util.Arrays;
0
@Deprecated
0
public static <T> Predicate<T> nullIsFalsePredicate(Predicate<? super T> predicate) {
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. * @version $Revision: 1.14 $ $Date: 2004/02/29 14:17:44 $
0
import java.lang.reflect.InvocationTargetException; true, Thread.currentThread().getContextClassLoader()).getConstructor().newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException error) {
0
import org.apache.commons.lang.StringEscapeUtils; String dslQuery = String.format("%s where name = '%s' and clusterName = '%s'", typeName, public Referenceable getProcessReference(String queryStr) throws Exception { LOG.debug("Getting reference for process with query {}", queryStr); String typeName = HiveDataTypes.HIVE_PROCESS.getName(); //todo enable DSL // String dslQuery = String.format("%s where queryText = \"%s\"", typeName, queryStr); // return getEntityReferenceFromDSL(typeName, dslQuery); String gremlinQuery = String.format("g.V.has('__typeName', '%s').has('%s.queryText', \"%s\").toList()", typeName, typeName, StringEscapeUtils.escapeJava(queryStr)); return getEntityReferenceFromGremlin(typeName, gremlinQuery); }
0
package org.apache.felix.jmood; import java.io.IOException; import java.net.URL; public String getFelixBundleUrl(String artifactId) throws IOException{ return getM2Url("org.apache.felix", artifactId, "0.8.0-SNAPSHOT"); } public String getM2Url(String groupId, String artifactId, String version)throws IOException{ File userHome=new File(System.getProperty("user.home")); String M2_REPO="file:/"+userHome.getCanonicalPath()+"/.m2/repository"; String PROJECT_HOME=M2_REPO+"/"+groupId.replace('.', '/'); String VERSION="0.8.0-SNAPSHOT"; String u=PROJECT_HOME+"/"+artifactId+"/"+VERSION+"/"+artifactId+"-"+VERSION+".jar"; return "\""+u+"\""; } * String jmood=launcher.getFelixBundleUrl("org.apache.felix.jmood"); String mishell=launcher.getFelixBundleUrl("org.apache.felix.mishell"); String jruby=launcher.getM2Url("org.jruby", "jruby-bundle", "0.8.0-SNAPSHOT"); launcher.addBundle(jruby); launcher.addBundle(jmood); launcher.addBundle(mishell); launcher.addPackage("javax.management.openmbean");
0
* Restricts the columns that will be mapped over for the single input table on this job. * Encode an iterator on the input for the single input table associated with this job.
0
public static final ImmutableMap<String, ResourceType> BY_MESOS_NAME = BY_MESOS_NAME.get(resource.getName()),
0
for (BSHostStatus hostStatus : tmpStatus.getHostsStatus()) { if ("FAILED".equals(hostStatus.getStatus())) { stat = BSStat.ERROR; break; } }
0
package org.apache.batik.ext.awt.image.renderable;
0
public List<ExecuteStage> executionStages; /** * Represents a single-stage execution that happens as part of a cluster-wide * upgrade or downgrade. */ public static class ExecuteStage { @XmlElement(name="direction") public Direction intendedDirection = null; if (null != execution.intendedDirection && execution.intendedDirection != ctx.getDirection()) { continue; }
0
/** * {@inheritDoc} */
0
import org.apache.ambari.server.orm.dao.PermissionDAO; import org.apache.ambari.server.orm.entities.PermissionEntity; import org.apache.ambari.server.orm.entities.ResourceTypeEntity; import org.junit.Before; import org.junit.BeforeClass; import java.util.LinkedList; import java.util.List; import static org.easymock.EasyMock.createStrictMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.easymock.EasyMock.reset; import static org.easymock.EasyMock.verify; private final static PermissionDAO dao = createStrictMock(PermissionDAO.class); @BeforeClass public static void initClass() { PermissionResourceProvider.init(dao); } @Before public void resetGlobalMocks() { reset(dao); } List<PermissionEntity> permissionEntities = new LinkedList<PermissionEntity>(); PermissionEntity permissionEntity = createNiceMock(PermissionEntity.class); ResourceTypeEntity resourceTypeEntity = createNiceMock(ResourceTypeEntity.class); permissionEntities.add(permissionEntity); expect(dao.findAll()).andReturn(permissionEntities); expect(permissionEntity.getId()).andReturn(99); expect(permissionEntity.getPermissionName()).andReturn("AMBARI.ADMIN"); expect(permissionEntity.getResourceType()).andReturn(resourceTypeEntity); expect(resourceTypeEntity.getName()).andReturn("AMBARI"); replay(dao, permissionEntity, resourceTypeEntity); Assert.assertEquals(1, resources.size()); Resource resource = resources.iterator().next(); Assert.assertEquals(99, resource.getPropertyValue(PermissionResourceProvider.PERMISSION_ID_PROPERTY_ID)); Assert.assertEquals("AMBARI.ADMIN", resource.getPropertyValue(PermissionResourceProvider.PERMISSION_NAME_PROPERTY_ID)); Assert.assertEquals("AMBARI", resource.getPropertyValue(PermissionResourceProvider.RESOURCE_NAME_PROPERTY_ID)); verify(dao, permissionEntity, resourceTypeEntity);
0
package com.twitter.mesos.scheduler.thrift; import org.junit.Before; import org.junit.Test; import com.twitter.common.testing.EasyMockTest; import com.twitter.mesos.gen.JobConfiguration; import com.twitter.mesos.gen.ResponseCode; import com.twitter.mesos.gen.SessionKey; import com.twitter.mesos.gen.StartUpdateResponse; import static org.easymock.EasyMock.expect; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; public class FeatureToggleSchedulerControllerTest extends EasyMockTest { private static final SessionKey SESSION = new SessionKey(); private static final JobConfiguration CONFIG = new JobConfiguration(); private SchedulerController delegate; @Before public void setUp() { delegate = createMock(SchedulerController.class); } @Test public void testUpdatesEnabled() { SchedulerController toggle = new FeatureToggleSchedulerController(delegate, true); StartUpdateResponse response = new StartUpdateResponse(); expect(delegate.startUpdate(CONFIG, SESSION)).andReturn(response); control.replay(); assertSame(response, toggle.startUpdate(CONFIG, SESSION)); } @Test public void testUpdatesDisabled() { SchedulerController toggle = new FeatureToggleSchedulerController(delegate, false); control.replay(); StartUpdateResponse response = toggle.startUpdate(CONFIG, SESSION); assertEquals(ResponseCode.ERROR, response.getResponseCode()); } }
0
interface NamespaceResolver { interface NamespaceFunctor { interface ThreadLocal extends JexlContext {
0
public abstract class Metric { public void add(long value) {}; public void add(int key, long value) {}; public void add(String key, long value) {}; public void reset() {}; public abstract Map<String, Object > values();
0
* @author <a href="mailto:[email protected]">Bj&ouml;rn L&uuml;tkemeier</a> * @version CVS $Id: CopletInstanceDataReferenceFieldHandler.java,v 1.2 2003/07/10 13:16:56 cziegeler Exp $
0
String TRANSFORM_ROTATE = "rotate"; String TRANSFORM_SCALE = "scale"; String TRANSFORM_SKEWX = "skewX"; String TRANSFORM_SKEWY = "skewY"; String TRANSFORM_MATRIX = "matrix"; String PATH_ARC = "A"; String PATH_CLOSE = "Z"; String PATH_CUBIC_TO = "C"; String PATH_MOVE = "M"; String PATH_LINE_TO = "L"; String PATH_VERTICAL_LINE_TO = "V"; String PATH_QUAD_TO = "Q"; String PATH_SMOOTH_QUAD_TO = "T";
0
import org.apache.ambari.server.orm.dao.PermissionDAO; import org.apache.ambari.server.orm.entities.PermissionEntity; /** * Data access object used to obtain permission entities. */ protected static PermissionDAO permissionDAO; // ----- Constructors ------------------------------------------------------ * Construct a permission resource provider. public PermissionResourceProvider() { super(propertyIds, keyPropertyIds); // ----- PermissionResourceProvider ---------------------------------------- * Static initialization. * * @param dao permission data access object public static void init(PermissionDAO dao) { permissionDAO = dao; Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(request, predicate); for(PermissionEntity permissionEntity : permissionDAO.findAll()){ resources.add(toResource(permissionEntity, requestedIds)); } return resources; // ----- helper methods ---------------------------------------------------- // convert the given permission entity to a resource private Resource toResource(PermissionEntity entity, Set<String> requestedIds) { Resource resource = new ResourceImpl(Resource.Type.Permission); setResourceProperty(resource, PERMISSION_ID_PROPERTY_ID, entity.getId(), requestedIds); setResourceProperty(resource, PERMISSION_NAME_PROPERTY_ID, entity.getPermissionName(), requestedIds); setResourceProperty(resource, RESOURCE_NAME_PROPERTY_ID, entity.getResourceType().getName(), requestedIds); return resource; }
0
* @version CVS $Id: DefaultLayoutFactory.java,v 1.10 2003/06/06 11:33:37 cziegeler Exp $ desc.setCreateId(layoutsConf[i].getAttributeAsBoolean("create-id", false)); String id = null; if ( layoutDescription.createId() ) { // TODO - set unique id id = layoutName + '-' + System.currentTimeMillis(); }
0
import org.apache.http.message.BasicHeader; BasicHeader.format(this.buffer, (Header) it.next());
0
public ClientProtocolException(final String s) { public ClientProtocolException(final Throwable cause) { public ClientProtocolException(final String message, final Throwable cause) {
0
references = new HashMap<>(dataReferenceOrKeyReference.size() + 1); //+1 because the HashMap will resize otherwise
0
abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K, V> {
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/src/java/org/apache/commons/jelly/Attic/Context.java,v 1.2 2002/02/12 21:34:33 jstrachan Exp $ * $Revision: 1.2 $ * $Date: 2002/02/12 21:34:33 $ * $Id: Context.java,v 1.2 2002/02/12 21:34:33 jstrachan Exp $ * @version $Revision: 1.2 $ public Context() { } public Context(Map variables) { this.variables.putAll( variables ); }
0
import org.apache.http.protocol.HttpContext; public HttpHost getTarget() { public void requestCompleted(final HttpContext context) { }
0
import org.apache.hc.client5.http.async.methods.SimpleHttpRequests; final SimpleHttpRequest get = SimpleHttpRequests.GET.create(target, "/random/2048"); SimpleHttpRequests.GET.create(target, "/random/2048"), null); SimpleHttpRequests.GET.create(target, "/random/2048"), null); SimpleHttpRequests.GET.create(target, "/random/2048"), null);
0
import com.twitter.mesos.gen.comm.ExecutorStatus; import com.twitter.mesos.gen.comm.LiveTaskInfo; import com.twitter.mesos.gen.comm.RegisteredTaskUpdate; import com.twitter.mesos.gen.comm.SchedulerMessage;
0
/** * Used to indicate if the queue was resumed while * still running, so a 'resumed' event can be sent. */ protected boolean wasResumed; /** * Count of preempt entries in queue, so preempt entries * can be kept properly ordered. */ if (state == RUNNING) { if (wasResumed) { wasResumed = false; executionResumed(); } } else { // notify suspendExecution in case it is // waiting til we shut down. stateLock.notifyAll(); executionSuspended(); try { stateLock.wait(); } catch(InterruptedException ie) { } wasResumed = false; // System.err.println("Suspend Called"); wasResumed = false; if (state == SUSPENDED) { // already suspended, notify stateLock so an event is // generated. stateLock.notifyAll(); } // System.err.println("Resume Called"); wasResumed = true; // System.err.println("Suspend Sent"); // System.err.println("Resumed Sent");
0
* <pre><code> * </code></pre>
0
package org.apache.felix.karaf.gshell.osgi;
0
byte[] array = new byte[1024]; byte[] resBytes = baos.toByteArray();
0
* Unit test for * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException * @throws XPathExpressionException String fileIn, String fileRef, String fileOut, String c14nURI, return c14nAndCompare(fileIn, fileRef, fileOut, String fileIn, String fileRef, String fileOut, String c14nURI, if (!result) {
1
import org.apache.aurora.scheduler.storage.JobUpdateStore; import org.apache.aurora.scheduler.storage.entities.IJobUpdate; private final JobUpdateStore.Mutable writeBehindUpdateStore; @WriteBehind AttributeStore.Mutable attributeStore, @WriteBehind JobUpdateStore.Mutable updateStore) { attributeStore, updateStore); AttributeStore.Mutable attributeStore, JobUpdateStore.Mutable updateStore) { this.writeBehindUpdateStore = requireNonNull(updateStore); attributeStore, updateStore); case SAVE_JOB_UPDATE: writeBehindUpdateStore.saveJobUpdate( IJobUpdate.build(op.getSaveJobUpdate().getJobUpdate())); break;
0
buildURL();
0
entry = getFreeEntry(routePool); entry = createEntry(routePool, operator); entry = createEntry(routePool, operator); // TODO: keep track of which routes have waiting threads, // so they avoid being sacrificed before necessary * @param rcp the route-specific pool from which to get an entry protected synchronized BasicPoolEntry getFreeEntry(RouteConnPool rcp) { if (rcp.freeConnections.size() > 0) { LOG.debug("Getting free connection. " + rcp.route); entry = (BasicPoolEntry) rcp.freeConnections.removeLast(); LOG.debug("No free connections. " + rcp.route); * @param rcp the route-specific pool for which to create the entry * @return the new pool entry for a new connection BasicPoolEntry createEntry(RouteConnPool rcp, LOG.debug("Creating new connection. " + rcp.route); BasicPoolEntry entry = new BasicPoolEntry(this, op, rcp.route, refQueue); rcp.numConnections++;
0
final HttpConnectionManager mgr = getClient().getHttpConnectionManager();
1
* It implements the system described in: * @version $Id$ */ * named: 'META-INF/services/&lt;fully qualified classname&gt; that list
0
private final HttpProcessor httpProcessor; private final HttpResponseFactory responseFactory; private final ConnectionReuseStrategy connStrategy; private final Executor executor; private final ByteBufferAllocator allocator; private final HttpParams params; final ByteBufferAllocator allocator, if (allocator == null) { throw new IllegalArgumentException("ByteBuffer allocator may not be null"); } this.allocator = allocator; } public ThrottlingHttpServiceHandler( final HttpProcessor httpProcessor, final HttpResponseFactory responseFactory, final ConnectionReuseStrategy connStrategy, final Executor executor, final HttpParams params) { this(httpProcessor, responseFactory, connStrategy, new DirectByteBufferAllocator(), executor, params);
0