idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
25,400 | public void createNamespace ( ) { Map < String , String > namespaceAnnotations = annotationProvider . create ( session . getId ( ) , Constants . RUNNING_STATUS ) ; if ( namespaceService . exists ( session . getNamespace ( ) ) ) { } else if ( configuration . isNamespaceLazyCreateEnabled ( ) ) { namespaceService . create... | Creates a namespace if needed . |
25,401 | private static int getPort ( Service service , Annotation ... qualifiers ) { for ( Annotation q : qualifiers ) { if ( q instanceof Port ) { Port port = ( Port ) q ; if ( port . value ( ) > 0 ) { return port . value ( ) ; } } } ServicePort servicePort = findQualifiedServicePort ( service , qualifiers ) ; if ( servicePor... | Find the the qualified container port of the target service Uses java annotations first or returns the container port . |
25,402 | private static int getContainerPort ( Service service , Annotation ... qualifiers ) { for ( Annotation q : qualifiers ) { if ( q instanceof Port ) { Port port = ( Port ) q ; if ( port . value ( ) > 0 ) { return port . value ( ) ; } } } ServicePort servicePort = findQualifiedServicePort ( service , qualifiers ) ; if ( s... | Find the the qualfied container port of the target service Uses java annotations first or returns the container port . |
25,403 | private static String getScheme ( Service service , Annotation ... qualifiers ) { for ( Annotation q : qualifiers ) { if ( q instanceof Scheme ) { return ( ( Scheme ) q ) . value ( ) ; } } if ( service . getMetadata ( ) != null && service . getMetadata ( ) . getAnnotations ( ) != null ) { String s = service . getMetada... | Find the scheme to use to connect to the service . Uses java annotations first and if not found uses kubernetes annotations on the service object . |
25,404 | private static String getPath ( Service service , Annotation ... qualifiers ) { for ( Annotation q : qualifiers ) { if ( q instanceof Scheme ) { return ( ( Scheme ) q ) . value ( ) ; } } if ( service . getMetadata ( ) != null && service . getMetadata ( ) . getAnnotations ( ) != null ) { String s = service . getMetadata... | Find the path to use . Uses java annotations first and if not found uses kubernetes annotations on the service object . |
25,405 | private static Pod getRandomPod ( KubernetesClient client , String name , String namespace ) { Endpoints endpoints = client . endpoints ( ) . inNamespace ( namespace ) . withName ( name ) . get ( ) ; List < String > pods = new ArrayList < > ( ) ; if ( endpoints != null ) { for ( EndpointSubset subset : endpoints . getS... | Get a random pod that provides the specified service in the specified namespace . |
25,406 | public static URL classFileUrl ( Class < ? > clazz ) throws IOException { ClassLoader cl = clazz . getClassLoader ( ) ; if ( cl == null ) { cl = ClassLoader . getSystemClassLoader ( ) ; } URL res = cl . getResource ( clazz . getName ( ) . replace ( '.' , '/' ) + ".class" ) ; if ( res == null ) { throw new IllegalArgume... | Returns the URL of the class file where the given class has been loaded from . |
25,407 | private static String decode ( String s ) { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( ch == '%' ) { baos . write ( hexToInt ( s . charAt ( i + 1 ) ) * 16 + hexToInt ( s . charAt ( i + 2 ) ) ) ; i += 2 ; continue ; } bao... | Decode %HH . |
25,408 | public List < ? super OpenShiftResource > processTemplateResources ( ) { List < ? extends OpenShiftResource > resources ; final List < ? super OpenShiftResource > processedResources = new ArrayList < > ( ) ; templates = OpenShiftResourceFactory . getTemplates ( getType ( ) ) ; boolean sync_instantiation = OpenShiftReso... | Instantiates the templates specified by |
25,409 | public ExecInspection execStartVerbose ( String containerId , String ... commands ) { this . readWriteLock . readLock ( ) . lock ( ) ; try { String id = execCreate ( containerId , commands ) ; CubeOutput output = execStartOutput ( id ) ; return new ExecInspection ( output , inspectExec ( id ) ) ; } finally { this . rea... | EXecutes command to given container returning the inspection object as well . This method does 3 calls to dockerhost . Create Start and Inspect . |
25,410 | private static String createImageStreamRequest ( String name , String version , String image , boolean insecure ) { JSONObject imageStream = new JSONObject ( ) ; JSONObject metadata = new JSONObject ( ) ; JSONObject annotations = new JSONObject ( ) ; metadata . put ( "name" , name ) ; annotations . put ( "openshift.io/... | Creates image stream request and returns it in JSON formatted string . |
25,411 | static < T > List < Template > getTemplates ( T objectType ) { try { List < Template > templates = new ArrayList < > ( ) ; TEMP_FINDER . findAnnotations ( templates , objectType ) ; return templates ; } catch ( Exception e ) { throw new IllegalStateException ( e ) ; } } | Aggregates a list of templates specified by |
25,412 | static < T > boolean syncInstantiation ( T objectType ) { List < Template > templates = new ArrayList < > ( ) ; Templates tr = TEMP_FINDER . findAnnotations ( templates , objectType ) ; if ( tr == null ) { return true ; } else { return tr . syncInstantiation ( ) ; } } | Returns true if templates are to be instantiated synchronously and false if asynchronously . |
25,413 | public void deployApplication ( String applicationName , String ... classpathLocations ) throws IOException { final List < URL > classpathElements = Arrays . stream ( classpathLocations ) . map ( classpath -> Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( classpath ) ) . collect ( Collectors . t... | Deploys application reading resources from specified classpath location |
25,414 | public void deployApplication ( String applicationName , URL ... urls ) throws IOException { this . applicationName = applicationName ; for ( URL url : urls ) { try ( InputStream inputStream = url . openStream ( ) ) { deploy ( inputStream ) ; } } } | Deploys application reading resources from specified URLs |
25,415 | public void deploy ( InputStream inputStream ) throws IOException { final List < ? extends HasMetadata > entities = deploy ( "application" , inputStream ) ; if ( this . applicationName == null ) { Optional < String > deployment = entities . stream ( ) . filter ( hm -> hm instanceof Deployment ) . map ( hm -> ( Deployme... | Deploys application reading resources from specified InputStream |
25,416 | public Optional < URL > getServiceUrl ( String name ) { Service service = client . services ( ) . inNamespace ( namespace ) . withName ( name ) . get ( ) ; return service != null ? createUrlForService ( service ) : Optional . empty ( ) ; } | Gets the URL of the service with the given name that has been created during the current session . |
25,417 | public Optional < URL > getServiceUrl ( ) { Optional < Service > optionalService = client . services ( ) . inNamespace ( namespace ) . list ( ) . getItems ( ) . stream ( ) . findFirst ( ) ; return optionalService . map ( this :: createUrlForService ) . orElse ( Optional . empty ( ) ) ; } | Gets the URL of the first service that have been created during the current session . |
25,418 | public void cleanup ( ) { List < String > keys = new ArrayList < > ( created . keySet ( ) ) ; keys . sort ( String :: compareTo ) ; for ( String key : keys ) { created . remove ( key ) . stream ( ) . sorted ( Comparator . comparing ( HasMetadata :: getKind ) ) . forEach ( metadata -> { log . info ( String . format ( "D... | Removes all resources deployed using this class . |
25,419 | public void awaitPodReadinessOrFail ( Predicate < Pod > filter ) { await ( ) . atMost ( 5 , TimeUnit . MINUTES ) . until ( ( ) -> { List < Pod > list = client . pods ( ) . inNamespace ( namespace ) . list ( ) . getItems ( ) ; return list . stream ( ) . filter ( filter ) . filter ( Readiness :: isPodReady ) . collect ( ... | Awaits at most 5 minutes until all pods meets the given predicate . |
25,420 | private static Version getDockerVersion ( String serverUrl ) { try { DockerClient client = DockerClientBuilder . getInstance ( serverUrl ) . build ( ) ; return client . versionCmd ( ) . exec ( ) ; } catch ( Exception e ) { return null ; } } | Returns the docker version . |
25,421 | public void configure ( @ Observes ( precedence = - 10 ) ArquillianDescriptor arquillianDescriptor ) { Map < String , String > config = arquillianDescriptor . extension ( EXTENSION_NAME ) . getExtensionProperties ( ) ; CubeConfiguration cubeConfiguration = CubeConfiguration . fromMap ( config ) ; configurationProducer ... | Add precedence - 10 because we need that ContainerRegistry is available in the Arquillian scope . |
25,422 | public void configure ( @ Observes ( precedence = - 200 ) ArquillianDescriptor arquillianDescriptor ) { restAssuredConfigurationInstanceProducer . set ( RestAssuredConfiguration . fromMap ( arquillianDescriptor . extension ( "restassured" ) . getExtensionProperties ( ) ) ) ; } | required for rest assured base URI configuration . |
25,423 | public Map < String , String > resolve ( Map < String , String > config ) { config = resolveSystemEnvironmentVariables ( config ) ; config = resolveSystemDefaultSetup ( config ) ; config = resolveDockerInsideDocker ( config ) ; config = resolveDownloadDockerMachine ( config ) ; config = resolveAutoStartDockerMachine ( ... | Resolves the configuration . |
25,424 | public static String fromClassPath ( ) { Set < String > versions = new HashSet < > ( ) ; try { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Enumeration < URL > manifests = classLoader . getResources ( "META-INF/MANIFEST.MF" ) ; while ( manifests . hasMoreElements ( ) ) { URL manife... | Returns current selenium version from JAR set in classpath . |
25,425 | public static URL getKubernetesConfigurationUrl ( Map < String , String > map ) throws MalformedURLException { if ( Strings . isNotNullOrEmpty ( Utils . getSystemPropertyOrEnvVar ( ENVIRONMENT_CONFIG_URL , "" ) ) ) { return new URL ( Utils . getSystemPropertyOrEnvVar ( ENVIRONMENT_CONFIG_URL , "" ) ) ; } else if ( Stri... | Applies the kubernetes json url to the configuration . |
25,426 | public static URL findConfigResource ( String resourceName ) { if ( Strings . isNullOrEmpty ( resourceName ) ) { return null ; } final URL url = resourceName . startsWith ( ROOT ) ? DefaultConfiguration . class . getResource ( resourceName ) : DefaultConfiguration . class . getResource ( ROOT + resourceName ) ; if ( ur... | Returns the URL of a classpath resource . |
25,427 | public static URL asUrlOrResource ( String s ) { if ( Strings . isNullOrEmpty ( s ) ) { return null ; } try { return new URL ( s ) ; } catch ( MalformedURLException e ) { return findConfigResource ( s ) ; } } | Convert a string to a URL and fallback to classpath resource if not convertible . |
25,428 | public void deploy ( InputStream inputStream ) throws IOException { final List < ? extends HasMetadata > entities = deploy ( "application" , inputStream ) ; if ( this . applicationName == null ) { Optional < String > deploymentConfig = entities . stream ( ) . filter ( hm -> hm instanceof DeploymentConfig ) . map ( hm -... | Deploys application reading resources from specified InputStream . |
25,429 | public Optional < URL > getRoute ( String routeName ) { Route route = getClient ( ) . routes ( ) . inNamespace ( namespace ) . withName ( routeName ) . get ( ) ; return route != null ? Optional . ofNullable ( createUrlFromRoute ( route ) ) : Optional . empty ( ) ; } | Gets the URL of the route with given name . |
25,430 | public Optional < URL > getRoute ( ) { Optional < Route > optionalRoute = getClient ( ) . routes ( ) . inNamespace ( namespace ) . list ( ) . getItems ( ) . stream ( ) . findFirst ( ) ; return optionalRoute . map ( OpenShiftRouteLocator :: createUrlFromRoute ) ; } | Returns the URL of the first route . |
25,431 | public boolean projectExists ( String name ) throws IllegalArgumentException { if ( name == null || name . isEmpty ( ) ) { throw new IllegalArgumentException ( "Project name cannot be empty" ) ; } return listProjects ( ) . stream ( ) . map ( p -> p . getMetadata ( ) . getName ( ) ) . anyMatch ( Predicate . isEqual ( na... | Checks if the given project exists or not . |
25,432 | public Optional < Project > findProject ( String name ) throws IllegalArgumentException { if ( name == null || name . isEmpty ( ) ) { throw new IllegalArgumentException ( "Project name cannot be empty" ) ; } return getProject ( name ) ; } | Finds for the given project . |
25,433 | private static Constraint loadConstraint ( Annotation context ) { Constraint constraint = null ; final ServiceLoader < Constraint > constraints = ServiceLoader . load ( Constraint . class ) ; for ( Constraint aConstraint : constraints ) { try { aConstraint . getClass ( ) . getDeclaredMethod ( "check" , context . annota... | we have only one implementation on classpath . |
25,434 | public void createEnvironment ( @ Observes ( precedence = 10 ) BeforeClass event , OpenShiftAdapter client , CubeOpenShiftConfiguration cubeOpenShiftConfiguration ) { final TestClass testClass = event . getTestClass ( ) ; log . info ( String . format ( "Creating environment for %s" , testClass . getName ( ) ) ) ; OpenS... | Create the environment as specified by |
25,435 | public DockerContainerObjectBuilder < T > withContainerObjectClass ( Class < T > containerObjectClass ) { if ( containerObjectClass == null ) { throw new IllegalArgumentException ( "container object class cannot be null" ) ; } this . containerObjectClass = containerObjectClass ; final List < Method > methodsWithCubeDoc... | Specifies the container object class to be instantiated |
25,436 | public DockerContainerObjectBuilder < T > withEnrichers ( Collection < TestEnricher > enrichers ) { if ( enrichers == null ) { throw new IllegalArgumentException ( "enrichers cannot be null" ) ; } this . enrichers = enrichers ; return this ; } | Specifies the list of enrichers that will be used to enrich the container object . |
25,437 | public T build ( ) throws IllegalAccessException , IOException , InvocationTargetException { generatedConfigutation = new CubeContainer ( ) ; findContainerName ( ) ; prepareImageBuild ( ) ; instantiateContainerObject ( ) ; enrichContainerObjectBeforeCube ( ) ; extractConfigurationFromContainerObject ( ) ; mergeContaine... | Triggers the building process builds creates and starts the docker container associated with the requested container object creates the container object and returns it |
25,438 | private static Path resolveDockerDefinition ( Path fullpath ) { final Path ymlPath = fullpath . resolveSibling ( fullpath . getFileName ( ) + ".yml" ) ; if ( Files . exists ( ymlPath ) ) { return ymlPath ; } else { final Path yamlPath = fullpath . resolveSibling ( fullpath . getFileName ( ) + ".yaml" ) ; if ( Files . e... | Resolves current full path with . yml and . yaml extensions |
25,439 | public static void awaitRoute ( URL routeUrl , int timeout , TimeUnit timeoutUnit , int repetitions , int ... statusCodes ) { AtomicInteger successfulAwaitsInARow = new AtomicInteger ( 0 ) ; await ( ) . atMost ( timeout , timeoutUnit ) . until ( ( ) -> { if ( tryConnect ( routeUrl , statusCodes ) ) { successfulAwaitsIn... | Waits for the timeout duration until the url responds with correct status code |
25,440 | public static Constructor < ? > getConstructor ( final Class < ? > clazz , final Class < ? > ... argumentTypes ) throws NoSuchMethodException { try { return AccessController . doPrivileged ( new PrivilegedExceptionAction < Constructor < ? > > ( ) { public Constructor < ? > run ( ) throws NoSuchMethodException { return ... | Obtains the Constructor specified from the given Class and argument types |
25,441 | public static String getStringProperty ( String name , Map < String , String > map , String defaultValue ) { if ( map . containsKey ( name ) && Strings . isNotNullOrEmpty ( map . get ( name ) ) ) { defaultValue = map . get ( name ) ; } return getPropertyOrEnvironmentVariable ( name , defaultValue ) ; } | Gets a property from system environment or an external map . The lookup order is system > env > map > defaultValue . |
25,442 | public OpenShiftAssistantTemplate parameter ( String name , String value ) { parameterValues . put ( name , value ) ; return this ; } | Stores template parameters for OpenShiftAssistantTemplate . |
25,443 | public static Timespan create ( Timespan ... timespans ) { if ( timespans == null ) { return null ; } if ( timespans . length == 0 ) { return ZERO_MILLISECONDS ; } Timespan res = timespans [ 0 ] ; for ( int i = 1 ; i < timespans . length ; i ++ ) { Timespan timespan = timespans [ i ] ; res = res . add ( timespan ) ; } ... | Creates a timespan from a list of other timespans . |
25,444 | public void install ( @ Observes ( precedence = 90 ) CubeDockerConfiguration configuration , ArquillianDescriptor arquillianDescriptor ) { DockerCompositions cubes = configuration . getDockerContainersContent ( ) ; final SeleniumContainers seleniumContainers = SeleniumContainers . create ( getBrowser ( arquillianDescri... | ten less than Cube Q |
25,445 | public void startDockerMachine ( String cliPathExec , String machineName ) { commandLineExecutor . execCommand ( createDockerMachineCommand ( cliPathExec ) , "start" , machineName ) ; this . manuallyStarted = true ; } | Starts given docker machine . |
25,446 | public boolean isDockerMachineInstalled ( String cliPathExec ) { try { commandLineExecutor . execCommand ( createDockerMachineCommand ( cliPathExec ) ) ; return true ; } catch ( Exception e ) { return false ; } } | Checks if Docker Machine is installed by running docker - machine and inspect the result . |
25,447 | public void overrideCubeProperties ( DockerCompositions overrideDockerCompositions ) { final Set < String > containerIds = overrideDockerCompositions . getContainerIds ( ) ; for ( String containerId : containerIds ) { if ( containers . containsKey ( containerId ) ) { final CubeContainer cubeContainer = containers . get... | This method only overrides properties that are specific from Cube like await strategy or before stop events . |
25,448 | public static String replaceParameters ( final InputStream stream ) { String content = IOUtil . asStringPreservingNewLines ( stream ) ; return resolvePlaceholders ( content ) ; } | Method that takes an inputstream read it preserving the end lines and subtitute using commons - lang - 3 calls the variables first searching as system properties vars and then in environment var list . In case of missing the property is replaced by white space . |
25,449 | public static String join ( final Collection < ? > collection , final String separator ) { StringBuffer buffer = new StringBuffer ( ) ; boolean first = true ; Iterator < ? > iter = collection . iterator ( ) ; while ( iter . hasNext ( ) ) { Object next = iter . next ( ) ; if ( first ) { first = false ; } else { buffer .... | joins a collection of objects together as a String using a separator |
25,450 | public static List < String > splitAsList ( String text , String delimiter ) { List < String > answer = new ArrayList < String > ( ) ; if ( text != null && text . length ( ) > 0 ) { answer . addAll ( Arrays . asList ( text . split ( delimiter ) ) ) ; } return answer ; } | splits a string into a list of strings ignoring the empty string |
25,451 | public static List < String > splitAndTrimAsList ( String text , String sep ) { ArrayList < String > answer = new ArrayList < > ( ) ; if ( text != null && text . length ( ) > 0 ) { for ( String v : text . split ( sep ) ) { String trim = v . trim ( ) ; if ( trim . length ( ) > 0 ) { answer . add ( trim ) ; } } } return ... | splits a string into a list of strings . Trims the results and ignores empty strings |
25,452 | public void waitForDeployments ( @ Observes ( precedence = - 100 ) AfterStart event , OpenShiftAdapter client , CEEnvironmentProcessor . TemplateDetails details , TestClass testClass , CubeOpenShiftConfiguration configuration , OpenShiftClient openshiftClient ) throws Exception { if ( testClass == null ) { return ; } i... | Wait for the template resources to come up after the test container has been started . This allows the test container and the template resources to come up in parallel . |
25,453 | public static boolean validate ( final String ip ) { Matcher matcher = pattern . matcher ( ip ) ; return matcher . matches ( ) ; } | Validate ipv4 address with regular expression |
25,454 | protected AbstractFilePickerFragment < File > getFragment ( final String startPath , final int mode , final boolean allowMultiple , final boolean allowDirCreate , final boolean allowExistingFile , final boolean singleClick ) { String path = ( startPath != null ? startPath : Environment . getExternalStorageDirectory ( )... | Return a copy of the new fragment and set the variable above . |
25,455 | public File getParent ( final File from ) { if ( from . getPath ( ) . equals ( getRoot ( ) . getPath ( ) ) ) { return from ; } else if ( from . getParentFile ( ) != null ) { return from . getParentFile ( ) ; } else { return from ; } } | Return the path to the parent directory . Should return the root if from is root . |
25,456 | public Loader < SortedList < File > > getLoader ( ) { return new AsyncTaskLoader < SortedList < File > > ( getActivity ( ) ) { FileObserver fileObserver ; public SortedList < File > loadInBackground ( ) { File [ ] listFiles = mCurrentPath . listFiles ( ) ; final int initCap = listFiles == null ? 0 : listFiles . length ... | Get a loader that lists the Files in the current path and monitors changes . |
25,457 | public void onLoadFinished ( final Loader < SortedList < T > > loader , final SortedList < T > data ) { isLoading = false ; mCheckedItems . clear ( ) ; mCheckedVisibleViewHolders . clear ( ) ; mFiles = data ; mAdapter . setList ( data ) ; if ( mCurrentDirView != null ) { mCurrentDirView . setText ( getFullPath ( mCurre... | Called when a previously created loader has finished its load . |
25,458 | public void clearSelections ( ) { for ( CheckableViewHolder vh : mCheckedVisibleViewHolders ) { vh . checkbox . setChecked ( false ) ; } mCheckedVisibleViewHolders . clear ( ) ; mCheckedItems . clear ( ) ; } | Animate de - selection of visible views and clear selected set . |
25,459 | protected boolean isMultimedia ( File file ) { if ( isDir ( file ) ) { return false ; } String path = file . getPath ( ) . toLowerCase ( ) ; for ( String ext : MULTIMEDIA_EXTENSIONS ) { if ( path . endsWith ( ext ) ) { return true ; } } return false ; } | An extremely simple method for identifying multimedia . This could be improved but it s good enough for this example . |
25,460 | public Loader < SortedList < FtpFile > > getLoader ( ) { return new AsyncTaskLoader < SortedList < FtpFile > > ( getContext ( ) ) { public SortedList < FtpFile > loadInBackground ( ) { SortedList < FtpFile > sortedList = new SortedList < > ( FtpFile . class , new SortedListAdapterCallback < FtpFile > ( getDummyAdapter ... | Get a loader that lists the files in the current path and monitors changes . |
25,461 | public String timestamp ( ) { if ( timestampAsText == null ) { timestampAsText = DateTimeFormatter . ISO_INSTANT . format ( timestamp ) ; } return timestampAsText ; } | Returns a date and time string which is formatted as ISO - 8601 . |
25,462 | public static CentralDogma forConfig ( File configFile ) throws IOException { requireNonNull ( configFile , "configFile" ) ; return new CentralDogma ( Jackson . readValue ( configFile , CentralDogmaConfig . class ) ) ; } | Creates a new instance from the given configuration file . |
25,463 | public Optional < ServerPort > activePort ( ) { final Server server = this . server ; return server != null ? server . activePort ( ) : Optional . empty ( ) ; } | Returns the primary port of the server . |
25,464 | public Map < InetSocketAddress , ServerPort > activePorts ( ) { final Server server = this . server ; if ( server != null ) { return server . activePorts ( ) ; } else { return Collections . emptyMap ( ) ; } } | Returns the ports of the server . |
25,465 | public CompletableFuture < Void > stop ( ) { numPendingStopRequests . incrementAndGet ( ) ; return startStop . stop ( ) . thenRun ( numPendingStopRequests :: decrementAndGet ) ; } | Stops the server . This method does nothing if the server is stopped already . |
25,466 | public static void initializeInternalProject ( CommandExecutor executor ) { final long creationTimeMillis = System . currentTimeMillis ( ) ; try { executor . execute ( createProject ( creationTimeMillis , Author . SYSTEM , INTERNAL_PROJ ) ) . get ( ) ; } catch ( Throwable cause ) { cause = Exceptions . peel ( cause ) ;... | Creates an internal project and repositories such as a token storage . |
25,467 | protected < T > CompletableFuture < T > doExecute ( Command < T > command ) throws Exception { final CompletableFuture < T > future = new CompletableFuture < > ( ) ; executor . execute ( ( ) -> { try { future . complete ( blockingExecute ( command ) ) ; } catch ( Throwable t ) { future . completeExceptionally ( t ) ; }... | Ensure that all logs are replayed any other logs can not be added before end of this function . |
25,468 | public static long makeReasonable ( long expectedTimeoutMillis , long bufferMillis ) { checkArgument ( expectedTimeoutMillis > 0 , "expectedTimeoutMillis: %s (expected: > 0)" , expectedTimeoutMillis ) ; checkArgument ( bufferMillis >= 0 , "bufferMillis: %s (expected: > 0)" , bufferMillis ) ; final long timeout = Math .... | Returns a reasonable timeout duration for a watch request . |
25,469 | public CentralDogmaBuilder port ( InetSocketAddress localAddress , SessionProtocol protocol ) { return port ( new ServerPort ( localAddress , protocol ) ) ; } | Adds a port that serves the HTTP requests . If unspecified cleartext HTTP on port 36462 is used . |
25,470 | void close ( Supplier < CentralDogmaException > failureCauseSupplier ) { requireNonNull ( failureCauseSupplier , "failureCauseSupplier" ) ; if ( closePending . compareAndSet ( null , failureCauseSupplier ) ) { repositoryWorker . execute ( ( ) -> { rwLock . writeLock ( ) . lock ( ) ; try { if ( commitIdDatabase != null ... | Waits until all pending operations are complete and closes this repository . |
25,471 | public CompletableFuture < Map < String , Change < ? > > > diff ( Revision from , Revision to , String pathPattern ) { final ServiceRequestContext ctx = context ( ) ; return CompletableFuture . supplyAsync ( ( ) -> { requireNonNull ( from , "from" ) ; requireNonNull ( to , "to" ) ; requireNonNull ( pathPattern , "pathP... | Get the diff between any two valid revisions . |
25,472 | private Revision uncachedHeadRevision ( ) { try ( RevWalk revWalk = new RevWalk ( jGitRepository ) ) { final ObjectId headRevisionId = jGitRepository . resolve ( R_HEADS_MASTER ) ; if ( headRevisionId != null ) { final RevCommit revCommit = revWalk . parseCommit ( headRevisionId ) ; return CommitUtil . extractRevision ... | Returns the current revision . |
25,473 | public static String simpleTypeName ( Object obj ) { if ( obj == null ) { return "null" ; } return simpleTypeName ( obj . getClass ( ) , false ) ; } | Returns the simplified name of the type of the specified object . |
25,474 | public final B accessToken ( String accessToken ) { requireNonNull ( accessToken , "accessToken" ) ; checkArgument ( ! accessToken . isEmpty ( ) , "accessToken is empty." ) ; this . accessToken = accessToken ; return self ( ) ; } | Sets the access token to use when authenticating a client . |
25,475 | public static JsonPatch fromJson ( final JsonNode node ) throws IOException { requireNonNull ( node , "node" ) ; try { return Jackson . treeToValue ( node , JsonPatch . class ) ; } catch ( JsonMappingException e ) { throw new JsonPatchException ( "invalid JSON patch" , e ) ; } } | Static factory method to build a JSON Patch out of a JSON representation . |
25,476 | public static JsonPatch generate ( final JsonNode source , final JsonNode target , ReplaceMode replaceMode ) { requireNonNull ( source , "source" ) ; requireNonNull ( target , "target" ) ; final DiffProcessor processor = new DiffProcessor ( replaceMode , ( ) -> unchangedValues ( source , target ) ) ; generateDiffs ( pr... | Generates a JSON patch for transforming the source node into the target node . |
25,477 | public JsonNode apply ( final JsonNode node ) { requireNonNull ( node , "node" ) ; JsonNode ret = node . deepCopy ( ) ; for ( final JsonPatchOperation operation : operations ) { ret = operation . apply ( ret ) ; } return ret ; } | Applies this patch to a JSON value . |
25,478 | static Project convert ( String name , com . linecorp . centraldogma . server . storage . project . Project project ) { return new Project ( name ) ; } | The parameter project is not used at the moment but will be used once schema and plugin support lands . |
25,479 | public List < Revision > getMatrixHistory ( final int start , final int limit ) throws StoreException { return delegate . getMatrixHistory ( start , limit ) ; } | caching is not supported for this method |
25,480 | private static File getUserDirectory ( final String prefix , final String suffix , final File parent ) { final String dirname = formatDirName ( prefix , suffix ) ; return new File ( parent , dirname ) ; } | Returns a File object whose path is the expected user directory . Does not create or check for existence . |
25,481 | private static String formatDirName ( final String prefix , final String suffix ) { final CharMatcher invalidCharacters = VALID_SUFFIX_CHARS . negate ( ) ; return String . format ( "%s-%s" , prefix , invalidCharacters . trimAndCollapseFrom ( suffix . toLowerCase ( ) , '-' ) ) ; } | Returns the expected name of a workspace for a given suffix |
25,482 | private static void deleteUserDirectories ( final File root , final FileFilter filter ) { final File [ ] dirs = root . listFiles ( filter ) ; LOGGER . info ( "Identified (" + dirs . length + ") directories to delete" ) ; for ( final File dir : dirs ) { LOGGER . info ( "Deleting " + dir ) ; if ( ! FileUtils . deleteQuie... | Deletes all of the Directories in root that match the FileFilter |
25,483 | public static Proctor construct ( final TestMatrixArtifact matrix , ProctorLoadResult loadResult , FunctionMapper functionMapper ) { final ExpressionFactory expressionFactory = RuleEvaluator . EXPRESSION_FACTORY ; final Map < String , TestChooser < ? > > testChoosers = Maps . newLinkedHashMap ( ) ; final Map < String ,... | Factory method to do the setup and transformation of inputs |
25,484 | public static ProctorLoadResult verifyWithoutSpecification ( final TestMatrixArtifact testMatrix , final String matrixSource ) { final ProctorLoadResult . Builder resultBuilder = ProctorLoadResult . newBuilder ( ) ; for ( final Entry < String , ConsumableTestDefinition > entry : testMatrix . getTests ( ) . entrySet ( )... | Verifies that the TestMatrix is correct and sane without using a specification . The Proctor API doesn t use a test specification so that it can serve all tests in the matrix without restriction . Does a limited set of sanity checks that are applicable when there is no specification and thus no required tests or provid... |
25,485 | public static ProctorLoadResult verify ( final TestMatrixArtifact testMatrix , final String matrixSource , final Map < String , TestSpecification > requiredTests , final FunctionMapper functionMapper , final ProvidedContext providedContext , final Set < String > dynamicTests ) { final ProctorLoadResult . Builder result... | Does not mutate the TestMatrix . Verifies that the test matrix contains all the required tests and that each required test is valid . |
25,486 | static boolean isEmptyWhitespace ( final String s ) { if ( s == null ) { return true ; } return CharMatcher . WHITESPACE . matchesAllOf ( s ) ; } | Returns flag whose value indicates if the string is null empty or only contains whitespace characters |
25,487 | public static TestSpecification generateSpecification ( final TestDefinition testDefinition ) { final TestSpecification testSpecification = new TestSpecification ( ) ; final Map < String , Integer > buckets = Maps . newLinkedHashMap ( ) ; final List < TestBucket > testDefinitionBuckets = Ordering . from ( new Comparato... | Generates a usable test specification for a given test definition Uses the first bucket as the fallback value |
25,488 | protected Payload getPayload ( final String testName ) { final TestBucket testBucket = buckets . get ( testName ) ; if ( testBucket != null ) { final Payload payload = testBucket . getPayload ( ) ; if ( null != payload ) { return payload ; } } return Payload . EMPTY_PAYLOAD ; } | Return the Payload attached to the current active bucket for |test| . Always returns a payload so the client doesn t crash on a malformed test definition . |
25,489 | public static Map < String , Integer > parseForcedGroups ( final HttpServletRequest request ) { final String forceGroupsList = getForceGroupsStringFromRequest ( request ) ; return parseForceGroupsList ( forceGroupsList ) ; } | Consumer is required to do any privilege checks before getting here |
25,490 | private void precheckStateAllNull ( ) throws IllegalStateException { if ( ( doubleValue != null ) || ( doubleArray != null ) || ( longValue != null ) || ( longArray != null ) || ( stringValue != null ) || ( stringArray != null ) || ( map != null ) ) { throw new IllegalStateException ( "Expected all properties to be emp... | Sanity check precondition for above setters |
25,491 | private Map < String , Integer > runSampling ( final ProctorContext proctorContext , final Set < String > targetTestNames , final TestType testType , final int determinationsToRun ) { final Set < String > targetTestGroups = getTargetTestGroups ( targetTestNames ) ; final Map < String , Integer > testGroupToOccurrences ... | test how many times the group was present in the list of groups . |
25,492 | private Proctor getProctorNotNull ( ) { final Proctor proctor = proctorLoader . get ( ) ; if ( proctor == null ) { throw new IllegalStateException ( "Proctor specification and/or text matrix has not been loaded" ) ; } return proctor ; } | return currently - loaded Proctor instance throwing IllegalStateException if not loaded |
25,493 | public static void registerFilterTypes ( final Class < ? extends DynamicFilter > ... types ) { FILTER_TYPES . addAll ( Arrays . asList ( types ) ) ; } | Register custom filter types especially for serializer of specification json file |
25,494 | private ProctorContext getProctorContext ( final HttpServletRequest request ) throws IllegalAccessException , InstantiationException { final ProctorContext proctorContext = contextClass . newInstance ( ) ; final BeanWrapper beanWrapper = new BeanWrapperImpl ( proctorContext ) ; for ( final PropertyDescriptor descriptor... | Do some magic to turn request parameters into a context object |
25,495 | public static String resolveSvnMigratedRevision ( final Revision revision , final String branch ) { if ( revision == null ) { return null ; } final Pattern pattern = Pattern . compile ( "^git-svn-id: .*" + branch + "@([0-9]+) " , Pattern . MULTILINE ) ; final Matcher matcher = pattern . matcher ( revision . getMessage ... | Helper method to retrieve a canonical revision for git commits migrated from SVN . Migrated commits are detected by the presence of git - svn - id in the commit message . |
25,496 | public T mapRow ( ResultSet rs ) throws SQLException { Map < String , Object > map = new HashMap < String , Object > ( ) ; ResultSetMetaData metadata = rs . getMetaData ( ) ; for ( int i = 1 ; i <= metadata . getColumnCount ( ) ; ++ i ) { String label = metadata . getColumnLabel ( i ) ; final Object value ; switch ( me... | Map a single ResultSet row to a T instance . |
25,497 | public int getOpacity ( ) { int opacity = Math . round ( ( mPosToOpacFactor * ( mBarPointerPosition - mBarPointerHaloRadius ) ) ) ; if ( opacity < 5 ) { return 0x00 ; } else if ( opacity > 250 ) { return 0xFF ; } else { return opacity ; } } | Get the currently selected opacity . |
25,498 | private int calculateColor ( float angle ) { float unit = ( float ) ( angle / ( 2 * Math . PI ) ) ; if ( unit < 0 ) { unit += 1 ; } if ( unit <= 0 ) { mColor = COLORS [ 0 ] ; return COLORS [ 0 ] ; } if ( unit >= 1 ) { mColor = COLORS [ COLORS . length - 1 ] ; return COLORS [ COLORS . length - 1 ] ; } float p = unit * (... | Calculate the color using the supplied angle . |
25,499 | private float colorToAngle ( int color ) { float [ ] colors = new float [ 3 ] ; Color . colorToHSV ( color , colors ) ; return ( float ) Math . toRadians ( - colors [ 0 ] ) ; } | Convert a color to an angle . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.