Diff
stringlengths
5
2k
FaultInducingLabel
int64
0
1
/** * @deprecated since 1.8.0; use MiniAccumuloCluster or a standard mock framework instead. */ @Deprecated
0
import javax.annotation.Nullable; GcsOptions gcsOptions = PipelineOptionsFactory.as(GcsOptions.class); items.add(StorageObjectOrIOException.create( createStorageObject("gs://testbucket/testdirectory/dir2name/", 0L /* fileSize */))); GcsPath.fromUri("gs://testbucket/testdirectory/dir2name/"), assertEquals(5, matchResults.size()); assertThat( ImmutableList.of("gs://testbucket/testdirectory/dir2name/"), contains(toFilenames(matchResults.get(1)).toArray())); assertEquals(Status.NOT_FOUND, matchResults.get(2).status()); assertEquals(Status.ERROR, matchResults.get(3).status()); contains(toFilenames(matchResults.get(4)).toArray())); // Google APIs will use null for empty files. @Nullable BigInteger size = (fileSize == 0) ? null : BigInteger.valueOf(fileSize); .setSize(size);
0
private static void validateListFilesParameters(File directory, IOFileFilter fileFilter) { if (!directory.isDirectory()) { throw new IllegalArgumentException("Parameter 'directory' is not a directory"); } if (fileFilter == null) { throw new NullPointerException("Parameter 'fileFilter' is null"); } return FileFilterUtils.and(fileFilter, FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));
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.cocoon.it.servletservice; import junit.framework.Assert; import org.apache.cocoon.tools.it.HtmlUnitTestCase; public class BlockPathModule extends HtmlUnitTestCase { public void testSimplePipelineFromSubSitemap() throws Exception { this.loadXmlPage("cocoon-servlet-service-sample1/sub/abs"); Assert.assertTrue(this.response.getStatusCode() == 200); assertXPath("/properties/@other", "/cocoon-servlet-service-sample2/test"); assertXPath("/properties/@abs", "/cocoon-servlet-service-sample1/test"); } }
0
// Expect failure: // Expect failure:
0
* $Revision: 1.1 $ * $Date: 2003/04/25 08:34:56 $ * @version CVS $Id: AbstractXMLFormAction.java,v 1.1 2003/04/25 08:34:56 stephan Exp $
0
import org.apache.sshd.common.keyprovider.KeyPairProvider;
0
log.debug("Not queueing work for {} because {} doesn't need replication", file, TextFormat.shortDebugString(status));
0
import org.apache.sshd.client.ClientAuthenticationManager; authFactories = session.getUserAuthFactories(); String prefs = PropertyResolverUtils.getString(session, ClientAuthenticationManager.PREFERRED_AUTHS); if (log.isDebugEnabled()) { log.debug("ClientUserAuthService({}) skip unknown prefered authentication method: {}", s, pref); } if (log.isDebugEnabled()) { log.debug("auth({})[{}] Send SSH_MSG_USERAUTH_REQUEST for 'none'", getClientSession(), service); } log.debug("process({}) Ignoring random message - cmd={}", session, SshConstants.getCommandMessageName(cmd)); if (log.isDebugEnabled()) { log.debug("process({}) Welcome banner(lang={}): {}", session, lang, welcome); } UserInteraction ui = session.getUserInteraction(); if ((ui != null) && ui.isInteractionAllowed(session)) { * Execute one step in user authentication. * @param buffer The input {@link Buffer} * @throws Exception If failed to process protected void processUserAuth(Buffer buffer) throws Exception { if (log.isDebugEnabled()) { log.debug("processUserAuth({}) SSH_MSG_USERAUTH_SUCCESS Succeeded with {}", getClientSession(), userAuth); } log.debug("processUserAuth({}) Received SSH_MSG_USERAUTH_FAILURE - partial={}, methods={}", getClientSession(), partial, mths); protected void tryNext() throws Exception { if (log.isDebugEnabled()) { log.debug("tryNext({}) exhausted all methods", getClientSession()); } if (log.isDebugEnabled()) { log.debug("tryNext({}) attempting method={}", getClientSession(), method); }
0
package com.twitter.nexus; import com.google.common.base.Preconditions; import com.google.inject.Inject; import com.twitter.nexus.gen.TwitterTaskInfo; import nexus.Executor; import nexus.ExecutorDriver; import nexus.TaskDescription; import nexus.TaskState; import nexus.TaskStatus; import org.apache.thrift.TDeserializer; import org.apache.thrift.TException; import java.util.logging.Level; import java.util.logging.Logger; public class ExecutorHub extends Executor { static { System.loadLibrary("nexus"); } private static Logger LOG = Logger.getLogger(ExecutorHub.class.getName()); private final TDeserializer deserializer = new TDeserializer(); private final static byte[] EMPTY_BYTE_ARRAY = new byte[0]; private final ExecutorCore executorCore; @Inject public ExecutorHub(ExecutorCore executorCore) { this.executorCore = Preconditions.checkNotNull(executorCore); } @Override public void launchTask(final ExecutorDriver driver, final TaskDescription task) { LOG.info("Running task " + task.getName() + " with ID " + task.getTaskId()); TwitterTaskInfo concreteTaskDescription = new TwitterTaskInfo(); try { deserializer.deserialize(concreteTaskDescription, task.getArg()); executorCore.executePendingTask(driver, concreteTaskDescription, task); } catch (TException e) { LOG.log(Level.SEVERE, "Error deserializing Thrift TwitterTaskInfo", e); driver.sendStatusUpdate(new TaskStatus(task.getTaskId(), TaskState.TASK_FAILED, EMPTY_BYTE_ARRAY)); } } @Override public void killTask(ExecutorDriver driver, int taskId) { executorCore.stopRunningTask(driver,taskId); } @Override public void shutdown(ExecutorDriver driver) { executorCore.shutdownCore(driver); } @Override public void error(ExecutorDriver driver, int code, String message) { LOG.info("Error received with code: " + code + " and message: " + message); shutdown(driver); } }
0
final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer); outStream.writeObject(orig); outStream.close(); final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw); final ObjectInputStream inStream = new ObjectInputStream(inBuffer); final Host clone = (Host) inStream.readObject();
0
/***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * ------------------------------------------------------------------------- * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * *****************************************************************************/ package org.apache.batik.apps.svgbrowser; import java.io.File; import org.apache.batik.util.ParsedURL; /** * This is the interface expected from classes which can handle specific * types of input for the Squiggle SVG browser. The simplest implementation * will simply handle SVG documents. Other, more sophisticated implementations * will handle other types of documents and convert them into SVG before * displaying them in an SVG canvas. * * @author <a mailto="vincent.hardy@sun.com">Vincent Hardy</a> * @version $Id$ */ public interface SquiggleInputHandler { /** * Returns the list of mime types handled by this handler. */ String[] getHandledMimeTypes(); /** * Returns the list of file extensions handled by this handler */ String[] getHandledExtensions(); /** * Returns a description for this handler */ String getDescription(); /** * Returns true if the input file can be handled by the handler */ boolean accept(File f); /** * Returns true if the input URI can be handled by the handler * @param purl URL describing the candidate input */ boolean accept(ParsedURL purl); /** * Handles the given input for the given JSVGViewerFrame */ void handle(ParsedURL purl, JSVGViewerFrame svgFrame) throws Exception ; }
0
result.getOutputBundles(), Matchers.containsInAnyOrder(bundle));
0
@Override
0
"ssh", "|", "awk", "'{print \\$2}'", "|", "head", "-1", "|", "tr", "-d", "'\\n'"};
0
import org.apache.beam.vendor.guava.v20_0.com.google.common.io.ByteSource; import org.apache.beam.vendor.guava.v20_0.com.google.common.io.CharSource; import org.apache.beam.vendor.guava.v20_0.com.google.common.io.Files;
0
/** {@link org.apache.commons.logging} logging facility */ static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog( CreateNullURIReference.class.getName());
0
public abstract class XMLParser2 implements XMLParser
0
import org.apache.hc.core5.annotation.Contract; import org.apache.hc.core5.annotation.ThreadingBehavior; import org.apache.hc.core5.function.Supplier; @Contract(threading = ThreadingBehavior.IMMUTABLE_CONDITIONAL)
0
import org.apache.hadoop.fs.Path; final Path outputFilePath = outputFile.path(); final String outputFilePathName = outputFilePath.toString(); FileSystem ns = this.fs.getVolumeByPath(outputFilePath).getFileSystem(); mfw = fileFactory.openWriter(outputFilePathName, ns, ns.getConf(), acuTableConf); FileSKVIterator openReader = fileFactory.openReader(outputFilePathName, false, ns, ns.getConf(), acuTableConf); majCStats.setFileSize(fileFactory.getFileSize(outputFilePathName, ns, ns.getConf(), acuTableConf));
0
List<Range> ranges = null; if (ranges == null || ranges.size() == 0) { throw new IllegalArgumentException("ranges must be non null and contain at least 1 range"); } this.ranges = new ArrayList<Range>(ranges); if (ranges == null) { throw new IllegalStateException("ranges not set"); }
0
Table.ID tableId = Tables.getTableId(context, opts.tableName);
0
@Deprecated
0
private LicensePolicy defaultPolicy = new LicensePolicy(this); public void addLicense(String name, Pattern pattern) licenses.put(name, pattern); public void removeLicense(String name) licenses.remove(name); return Collections.unmodifiableSet(licenses.keySet()); public Pattern getLicensePattern(String name) return licenses.get(name);
0
* * * * * * * * * * * * * * * * *
0
public void onMerge(TimeInterval window, TriggerContext.TriggerMergeContext ctx) { trigger.onMerge(window, ctx); public void onMerge(TimeInterval window, TriggerContext.TriggerMergeContext ctx) { super.onMerge(window, ctx);
0
@ServiceDependency(filter="(name=ServiceDependencyPropagateTest)")
0
@Deprecated
0
Notaries.setIdAttributeNS(null, "Id", true);
0
@Mock StepContext mockStepContext; ThrowingDoFn.TIMER_ID, GlobalWindow.INSTANCE, new Instant(0), TimeDomain.EVENT_TIME); * Tests that {@link SimpleDoFnRunner#onTimer} properly dispatches to the underlying {@link DoFn}. * plus the value of {@link DoFn#getAllowedTimestampSkew()} throws, but between that value and the * current timestamp succeeds. * always succeeds when {@link DoFn#getAllowedTimestampSkew()} is equal to {@link Long#MAX_VALUE} * milliseconds.
1
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse; public void testResponseHasContentLength() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry1); public void testContentLengthIsNotAddedWhenTransferEncodingIsPresent() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry1); public void testResponseMatchesCacheEntry() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry); public void testResponseStatusCodeMatchesCacheEntry() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry); public void testAgeHeaderIsPopulatedWithCurrentAgeOfCacheEntryIfNonZero() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry); public void testAgeHeaderIsNotPopulatedIfCurrentAgeOfCacheEntryIsZero() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry); public void testAgeHeaderIsPopulatedWithMaxAgeIfCurrentAgeTooBig() throws Exception { final SimpleHttpResponse response = impl.generateResponse(request, entry); final SimpleHttpResponse response = impl.generateResponse(request, entry); Assert.assertNotNull(response.getBody()); final SimpleHttpResponse response = impl.generateResponse(headRequest, entry); Assert.assertNull(response.getBody());
0
* Interface to obtain connection pool statistics. * @since 4.2 public interface ConnPoolStats<T> { PoolStats getTotalStats(); PoolStats getStats(final T route);
0
list1 = new ArrayList<>(); final ArrayList<E> list = new ArrayList<>(); return new ListIteratorWrapper<>(list.listIterator()); return new ListIteratorWrapper<>(list1.listIterator());
1
/** * Constructor Canonicalizer20010315WithXPathOmitComments * */ public Canonicalizer20010315OmitComments() { super(false); } /** @inheritDoc */ public final String engineGetURI() { return Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS; } /** @inheritDoc */ public final boolean engineGetIncludeComments() { return false; }
0
TriggerByBuilder(JoinBuilderParams<LeftT, RightT, K, OutputT, W> params) { AccumulatorModeBuilder(JoinBuilderParams<LeftT, RightT, K, OutputT, W> params) { params.accumulationMode = Objects.requireNonNull(accumulationMode);
0
protected final byte[] ENCODING_TABLE = { for (int i = 0; i < ENCODING_TABLE.length; i++) { decodingTable[ENCODING_TABLE[i]] = (byte)i;
0
sshd.setSubsystemFactories(Collections.singletonList(new SftpSubsystemFactory()));
0
import cz.seznam.euphoria.core.client.operator.state.StorageProvider; final StorageProvider storageProvider; StorageProvider storageProvider, state = (State) stateFactory.apply(collector, storageProvider); StorageProvider storageProvider,
0
import org.apache.cocoon.portal.profile.ProfileManagerAspectContext; /** * Process a freshly loaded profile. */ protected void processProfile(Profile profile) { // FIXME we should add the calls to prepareObject here as well if ( this.chain.hasAspects() ) { ProfileManagerAspectContext aspectContext = new DefaultProfileManagerAspectContext(this.chain, this.portalService, this.portalService.getObjectModel(), profile); aspectContext.invokeNext(); } }
0
import java.util.Locale; String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
0
import org.apache.accumulo.trace.instrument.TraceRunnable; import org.apache.accumulo.trace.instrument.Tracer; private Authorizations authorizations = Authorizations.EMPTY; ResultReceiver receiver, List<Column> columns, TCredentials credentials, ScannerOptions options, Authorizations authorizations, AccumuloConfiguration conf, TimeoutTracker timeoutTracker) throws IOException, AccumuloSecurityException, AccumuloServerException {
0
import com.google.common.base.Optional; import com.twitter.mesos.gen.MaintenanceMode; public void saveHostAttributes(final HostAttributes attrs) { // Pass the updated attributes upstream, and then check if the stored value changes. // We do this since different parts of the system write partial HostAttributes objects // and they are merged together internally. // TODO(William Farner): Split out a separate method // saveAttributes(String host, Iterable<Attributes>) to simplify this. Optional<HostAttributes> saved = LogStorage.super.getHostAttributes(attrs.getHost()); LogStorage.super.saveHostAttributes(attrs); Optional<HostAttributes> updated = LogStorage.super.getHostAttributes(attrs.getHost()); if (!saved.equals(updated)) { log(Op.saveHostAttributes(new SaveHostAttributes(updated.get()))); @Override public boolean setMaintenanceMode(final String host, final MaintenanceMode mode) { doInWriteTransaction(new MutateWork.NoResult.Quiet() { @Override protected void execute(MutableStoreProvider unused) { Optional<HostAttributes> saved = LogStorage.super.getHostAttributes(host); if (saved.isPresent()) { HostAttributes attributes = saved.get().setMode(mode); log(Op.saveHostAttributes(new SaveHostAttributes(attributes))); LogStorage.super.saveHostAttributes(attributes); } } }); return false; }
0
throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
0
* @param hiveConf hive conf * @param databaseName database Name * @param dbName database name //todo replace gremlin with DSL String datasetType = MetadataServiceClient.DATA_SET_SUPER_TYPE; datasetType, tableName.toLowerCase(), tableType, dbType, dbName.toLowerCase(), dbType, clusterName); List<Referenceable> partKeys = getColumns(hiveTable.getPartitionKeys());
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
assertEquals("Buffer get", "three", buffer.get()); assertEquals("Buffer get", "one", buffer.remove());
0
import org.apache.accumulo.core.iterators.user.IntersectingIterator;
0
final Configuration other = new BaseConfiguration();
0
public class BundleAllPluginTest extends AbstractBundlePluginTest protected void setUp() throws Exception public void testNoReBundling() throws Exception String[] packages = new String[] { "org.apache.maven.model.io.jdom", "org.apache.maven.model" }; exports.containsKey( packages[i] ) ); // public void testRewriting() // throws Exception // { // // MavenProjectStub project = new MavenProjectStub(); // project.setArtifact( getArtifactStub() ); // project.getArtifact().setFile( getTestBundle() ); // project.setDependencyArtifacts( Collections.EMPTY_SET ); // project.setVersion( project.getArtifact().getVersion() ); // // File output = new File( plugin.getBuildDirectory(), plugin.getBundleName( project ) ); // boolean delete = output.delete(); // // plugin.bundle( project ); // // init(); // try // { // plugin.bundle( project ); // fail(); // } // catch ( RuntimeException e ) // { // // expected // } // }
0
session.setAttribute(NHTTP_CONN, conn);
0
import org.apache.accumulo.core.client.impl.Credentials;
1
public LocalVariableGen clone() { return (LocalVariableGen) super.clone(); throw new Error("Clone Not Supported"); // never happens
0
import org.apache.http.params.CoreConnectionPNames; int buffersize = params.getIntParameter(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
0
import cz.seznam.euphoria.core.client.operator.state.StateContext; (StateContext context, Collector<Pair<VALUE, SCORE>> collector) -> { return new MaxScored<>(context.getStorageProvider()); }, stateCombiner);
0
Rectangle2D objectBoundingBox = paintedNode.getGeometryBounds();
0
public void testGroupNameWithSpaces() { FTPFile f = getParser().parseFTPEntry("drwx------ 4 maxm Domain Users 512 Oct 2 10:59 .metadata"); assertNotNull(f); assertEquals("maxm", f.getUser()); assertEquals("Domain Users", f.getGroup()); }
0
public static AccumuloConfiguration convertClientConfig(final ClientConfiguration config) { Iterator<String> keyIter = config.getKeys();
0
import org.apache.ambari.server.agent.ExecutionCommand.KeyNames; if(actionExecutionContext.getParameters() != null && actionExecutionContext.getParameters().containsKey(KeyNames.REFRESH_ADITIONAL_COMPONENT_TAGS)){ execCmd.setForceRefreshConfigTags(parseAndValidateComponentsMapping(actionExecutionContext.getParameters().get(KeyNames.REFRESH_ADITIONAL_COMPONENT_TAGS))); } /** * splits the passed commaseparated value and returns it as set * @param comma separated list * @return set of items or null * @throws AmbariException */ private Set<String> parseAndValidateComponentsMapping(String commaSeparatedTags) { Set<String> retVal = null; if(commaSeparatedTags != null && !commaSeparatedTags.trim().isEmpty()){ Collections.addAll(retVal = new HashSet<String>(), commaSeparatedTags.split(",")); } return retVal; } if(requestParams.containsKey(KeyNames.REFRESH_ADITIONAL_COMPONENT_TAGS)){ actionExecutionContext.getParameters().put(KeyNames.REFRESH_ADITIONAL_COMPONENT_TAGS, requestParams.get(KeyNames.REFRESH_ADITIONAL_COMPONENT_TAGS)); }
0
serverSession = ValidateUtils.checkInstanceOf(s, ServerSession.class, "Server side service used on client side: %s", s);
0
package org.apache.felix.karaf.deployer.spring;
0
public void translate(FlinkRunner flinkRunner, Pipeline pipeline) { translator = new FlinkStreamingPipelineTranslator(flinkRunner, flinkStreamEnv, options);
0
private static final long serialVersionUID = -5789642544511401813L; final UPnPDevice device = (UPnPDevice) tracker.getService(ref); if (null == device) { return null; // the device is dynamically removed } final Object[] refs = tracker.getServiceReferences(); UPnPDevice upnpDevice = (UPnPDevice) tracker.getService(refs[i]); if (null == upnpDevice) { break; // device not found } return upnpDevice; private static final UPnPService getService(UPnPDevice device, String urn)
0
import org.apache.cocoon.util.NetUtils; import java.util.Collections; import java.util.HashMap; import java.util.Map; // Resolve base URI Source src = null; Map parameters = Collections.EMPTY_MAP; src = this.resolver.resolveURI(base); // Deparameterize base URL before adding catalogue name String uri = NetUtils.deparameterize(src.getURI(), parameters = new HashMap(7)); // Append trailing slash } finally { this.resolver.release(src); // Append catalogue name // Append catalogue locale // Reconstruct complete bundle URI with parameters String uri = NetUtils.parameterize(sb.toString(), parameters); ", locale: " + locale + " --> " + uri); return uri;
0
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
0
/* * (non-Javadoc) * * @see org.apache.ambari.logfeeder.input.Input#isReady() */ /* * (non-Javadoc) * * @see org.apache.ambari.logfeeder.input.Input#monitor() */ // Just process the first file // Call the close for the input. Which should flush to the filters and // output // Seems FileWatch is not reliable, so let's only use file key // comparison // inputMgr.monitorSystemFileChanges(this); // Create JSON string // Since FileWatch service is not reliable, we will // check // Let's add this to monitoring and exit // this // thread marker.fileKey = fileKey; marker.filePath = filePath; /** * @param s3FilePath * @return */ /* * (non-Javadoc) * * @see org.apache.ambari.logfeeder.input.Input#getShortDescription() */
0
componentActivator.getLogger().log(LogService.LOG_ERROR, " is not the same as the Configuration Admin API visible to the SCR implementation.", ex);
0
beanDef.getPropertyValues().addPropertyValue("location", this.getConfigurationLocation()); protected String getConfigurationLocation() {
0
* @version CVS $Id: JSPGenerator.java,v 1.2 2004/01/30 01:01:23 joerg Exp $ throw new ProcessingException("ServletException while executing JSPEngine", e); throw new ProcessingException("SAXException while parsing JSPEngine output", e);
0
return String.format("gcr.io/cloud-dataflow/v1beta3/IMAGE:%s", containerVersion);
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 * 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
/** * 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.server.api.resources; import org.junit.Assert; import org.junit.Test; import java.util.Set; /** * UserResourceDefinition tests. */ public class UserResourceDefinitionTest { @Test public void testGetPluralName() throws Exception { final UserResourceDefinition userResourceDefinition = new UserResourceDefinition(); Assert.assertEquals("users", userResourceDefinition.getPluralName()); } @Test public void testGetSingularName() throws Exception { final UserResourceDefinition userResourceDefinition = new UserResourceDefinition(); Assert.assertEquals("user", userResourceDefinition.getSingularName()); } @Test public void testGetSubResourceDefinitions() throws Exception { final UserResourceDefinition userResourceDefinition = new UserResourceDefinition(); Set<SubResourceDefinition> subResourceDefinitions = userResourceDefinition.getSubResourceDefinitions(); Assert.assertEquals(1, subResourceDefinitions.size()); } }
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//dbutils/src/java/org/apache/commons/dbutils/QueryLoader.java,v 1.2 2004/01/11 22:30:38 dgraham Exp $ * $Revision: 1.2 $ * $Date: 2004/01/11 22:30:38 $ * Copyright (c) 2003-2004 The Apache Software Foundation. All rights
0
protected transient DoublyIndexedTable liveAttributeValues = new DoublyIndexedTable();
0
import org.apache.atlas.model.instance.AtlasRelatedObjectId; public static AtlasEntityDef createClassTypeDef(String name, String description, String version, Set<String> superTypes, Map<String, String> options, AtlasAttributeDef... attrDefs) { return new AtlasEntityDef(name, description, version, Arrays.asList(attrDefs), superTypes, options); } public static AtlasRelationshipEndDef createRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer) { return new AtlasRelationshipEndDef(typeName, name, cardinality, isContainer); } public static AtlasTypesDef getTypesDef(List<AtlasEnumDef> enums, List<AtlasStructDef> structs, List<AtlasClassificationDef> traits, List<AtlasEntityDef> classes, List<AtlasRelationshipDef> relations) { return new AtlasTypesDef(enums, structs, traits, classes, relations); } public static Collection<AtlasRelatedObjectId> toAtlasRelatedObjectIds(Collection<AtlasEntity> entities) { List<AtlasRelatedObjectId> ret = new ArrayList<>(); if (CollectionUtils.isNotEmpty(entities)) { for (AtlasEntity entity : entities) { if (entity != null) { ret.add(toAtlasRelatedObjectId(entity)); } } } return ret; } public static AtlasRelatedObjectId toAtlasRelatedObjectId(AtlasEntity entity) { return new AtlasRelatedObjectId(getAtlasObjectId(entity)); }
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jelly/src/java/org/apache/commons/jelly/parser/XMLParser.java,v 1.10 2002/04/25 16:47:07 jstrachan Exp $ * $Revision: 1.10 $ * $Date: 2002/04/25 16:47:07 $ * $Id: XMLParser.java,v 1.10 2002/04/25 16:47:07 jstrachan Exp $ * @version $Revision: 1.10 $ expression = createConstantExpression( localName, attributeName, attributeValue ); expression = createConstantExpression( localName, attributeName, attributeValue ); protected Expression createConstantExpression( String tagName, String attributeName, String attributeValue ) throws Exception {
0
import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; Assertions.assertSame(pps1, getPoolablePreparedStatement(stmt2)); Assertions.assertFalse(inner.isClosed());
0
import org.apache.http.HttpHeaders; if (!request.containsHeader(HttpHeaders.USER_AGENT)) { request.addHeader(HttpHeaders.USER_AGENT, this.userAgent);
0
public void init(Service s) { DependencyManager dm = s.getDependencyManager();
0
import org.apache.accumulo.test.functional.ConfigurableMacBase; public class LargeSplitRowIT extends ConfigurableMacBase {
0
import org.apache.accumulo.hadoop.mapreduce.InputFormatBuilder; import org.apache.accumulo.hadoopImpl.mapreduce.InputFormatBuilderImpl; * @see org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormat /** * Sets all the information required for this map reduce job. */ public static InputFormatBuilder.ClientParams<JobConf> configure() { return new InputFormatBuilderImpl<JobConf>(CLASS);
0
package org.apache.accumulo.server.test.randomwalk.concurrent; import java.util.List; import java.util.Properties; import java.util.Random; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.server.test.randomwalk.State; import org.apache.accumulo.server.test.randomwalk.Test; public class DeleteTable extends Test { @Override public void visit(State state, Properties props) throws Exception { Connector conn = state.getConnector(); Random rand = (Random) state.get("rand"); @SuppressWarnings("unchecked") List<String> tableNames = (List<String>) state.get("tables"); String tableName = tableNames.get(rand.nextInt(tableNames.size())); try { conn.tableOperations().delete(tableName); log.debug("Deleted table "+tableName); } catch (TableNotFoundException e) { log.debug("Delete "+tableName+" failed, doesnt exist"); } } }
1
import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.events.AlertDefinitionsMessageEmitter; import org.apache.ambari.server.events.AlertDefinitionsUpdateEvent; import org.apache.ambari.server.events.DefaultMessageEmitter; private DefaultMessageEmitter defaultMessageEmitter; @Autowired private AlertDefinitionsMessageEmitter alertDefinitionsMessageEmitter; public void onUpdateEvent(AmbariUpdateEvent event) throws AmbariException { if (event instanceof AlertDefinitionsUpdateEvent) { alertDefinitionsMessageEmitter.emitMessage(event); defaultMessageEmitter.emitMessage(event);
0
* unexpected closing of an FTP connection resulting from a
0
import org.slf4j.Logger; import org.slf4j.LoggerFactory; LoggerFactory.getLogger(ObserverTest.class);
0
if (!nextObjectSet && !setNextObject()) { throw new NoSuchElementException(); if (!previousObjectSet && !setPreviousObject()) { throw new NoSuchElementException();
0
assertEquals(4, entity.getUpgradeGroups().size()); assertEquals(4, resources.size());
0
// get all of the cluster alerts for AMBARI/AMBARI_SERVER // disabled or new alerts may not have anything mapped yet ScheduledFuture<?> scheduledFuture = null; if (null != scheduledAlert) { scheduledFuture = scheduledAlert.getScheduledFuture(); } if (null != scheduledFuture) { unschedule(definitionName, scheduledFuture); } // if the definition hasn't been scheduled, then schedule it if (null == scheduledAlert || null == scheduledFuture) { private void unschedule(String definitionName, ScheduledFuture<?> scheduledFuture) { if (null != scheduledFuture) { scheduledFuture.cancel(true); LOG.info("Unscheduled server alert {}", definitionName); }
0
* Contains the {@link PipelineRunnerRegistrar} and {@link PipelineOptionsRegistrar} for the {@link * GearpumpRunner}. * <p>{@link AutoService} will register Gearpump's implementations of the {@link PipelineRunner} and * {@link PipelineOptions} as available pipeline runner services. private GearpumpRunnerRegistrar() {} /** Registers the {@link GearpumpRunner}. */ /** Registers the {@link GearpumpPipelineOptions}. */
1
* Copyright 2006-2016 The Apache Software Foundation import java.util.List; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; * This class re-implements the spell check service of Example 6. This service * implementation behaves exactly like the one in Example 6, specifically, it * application code; instead, the annotations describe the service * @Component * List of service objects. * * This field is managed by the Service Component Runtime and updated * with the current set of available dictionary services. * At least one dictionary service is required. @Reference(policy=ReferencePolicy.DYNAMIC, cardinality=ReferenceCardinality.AT_LEAST_ONE) private volatile List<DictionaryService> m_svcObjList; * List<String> errorList = new ArrayList<String>(); // Put the current set of services in a local field // the field m_svcObjList might be modified concurrently final List<DictionaryService> localServices = m_svcObjList; // Loop through each word in the passage. while ( st.hasMoreTokens() ) String word = st.nextToken(); boolean correct = false; // Check each available dictionary for the current word. for(final DictionaryService dictionary : localServices) { if ( dictionary.checkWord( word ) ) correct = true; } // If the word is not correct, then add it // to the incorrect word list. if ( !correct ) { errorList.add( word ); return errorList.toArray( new String[errorList.size()] );
0
public void stop(BundleContext context) {
0
* @version CVS $Id: CopletStatusEvent.java,v 1.2 2003/05/20 14:32:37 cziegeler Exp $ return ((CopletStatusEvent)event).getCopletInstanceData().getId().equals( this.coplet.getId() );
0
import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.ConfigImpl; Cluster cluster = clusters.getCluster(clusterName); Service s1 = cluster.getService(serviceName); Map<String, Config> configs = new HashMap<String, Config>(); Map<String, String> properties = new HashMap<String, String>(); properties.put("a", "a1"); properties.put("b", "b1"); Config c1 = new ConfigImpl(cluster, "hdfs-site", properties, injector); properties.put("c", "c1"); properties.put("d", "d1"); Config c2 = new ConfigImpl(cluster, "core-site", properties, injector); Config c3 = new ConfigImpl(cluster, "foo-site", properties, injector); c1.setVersionTag("v1"); c2.setVersionTag("v1"); c3.setVersionTag("v1"); cluster.addDesiredConfig(c1); cluster.addDesiredConfig(c2); cluster.addDesiredConfig(c3); configs.put(c1.getType(), c1); configs.put(c2.getType(), c2); s1.updateDesiredConfigs(configs); if (stages.get(0).getStageId() == 1) {
1
* @author <a href="mailto:deweese@apache.org">Thomas DeWeese</a>
0
* the Credential, containing principal and Authentication Token
0
import org.apache.ambari.controller.Cluster; import org.apache.ambari.controller.Clusters; private ClusterFSM clusterFsm; private Cluster cluster; this.clusterFsm = cluster; this.cluster = Clusters.getInstance().getClusterByID(cluster.getClusterID()); this.plugin = this.cluster.getComponentDefinition(serviceName); return clusterFsm;
0
import java.util.Properties; * <p> * This class is <b>not</b> guaranteed to be thread-safe! * </p> this(getAction, changeAction, new Properties());
0
* <p> * </p> * {@link AsyncInPendingWrapper} in this test serves as a handler for * {@link WritePendingException}, which can occur when sending too many messages one after another.
0
LOG.error("Error in transaction ", e); if (entityManager.getTransaction().isActive()) { entityManager.getTransaction().rollback(); }
0
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/primitives/Attic/TestIntArrayList.java,v 1.9 2003/08/31 17:28:40 scolebourne Exp $ * any, must include the following acknowledgement: * Alternately, this acknowledgement may appear in the software itself, * if and wherever such third-party acknowledgements normally appear. * @version $Revision: 1.9 $ $Date: 2003/08/31 17:28:40 $
0
coder = getPCollection().getCoder();
0