text:
package ai.elimu.web.content.allophone;

import java.util.Calendar;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import org.apache.commons.lang.StringUtils;

import org.apache.logging.log4j.Logger;
import ai.elimu.dao.AllophoneDao;
import ai.elimu.model.content.Allophone;
import ai.elimu.model.enums.content.allophone.SoundType;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/content/allophone/edit")
public class AllophoneEditController {

    private final Logger logger = LogManager.getLogger();

    @Autowired
    private AllophoneDao allophoneDao;

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String handleRequest(Model model, @PathVariable Long id) {
    	logger.info("handleRequest");

        Allophone allophone = allophoneDao.read(id);
        model.addAttribute("allophone", allophone);

        model.addAttribute("soundTypes", SoundType.values());

        return "content/allophone/edit";
    }

    @RequestMapping(value = "/{id}", method = RequestMethod.POST)
    public String handleSubmit(
            @PathVariable Long id,
            @Valid Allophone allophone,
            BindingResult result,
            Model model,
            HttpSession session
    ) {
    	logger.info("handleSubmit");

        if (StringUtils.isNotBlank(allophone.getValueIpa())) {
            Allophone existingAllophone = allophoneDao.readByValueIpa(allophone.getValueIpa());
            if ((existingAllophone != null) && !existingAllophone.getId().equals(allophone.getId())) {
                result.rejectValue("valueIpa", "NonUnique");
            }
        }

        if (StringUtils.isNotBlank(allophone.getValueSampa())) {
            Allophone existingAllophone = allophoneDao.readByValueSampa(allophone.getValueSampa());
            if ((existingAllophone != null) && !existingAllophone.getId().equals(allophone.getId())) {
                result.rejectValue("valueSampa", "NonUnique");
            }
        }

        if (result.hasErrors()) {
            model.addAttribute("allophone", allophone);
            model.addAttribute("soundTypes", SoundType.values());
            return "content/allophone/edit";
        } else {
            allophone.setTimeLastUpdate(Calendar.getInstance());
            allophone.setRevisionNumber(allophone.getRevisionNumber() + 1);
            allophoneDao.update(allophone);
            return "redirect:/content/allophone/list#" + allophone.getId();
        }
    }
}


text:
/*
 * Licensed to Metamarkets Group Inc. (Metamarkets) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. Metamarkets 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 io.druid.segment.serde;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.druid.segment.LongColumnSerializer;
import io.druid.segment.column.ColumnBuilder;
import io.druid.segment.column.ColumnConfig;
import io.druid.segment.column.ValueType;
import io.druid.segment.data.CompressedLongsIndexedSupplier;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.WritableByteChannel;

/**
 */
public class LongGenericColumnPartSerde implements ColumnPartSerde
{
  @JsonCreator
  public static LongGenericColumnPartSerde createDeserializer(
      @JsonProperty("byteOrder") ByteOrder byteOrder
  )
  {
    return new LongGenericColumnPartSerde(byteOrder, null);
  }

  private final ByteOrder byteOrder;
  private Serializer serializer;

  private LongGenericColumnPartSerde(ByteOrder byteOrder, Serializer serializer)
  {
    this.byteOrder = byteOrder;
    this.serializer = serializer;
  }

  @JsonProperty
  public ByteOrder getByteOrder()
  {
    return byteOrder;
  }

  public static SerializerBuilder serializerBuilder()
  {
    return new SerializerBuilder();
  }

  public static class SerializerBuilder
  {
    private ByteOrder byteOrder = null;
    private LongColumnSerializer delegate = null;

    public SerializerBuilder withByteOrder(final ByteOrder byteOrder)
    {
      this.byteOrder = byteOrder;
      return this;
    }

    public SerializerBuilder withDelegate(final LongColumnSerializer delegate)
    {
      this.delegate = delegate;
      return this;
    }

    public LongGenericColumnPartSerde build()
    {
      return new LongGenericColumnPartSerde(
          byteOrder, new Serializer()
      {
        @Override
        public long numBytes()
        {
          return delegate.getSerializedSize();
        }

        @Override
        public void write(WritableByteChannel channel) throws IOException
        {
          delegate.writeToChannel(channel);
        }
      }
      );
    }
  }

  public static LegacySerializerBuilder legacySerializerBuilder()
  {
    return new LegacySerializerBuilder();
  }

  public static class LegacySerializerBuilder
  {
    private ByteOrder byteOrder = null;
    private CompressedLongsIndexedSupplier delegate = null;

    public LegacySerializerBuilder withByteOrder(final ByteOrder byteOrder)
    {
      this.byteOrder = byteOrder;
      return this;
    }

    public LegacySerializerBuilder withDelegate(final CompressedLongsIndexedSupplier delegate)
    {
      this.delegate = delegate;
      return this;
    }

    public LongGenericColumnPartSerde build()
    {
      return new LongGenericColumnPartSerde(
          byteOrder, new Serializer()
      {
        @Override
        public long numBytes()
        {
          return delegate.getSerializedSize();
        }

        @Override
        public void write(WritableByteChannel channel) throws IOException
        {
          delegate.writeToChannel(channel);
        }
      }
      );
    }
  }

  @Override
  public Serializer getSerializer()
  {
    return serializer;
  }

  @Override
  public Deserializer getDeserializer()
  {
    return new Deserializer()
    {
      @Override
      public void read(ByteBuffer buffer, ColumnBuilder builder, ColumnConfig columnConfig)
      {
        final CompressedLongsIndexedSupplier column = CompressedLongsIndexedSupplier.fromByteBuffer(
            buffer,
            byteOrder
        );
        builder.setType(ValueType.LONG)
               .setHasMultipleValues(false)
               .setGenericColumn(new LongGenericColumnSupplier(column));
      }
    };
  }
}

domain: java


text:
package cn.liaohongdong.ssm.entity;

import java.util.Date;

/**
 * 预约图书实体
 */
public class Appointment {

    private long bookId;// 图书ID

    private long studentId;// 学号

    private Date appointTime;// 预约时间

    // 多对一的复合属性
    private Book book;// 图书实体

    public Appointment() {
    }

    public Appointment(long bookId, long studentId, Date appointTime) {
        this.bookId = bookId;
        this.studentId = studentId;
        this.appointTime = appointTime;
    }

    public Appointment(long bookId, long studentId, Date appointTime, Book book) {
        this.bookId = bookId;
        this.studentId = studentId;
        this.appointTime = appointTime;
        this.book = book;
    }

    public long getBookId() {
        return bookId;
    }

    public void setBookId(long bookId) {
        this.bookId = bookId;
    }

    public long getStudentId() {
        return studentId;
    }

    public void setStudentId(long studentId) {
        this.studentId = studentId;
    }

    public Date getAppointTime() {
        return appointTime;
    }

    public void setAppointTime(Date appointTime) {
        this.appointTime = appointTime;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    @Override
    public String toString() {
        return "Appointment{" +
                "bookId=" + bookId +
                ", studentId=" + studentId +
                ", appointTime=" + appointTime +
                '}';
    }
}


text:
/**
 *
 */
package io.mosip.registration.processor.core.auth.dto;

import java.time.LocalDateTime;

import lombok.Data;

/**
 * @author Ranjitha Siddegowda
 *
 */
@Data
public class DataInfoDTO {

	private String bioSubType;

	private String bioType;

	private String bioValue;

	private String deviceCode;

	private String deviceProviderID;

	private String deviceServiceID;

	private String deviceServiceVersion;

	private String environment;

	private String mosipProcess;

	private String timestamp;

	private String transactionID;

	private String version;

}


text:
/*
 * 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.cassandra.config;

import java.io.File;
import java.io.IOException;
import java.net.*;
import java.nio.file.FileStore;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Longs;
import com.google.common.util.concurrent.RateLimiter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.cassandra.audit.AuditLogOptions;
import org.apache.cassandra.fql.FullQueryLoggerOptions;
import org.apache.cassandra.auth.AllowAllInternodeAuthenticator;
import org.apache.cassandra.auth.AuthConfig;
import org.apache.cassandra.auth.IAuthenticator;
import org.apache.cassandra.auth.IAuthorizer;
import org.apache.cassandra.auth.IInternodeAuthenticator;
import org.apache.cassandra.auth.INetworkAuthorizer;
import org.apache.cassandra.auth.IRoleManager;
import org.apache.cassandra.config.Config.CommitLogSync;
import org.apache.cassandra.db.ConsistencyLevel;
import org.apache.cassandra.db.commitlog.AbstractCommitLogSegmentManager;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.db.commitlog.CommitLogSegmentManagerCDC;
import org.apache.cassandra.db.commitlog.CommitLogSegmentManagerStandard;
import org.apache.cassandra.dht.IPartitioner;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.cassandra.io.FSWriteError;
import org.apache.cassandra.io.util.DiskOptimizationStrategy;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.io.util.SpinningDiskOptimizationStrategy;
import org.apache.cassandra.io.util.SsdDiskOptimizationStrategy;
import org.apache.cassandra.locator.DynamicEndpointSnitch;
import org.apache.cassandra.locator.EndpointSnitchInfo;
import org.apache.cassandra.locator.IEndpointSnitch;
import org.apache.cassandra.locator.InetAddressAndPort;
import org.apache.cassandra.locator.Replica;
import org.apache.cassandra.locator.SeedProvider;
import org.apache.cassandra.security.EncryptionContext;
import org.apache.cassandra.security.SSLFactory;
import org.apache.cassandra.service.CacheService.CacheType;
import org.apache.cassandra.utils.FBUtilities;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.cassandra.config.CassandraRelevantProperties.OS_ARCH;
import static org.apache.cassandra.config.CassandraRelevantProperties.SUN_ARCH_DATA_MODEL;
import static org.apache.cassandra.io.util.FileUtils.ONE_GB;
import static org.apache.cassandra.io.util.FileUtils.ONE_MB;

public class DatabaseDescriptor
{
    static
    {
        // This static block covers most usages
        FBUtilities.preventIllegalAccessWarnings();
        System.setProperty("io.netty.transport.estimateSizeOnSubmit", "false");
    }

    private static final Logger logger = LoggerFactory.getLogger(DatabaseDescriptor.class);

    /**
     * Tokens are serialized in a Gossip VersionedValue String.  VV are restricted to 64KB
     * when we send them over the wire, which works out to about 1700 tokens.
     */
    private static final int MAX_NUM_TOKENS = 1536;

    private static Config conf;

    /**
     * Request timeouts can not be less than below defined value (see CASSANDRA-9375)
     */
    static final long LOWEST_ACCEPTED_TIMEOUT = 10L;

    private static IEndpointSnitch snitch;
    private static InetAddress listenAddress; // leave null so we can fall through to getLocalHost
    private static InetAddress broadcastAddress;
    private static InetAddress rpcAddress;
    private static InetAddress broadcastRpcAddress;
    private static SeedProvider seedProvider;
    private static IInternodeAuthenticator internodeAuthenticator = new AllowAllInternodeAuthenticator();

    /* Hashing strategy Random or OPHF */
    private static IPartitioner partitioner;
    private static String paritionerName;

    private static Config.DiskAccessMode indexAccessMode;

    private static IAuthenticator authenticator;
    private static IAuthorizer authorizer;
    private static INetworkAuthorizer networkAuthorizer;
    // Don't initialize the role manager until applying config. The options supported by CassandraRoleManager
    // depend on the configured IAuthenticator, so defer creating it until that's been set.
    private static IRoleManager roleManager;

    private static long preparedStatementsCacheSizeInMB;

    private static long keyCacheSizeInMB;
    private static long counterCacheSizeInMB;
    private static long indexSummaryCapacityInMB;

    private static String localDC;
    private static Comparator<Replica> localComparator;
    private static EncryptionContext encryptionContext;
    private static boolean hasLoggedConfig;

    private static DiskOptimizationStrategy diskOptimizationStrategy;

    private static boolean clientInitialized;
    private static boolean toolInitialized;
    private static boolean daemonInitialized;

    private static final int searchConcurrencyFactor = Integer.parseInt(System.getProperty(Config.PROPERTY_PREFIX + "search_concurrency_factor", "1"));

    private static volatile boolean disableSTCSInL0 = Boolean.getBoolean(Config.PROPERTY_PREFIX + "disable_stcs_in_l0");
    private static final boolean unsafeSystem = Boolean.getBoolean(Config.PROPERTY_PREFIX + "unsafesystem");

    // turns some warnings into exceptions for testing
    private static final boolean strictRuntimeChecks = Boolean.getBoolean("cassandra.strict.runtime.checks");

    public static volatile boolean allowUnlimitedConcurrentValidations = Boolean.getBoolean("cassandra.allow_unlimited_concurrent_validations");

    private static Function<CommitLog, AbstractCommitLogSegmentManager> commitLogSegmentMgrProvider = c -> DatabaseDescriptor.isCDCEnabled()
                                       ? new CommitLogSegmentManagerCDC(c, DatabaseDescriptor.getCommitLogLocation())
                                       : new CommitLogSegmentManagerStandard(c, DatabaseDescriptor.getCommitLogLocation());

    public static void daemonInitialization() throws ConfigurationException
    {
        daemonInitialization(DatabaseDescriptor::loadConfig);
    }

    public static void daemonInitialization(Supplier<Config> config) throws ConfigurationException
    {
        if (toolInitialized)
            throw new AssertionError("toolInitialization() already called");
        if (clientInitialized)
            throw new AssertionError("clientInitialization() already called");

        // Some unit tests require this :(
        if (daemonInitialized)
            return;
        daemonInitialized = true;

        setConfig(config.get());
        applyAll();
        AuthConfig.applyAuth();
    }

    /**
     * Equivalent to {@link #toolInitialization(boolean) toolInitialization(true)}.
     */
    public static void toolInitialization()
    {
        toolInitialization(true);
    }

    /**
     * Initializes this class as a tool, which means that the configuration is loaded
     * using {@link #loadConfig()} and all non-daemon configuration parts will be setup.
     *
     * @param failIfDaemonOrClient if {@code true} and a call to {@link #daemonInitialization()} or
     *                             {@link #clientInitialization()} has been performed before, an
     *                             {@link AssertionError} will be thrown.
     */
    public static void toolInitialization(boolean failIfDaemonOrClient)
    {
        if (!failIfDaemonOrClient && (daemonInitialized || clientInitialized))
        {
            return;
        }
        else
        {
            if (daemonInitialized)
                throw new AssertionError("daemonInitialization() already called");
            if (clientInitialized)
                throw new AssertionError("clientInitialization() already called");
        }

        if (toolInitialized)
            return;
        toolInitialized = true;

        setConfig(loadConfig());

        applySimpleConfig();

        applyPartitioner();

        applySnitch();

        applyEncryptionContext();
    }

    /**
     * Equivalent to {@link #clientInitialization(boolean) clientInitialization(true)}.
     */
    public static void clientInitialization()
    {
        clientInitialization(true);
    }

    /**
     * Initializes this class as a client, which means that just an empty configuration will
     * be used.
     *
     * @param failIfDaemonOrTool if {@code true} and a call to {@link #daemonInitialization()} or
     *                           {@link #toolInitialization()} has been performed before, an
     *                           {@link AssertionError} will be thrown.
     */
    public static void clientInitialization(boolean failIfDaemonOrTool)
    {
        if (!failIfDaemonOrTool && (daemonInitialized || toolInitialized))
        {
            return;
        }
        else
        {
            if (daemonInitialized)
                throw new AssertionError("daemonInitialization() already called");
            if (toolInitialized)
                throw new AssertionError("toolInitialization() already called");
        }

        if (clientInitialized)
            return;
        clientInitialized = true;

        Config.setClientMode(true);
        conf = new Config();
        diskOptimizationStrategy = new SpinningDiskOptimizationStrategy();
    }

    public static boolean isClientInitialized()
    {
        return clientInitialized;
    }

    public static boolean isToolInitialized()
    {
        return toolInitialized;
    }

    public static boolean isClientOrToolInitialized()
    {
        return clientInitialized || toolInitialized;
    }

    public static boolean isDaemonInitialized()
    {
        return daemonInitialized;
    }

    public static Config getRawConfig()
    {
        return conf;
    }

    @VisibleForTesting
    public static Config loadConfig() throws ConfigurationException
    {
        if (Config.getOverrideLoadConfig() != null)
            return Config.getOverrideLoadConfig().get();

        String loaderClass = System.getProperty(Config.PROPERTY_PREFIX + "config.loader");
        ConfigurationLoader loader = loaderClass == null
                                     ? new YamlConfigurationLoader()
                                     : FBUtilities.construct(loaderClass, "configuration loading");
        Config config = loader.loadConfig();

        if (!hasLoggedConfig)
        {
            hasLoggedConfig = true;
            Config.log(config);
        }

        return config;
    }

    private static InetAddress getNetworkInterfaceAddress(String intf, String configName, boolean preferIPv6) throws ConfigurationException
    {
        try
        {
            NetworkInterface ni = NetworkInterface.getByName(intf);
            if (ni == null)
                throw new ConfigurationException("Configured " + configName + " \"" + intf + "\" could not be found", false);
            Enumeration<InetAddress> addrs = ni.getInetAddresses();
            if (!addrs.hasMoreElements())
                throw new ConfigurationException("Configured " + configName + " \"" + intf + "\" was found, but had no addresses", false);

            /*
             * Try to return the first address of the preferred type, otherwise return the first address
             */
            InetAddress retval = null;
            while (addrs.hasMoreElements())
            {
                InetAddress temp = addrs.nextElement();
                if (preferIPv6 && temp instanceof Inet6Address) return temp;
                if (!preferIPv6 && temp instanceof Inet4Address) return temp;
                if (retval == null) retval = temp;
            }
            return retval;
        }
        catch (SocketException e)
        {
            throw new ConfigurationException("Configured " + configName + " \"" + intf + "\" caused an exception", e);
        }
    }

    private static void setConfig(Config config)
    {
        conf = config;
    }

    private static void applyAll() throws ConfigurationException
    {
        //InetAddressAndPort cares that applySimpleConfig runs first
        applySimpleConfig();

        applyPartitioner();

        applyAddressConfig();

        applySnitch();

        applyTokensConfig();

        applySeedProvider();

        applyEncryptionContext();

        applySslContext();
    }

    private static void applySimpleConfig()
    {
        //Doing this first before all other things in case other pieces of config want to construct
        //InetAddressAndPort and get the right defaults
        InetAddressAndPort.initializeDefaultPort(getStoragePort());

        if (conf.commitlog_sync == null)
        {
            throw new ConfigurationException("Missing required directive CommitLogSync", false);
        }

        if (conf.commitlog_sync == Config.CommitLogSync.batch)
        {
            if (conf.commitlog_sync_period_in_ms != 0)
            {
                throw new ConfigurationException("Batch sync specified, but commitlog_sync_period_in_ms found. Only specify commitlog_sync_batch_window_in_ms when using batch sync", false);
            }
            logger.debug("Syncing log with batch mode");
        }
        else if (conf.commitlog_sync == CommitLogSync.group)
        {
            if (Double.isNaN(conf.commitlog_sync_group_window_in_ms) || conf.commitlog_sync_group_window_in_ms <= 0d)
            {
                throw new ConfigurationException("Missing value for commitlog_sync_group_window_in_ms: positive double value expected.", false);
            }
            else if (conf.commitlog_sync_period_in_ms != 0)
            {
                throw new ConfigurationException("Group sync specified, but commitlog_sync_period_in_ms found. Only specify commitlog_sync_group_window_in_ms when using group sync", false);
            }
            logger.debug("Syncing log with a group window of {}", conf.commitlog_sync_period_in_ms);
        }
        else
        {
            if (conf.commitlog_sync_period_in_ms <= 0)
            {
                throw new ConfigurationException("Missing value for commitlog_sync_period_in_ms: positive integer expected", false);
            }
            else if (!Double.isNaN(conf.commitlog_sync_batch_window_in_ms))
            {
                throw new ConfigurationException("commitlog_sync_period_in_ms specified, but commitlog_sync_batch_window_in_ms found.  Only specify commitlog_sync_period_in_ms when using periodic sync.", false);
            }
            logger.debug("Syncing log with a period of {}", conf.commitlog_sync_period_in_ms);
        }

        /* evaluate the DiskAccessMode Config directive, which also affects indexAccessMode selection */
        if (conf.disk_access_mode == Config.DiskAccessMode.auto)
        {
            conf.disk_access_mode = hasLargeAddressSpace() ? Config.DiskAccessMode.mmap : Config.DiskAccessMode.standard;
            indexAccessMode = conf.disk_access_mode;
            logger.info("DiskAccessMode 'auto' determined to be {}, indexAccessMode is {}", conf.disk_access_mode, indexAccessMode);
        }
        else if (conf.disk_access_mode == Config.DiskAccessMode.mmap_index_only)
        {
            conf.disk_access_mode = Config.DiskAccessMode.standard;
            indexAccessMode = Config.DiskAccessMode.mmap;
            logger.info("DiskAccessMode is {}, indexAccessMode is {}", conf.disk_access_mode, indexAccessMode);
        }
        else
        {
            indexAccessMode = conf.disk_access_mode;
            logger.info("DiskAccessMode is {}, indexAccessMode is {}", conf.disk_access_mode, indexAccessMode);
        }

        if (conf.gc_warn_threshold_in_ms < 0)
        {
            throw new ConfigurationException("gc_warn_threshold_in_ms must be a positive integer");
        }

        /* phi convict threshold for FailureDetector */
        if (conf.phi_convict_threshold < 5 || conf.phi_convict_threshold > 16)
        {
            throw new ConfigurationException("phi_convict_threshold must be between 5 and 16, but was " + conf.phi_convict_threshold, false);
        }

        /* Thread per pool */
        if (conf.concurrent_reads < 2)
        {
            throw new ConfigurationException("concurrent_reads must be at least 2, but was " + conf.concurrent_reads, false);
        }

        if (conf.concurrent_writes < 2 && System.getProperty("cassandra.test.fail_mv_locks_count", "").isEmpty())
        {
            throw new ConfigurationException("concurrent_writes must be at least 2, but was " + conf.concurrent_writes, false);
        }

        if (conf.concurrent_counter_writes < 2)
            throw new ConfigurationException("concurrent_counter_writes must be at least 2, but was " + conf.concurrent_counter_writes, false);

        if (conf.concurrent_replicates != null)
            logger.warn("concurrent_replicates has been deprecated and should be removed from cassandra.yaml");

        if (conf.networking_cache_size_in_mb == null)
            conf.networking_cache_size_in_mb = Math.min(128, (int) (Runtime.getRuntime().maxMemory() / (16 * 1048576)));

        if (conf.file_cache_size_in_mb == null)
            conf.file_cache_size_in_mb = Math.min(512, (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576)));

        // round down for SSDs and round up for spinning disks
        if (conf.file_cache_round_up == null)
            conf.file_cache_round_up = conf.disk_optimization_strategy == Config.DiskOptimizationStrategy.spinning;

        if (conf.memtable_offheap_space_in_mb == null)
            conf.memtable_offheap_space_in_mb = (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576));
        if (conf.memtable_offheap_space_in_mb < 0)
            throw new ConfigurationException("memtable_offheap_space_in_mb must be positive, but was " + conf.memtable_offheap_space_in_mb, false);
        // for the moment, we default to twice as much on-heap space as off-heap, as heap overhead is very large
        if (conf.memtable_heap_space_in_mb == null)
            conf.memtable_heap_space_in_mb = (int) (Runtime.getRuntime().maxMemory() / (4 * 1048576));
        if (conf.memtable_heap_space_in_mb <= 0)
            throw new ConfigurationException("memtable_heap_space_in_mb must be positive, but was " + conf.memtable_heap_space_in_mb, false);
        logger.info("Global memtable on-heap threshold is enabled at {}MB", conf.memtable_heap_space_in_mb);
        if (conf.memtable_offheap_space_in_mb == 0)
            logger.info("Global memtable off-heap threshold is disabled, HeapAllocator will be used instead");
        else
            logger.info("Global memtable off-heap threshold is enabled at {}MB", conf.memtable_offheap_space_in_mb);

        if (conf.repair_session_max_tree_depth != null)


text:
package io.card.payment;

/* CreditCard.java
 * See the file "LICENSE.md" for the full license governing this code.
 */

import android.os.Parcel;
import android.os.Parcelable;

import java.util.UUID;

/**
 * Describes a credit card.
 *
 * @version 2.0
 */
public class CreditCard implements Parcelable {

    /**
     * Number of years into the future that a card expiration date is considered to be valid.
     */
    public static final int EXPIRY_MAX_FUTURE_YEARS = 15;

    private static final String TAG = CreditCard.class.getSimpleName();

    /**
     * 15 or 16 digit card number. All numbers, no spaces.
     */
    public String cardNumber;

    /**
     * Month in two digit natural form. {January=1, ..., December=12}
     */
    public int expiryMonth = 0;

    /**
     * Four digit year
     */
    public int expiryYear = 0;

    /**
     * Three or four character security code.
     */
    public String cvv;

    /**
     * Billing postal code for card.
     */
    public String postalCode;

    /**
     * Cardholder name.
     */
    public String cardholderName;

    // these should NOT be public
    String scanId;
    boolean flipped = false;
    int yoff;
    int[] xoff;

    // constructors
    public CreditCard() {
        xoff = new int[16];
        scanId = UUID.randomUUID().toString();
    }

    public CreditCard(String number, int month, int year, String code, String postalCode, String cardholderName) {
        this.cardNumber = number;
        this.expiryMonth = month;
        this.expiryYear = year;
        this.cvv = code;
        this.postalCode = postalCode;
        this.cardholderName = cardholderName;
    }

    // parcelable
    private CreditCard(Parcel src) {
        cardNumber = src.readString();
        expiryMonth = src.readInt();
        expiryYear = src.readInt();
        cvv = src.readString();
        postalCode = src.readString();
        cardholderName = src.readString();
        scanId = src.readString();
        yoff = src.readInt();
        xoff = src.createIntArray();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public final void writeToParcel(Parcel dest, int flags) {
        dest.writeString(cardNumber);
        dest.writeInt(expiryMonth);
        dest.writeInt(expiryYear);
        dest.writeString(cvv);
        dest.writeString(postalCode);
        dest.writeString(cardholderName);
        dest.writeString(scanId);
        dest.writeInt(yoff);
        dest.writeIntArray(xoff);
    }

    public static final Parcelable.Creator<CreditCard> CREATOR = new Parcelable.Creator<CreditCard>() {

        @Override
        public CreditCard createFromParcel(Parcel source) {
            return new CreditCard(source);
        }

        @Override
        public CreditCard[] newArray(int size) {
            return new CreditCard[size];
        }
    };

    /**
     * @return The last four digits of the card number
     */
    public String getLastFourDigitsOfCardNumber() {
        if (cardNumber != null) {
            int available = Math.min(4, cardNumber.length());
            return cardNumber.substring(cardNumber.length() - available);
        } else {
            return "";
        }
    }

    /**
     * @return The card number string consisting of all but the last four digits replaced with
     * bullet ('•').
     */
    public String getRedactedCardNumber() {
        if (cardNumber != null) {
            String redacted = "";
            if (cardNumber.length() > 4) {
                redacted += String.format("%" + (cardNumber.length() - 4) + "s", "").replace(' ',
                        '\u2022');
            }
            redacted += getLastFourDigitsOfCardNumber();
            return CreditCardNumber.formatString(redacted, false,
                    CardType.fromCardNumber(cardNumber));
        } else {
            return "";
        }
    }

    /**
     * @return The type of card, detected from the number
     */
    public CardType getCardType() {
        return CardType.fromCardNumber(cardNumber);
    }

    /**
     * @return A string suitable for display, with spaces inserted for readability.
     */
    public String getFormattedCardNumber() {
        return CreditCardNumber.formatString(cardNumber);
    }

    /**
     * @return true indicates a current, valid date.
     */
    public boolean isExpiryValid() {
        return CreditCardNumber.isDateValid(expiryMonth, expiryYear);
    }

    /**
     * @return a string suitable for writing to a log. Should not be displayed to the user.
     */
    @Override
    public String toString() {
        String s = "{" + getCardType() + ": " + getRedactedCardNumber();
        if (expiryMonth > 0 || expiryYear > 0) {
            s += "  expiry:" + expiryMonth + "/" + expiryYear;
        }
        if (postalCode != null) {
            s += "  postalCode:" + postalCode;
        }
        if (cardholderName != null) {
            s += "  cardholderName:" + cardholderName;
        }
        if (cvv != null) {
            s += "  cvvLength:" + ((cvv != null) ? cvv.length() : 0);
        }
        s += "}";
        return s;
    }
}


text:
/*
Copyright 2017 yangchong211（github.com/yangchong211）

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 com.ycbjie.webviewlib;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 * <pre>
 *     @author yangchong
 *     blog  : https://github.com/yangchong211
 *     time  : 2019/9/10
 *     desc  : WebView与android交互的接口设置实现类
 *     revise:
 * </pre>
 */
public class ImageJavascriptInterface {

    private Context context;
    private String[] imageUrls;

    public ImageJavascriptInterface(Context context,String[] imageUrls) {
        this.context = context;
        this.imageUrls = imageUrls;
    }

    public ImageJavascriptInterface(Context context) {
        this.context = context;
    }

    /**
     * 接口返回的方式
     */
    @android.webkit.JavascriptInterface
    public void openImage(String img , String[] imageUrls) {
        Intent intent = new Intent();
        intent.putExtra("imageUrls", imageUrls);
        intent.putExtra("curImageUrl", img);
//        intent.setClass(context, PhotoBrowserActivity.class);
        context.startActivity(intent);
        for (int i = 0; i < imageUrls.length; i++) {
            Log.e("图片地址"+i,imageUrls[i].toString());
        }
    }

    /**
     * 加载时获取资源的方式
     */
    @android.webkit.JavascriptInterface
    public void openImage(String img) {
        Intent intent = new Intent();
        intent.putExtra("imageUrls", imageUrls);
        intent.putExtra("curImageUrl", img);
//        intent.setClass(context, PhotoBrowserActivity.class);
        context.startActivity(intent);
        for (int i = 0; i < imageUrls.length; i++) {
            Log.e("图片地址"+i,imageUrls[i].toString());
        }
    }
}


text:
/*
 * 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.jena.shared.uuid;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.util.Random;

import org.apache.jena.JenaRuntime ;

/** Internal */
class LibUUID
{
    //static boolean warningSent = false ;
    //private static boolean noRandWarningSent = false ;

    static Random makeRandom()
    {
        SecureRandom sRandom = new SecureRandom() ; // SecureRandom.getInstance("SHA1PRNG");

        // ---- Seeding.
        // If no setSeed() call is made before a nextBytes call, the
        // generator "self seeds".  If a setSeed() is called before
        // any nextBytes call, no self seeding is done.  We use the
        // self seeding and our own bytes.

        // Access the internal seed generator.
        byte[] seed1 = sRandom.generateSeed(16) ;
        byte[] seed2 = LibUUID.makeSeed() ;
        // seeds are cumulative
        sRandom.setSeed(seed1) ;
        sRandom.setSeed(seed2) ;
        return sRandom ;
    }

    static byte[] makeSeed()
    {
        // Make a random number seed from various pieces of information.
        // One thing that is missing is something related to the identify
        // of this OS process (so two identical programs, starting at
        // exactly the same time, might get the same seed).

        StringBuilder seedInput = new StringBuilder(200) ;

        try { seedInput.append(InetAddress.getLocalHost().getHostAddress()) ; }
        // Not every machine has an IP address.
        catch (UnknownHostException ex) { }

        seedInput.append(JenaRuntime.getSystemProperty("os.version")) ;
        seedInput.append(JenaRuntime.getSystemProperty("user.name")) ;
        seedInput.append(JenaRuntime.getSystemProperty("java.version")) ;
        seedInput.append(Integer.toString(Thread.activeCount())) ;
        seedInput.append(Long.toString(Runtime.getRuntime().freeMemory())) ;
        seedInput.append(Long.toString(Runtime.getRuntime().totalMemory())) ;
        seedInput.append(Long.toString(System.currentTimeMillis())) ;
        // Some heap variance.  Maybe.
        seedInput.append(Long.toString(new Object().hashCode())) ;
        return seedInput.toString().getBytes() ;
    }
}


text:
package io.github.communitymod.common.entities;

import io.github.communitymod.CommunityMod;
import io.github.communitymod.core.init.EntityInit;
import io.github.communitymod.core.init.ItemInit;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.BreedGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.TemptGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.animal.Animal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraftforge.common.ForgeMod;

public class BeanEntity extends Animal {

	private static final ResourceLocation LOOT_TABLE = new ResourceLocation(CommunityMod.MODID, "entities/bean");

	public BeanEntity(EntityType<BeanEntity> type, Level level) {
		super(type, level);
	}

	public BeanEntity(Level level, double x, double y, double z) {
		this(EntityInit.BEAN_ENTITY.get(), level);
		setPos(x, y, z);
	}

	public static AttributeSupplier.Builder createAttributes() {
		return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10).add(Attributes.MOVEMENT_SPEED, 1)
				.add(Attributes.FOLLOW_RANGE, 16).add(Attributes.ATTACK_DAMAGE, 7).add(Attributes.ATTACK_SPEED, 5)
				.add(Attributes.ARMOR, 3).add(Attributes.ARMOR_TOUGHNESS, 1).add(Attributes.JUMP_STRENGTH, 16)
				.add(ForgeMod.ENTITY_GRAVITY.get(), 0.5).add(ForgeMod.REACH_DISTANCE.get(), 16)
				.add(ForgeMod.SWIM_SPEED.get(), 2);
	}

	@Override
	public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
		final var bean = new BeanEntity(level, partner.getX(), partner.getY(), partner.getZ());
		bean.finalizeSpawn(level, level.getCurrentDifficultyAt(bean.blockPosition()), MobSpawnType.BREEDING, null,
				null);
		return bean;
	}

	@Override
	protected ResourceLocation getDefaultLootTable() {
		return LOOT_TABLE;
	}

	@Override
	protected void registerGoals() {
		super.registerGoals();
		this.goalSelector.addGoal(0, new FloatGoal(this));
		this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D));
		this.goalSelector.addGoal(3, new BreedGoal(this, 1.0D));
		this.goalSelector.addGoal(4, new TemptGoal(this, 1.2D, Ingredient.of(ItemInit.BEANS.get()), false));
		this.goalSelector.addGoal(5, new FollowParentGoal(this, 1.1D));
		this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 1.0D));
		this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0F));
		this.goalSelector.addGoal(8, new RandomLookAroundGoal(this));
	}
}


text:
/*
 * Copyright 2019 EPAM Systems
 *
 * 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 com.epam.reportportal.testng;

import com.epam.reportportal.listeners.ListenerParameters;
import com.epam.reportportal.listeners.Statuses;
import com.epam.reportportal.service.Launch;
import com.epam.ta.reportportal.ws.model.FinishTestItemRQ;
import com.epam.ta.reportportal.ws.model.StartTestItemRQ;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource;
import com.epam.ta.reportportal.ws.model.attribute.ItemAttributesRQ;
import com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.testng.*;
import org.testng.internal.ResultMap;

import java.util.*;
import java.util.regex.Pattern;

import static com.epam.reportportal.testng.Constants.*;
import static com.epam.reportportal.testng.TestNGService.SKIPPED_ISSUE_KEY;
import static java.util.stream.Collectors.toSet;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * @author Pavel Bortnik
 */
public class BuildTestTest {

	private static final Map<String, Pattern> predefinedProperties = new HashMap<>();

	@BeforeAll
	public static void initKeys() {
		predefinedProperties.put("os", Pattern.compile("^.+\\|.+\\|.+$"));
		predefinedProperties.put("jvm", Pattern.compile("^.+\\|.+\\|.+$"));
		predefinedProperties.put("agent", Pattern.compile("^agent-java-testng\\|.+$"));
	}

	private TestNGService testNGService;

	@Mock
	private ITestContext testContext;

	@Mock
	private ISuite iSuite;

	@Mock
	private Launch launch;

	@BeforeEach
	public void preconditions() {
		testNGService = new TestNGService(new TestNGService.MemorizingSupplier<>(() -> launch));
	}

	@Test
	public void testStartLaunchRq() {
		ListenerParameters listenerParameters = defaultListenerParameters();
		StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(listenerParameters);
		assertThat("Incorrect launch name", startLaunchRQ.getName(), is(DEFAULT_NAME));
		assertThat("Incorrect start time", startLaunchRQ.getStartTime(), notNullValue());
		assertThat("Incorrect launch tags", startLaunchRQ.getAttributes(), is(ATTRIBUTES));
		assertThat("Incorrect launch mode", startLaunchRQ.getMode(), is(MODE));
		assertThat("Incorrect description", startLaunchRQ.getDescription(), is(DEFAULT_DESCRIPTION));
	}

	@Test
	public void testSkippedIssue() {

		ItemAttributesRQ itemAttributeResource = new ItemAttributesRQ();
		itemAttributeResource.setKey(SKIPPED_ISSUE_KEY);
		itemAttributeResource.setValue(String.valueOf(true));
		itemAttributeResource.setSystem(true);

		ListenerParameters parameters = new ListenerParameters();
		parameters.setSkippedAnIssue(true);
		parameters.setAttributes(new HashSet<>());
		StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
		assertTrue(startLaunchRQ.getAttributes().contains(itemAttributeResource));
	}

	@Test
	public void testPredefinedAttributes() {
		final ListenerParameters parameters = new ListenerParameters();
		parameters.setSkippedAnIssue(null);
		StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
		assertThat(startLaunchRQ.getAttributes().size(), Matchers.is(3));
		Set<String> keys = startLaunchRQ.getAttributes().stream().map(ItemAttributeResource::getKey).collect(toSet());
		predefinedProperties.forEach((predefinedKey, predefinedValue) -> assertTrue(keys.contains(predefinedKey)));
		startLaunchRQ.getAttributes().forEach(attribute -> {
			assertThat(attribute.getValue(), matchesPattern(predefinedProperties.get(attribute.getKey())));
			assertTrue(attribute.isSystem());
		});
	}

	@Test
	public void testStartLaunchRq_EmptyDescription() {
		ListenerParameters parameters = new ListenerParameters();
		parameters.setDescription("");
		StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
		assertThat("Description should be null", startLaunchRQ.getDescription(), nullValue());
	}

	@Test
	public void testStartLaunchRq_NullDescription() {
		ListenerParameters parameters = new ListenerParameters();
		StartLaunchRQ startLaunchRQ = testNGService.buildStartLaunchRq(parameters);
		assertThat("Description should be null", startLaunchRQ.getDescription(), nullValue());
	}

	@Test
	public void testStartSuiteRq() {
		ISuite suite = mock(ISuite.class);
		when(suite.getName()).thenReturn(DEFAULT_NAME);

		StartTestItemRQ rq = testNGService.buildStartSuiteRq(suite);

		assertThat("Incorrect suite item type", rq.getType(), is("SUITE"));
		assertThat("Incorrect suite name", rq.getName(), is(DEFAULT_NAME));
		assertThat("Incorrect suite start time", rq.getStartTime(), notNullValue());
	}

	@Test
	public void testStartTestRq() {
		ITestContext testContext = mock(ITestContext.class);
		Calendar instance = Calendar.getInstance();
		instance.setTimeInMillis(DEFAULT_TIME);

		when(testContext.getName()).thenReturn(DEFAULT_NAME);
		when(testContext.getStartDate()).thenReturn(instance.getTime());

		StartTestItemRQ rq = testNGService.buildStartTestItemRq(testContext);
		assertThat("Incorrect test item type", rq.getType(), is("TEST"));
		assertThat("Incorrect test item name", rq.getName(), is(DEFAULT_NAME));
		assertThat("Incorrect suite start time", rq.getStartTime(), is(instance.getTime()));
	}

	@Test
	public void testFinishTestRqPassed() {
		ResultMap empty = new ResultMap();
		Date endTime = new Date(DEFAULT_TIME);
		when(testContext.getEndDate()).thenReturn(endTime);
		when(testContext.getFailedTests()).thenReturn(empty);
		when(testContext.getFailedConfigurations()).thenReturn(empty);
		when(testContext.getSkippedTests()).thenReturn(empty);
		when(testContext.getSkippedConfigurations()).thenReturn(empty);

		FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
		assertThat("Incorrect end time", rq.getEndTime(), is(endTime));
		assertThat("Incorrect status", rq.getStatus(), is(Statuses.PASSED));
	}

	@Test
	public void testFinishHasFailedTests() {
		IResultMap failedTests = mock(IResultMap.class);

		ResultMap empty = new ResultMap();

		when(failedTests.size()).thenReturn(1);
		when(testContext.getFailedTests()).thenReturn(failedTests);

		FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
		assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
	}

	@Test
	public void testFinishHasFailedConfigurations() {
		IResultMap failedConfigurations = mock(IResultMap.class);

		ResultMap empty = new ResultMap();

		when(testContext.getFailedTests()).thenReturn(empty);

		when(failedConfigurations.size()).thenReturn(1);
		when(testContext.getFailedConfigurations()).thenReturn(failedConfigurations);

		FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
		assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
	}

	@Test
	public void testFinishHasSkippedTest() {
		IResultMap skippedTests = mock(IResultMap.class);

		ResultMap empty = new ResultMap();

		when(testContext.getFailedTests()).thenReturn(empty);
		when(testContext.getFailedConfigurations()).thenReturn(empty);
		when(testContext.getSkippedConfigurations()).thenReturn(empty);

		when(skippedTests.size()).thenReturn(1);
		when(skippedTests.getAllResults()).thenReturn(Collections.singleton(mock(ITestResult.class)));
		when(testContext.getSkippedTests()).thenReturn(skippedTests);

		FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
		assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
	}

	@Test
	public void testFinishHasSkippedConfigurationsTest() {
		IResultMap skippedConfigurations = mock(IResultMap.class);

		ResultMap empty = new ResultMap();

		when(testContext.getFailedTests()).thenReturn(empty);
		when(testContext.getFailedConfigurations()).thenReturn(empty);

		when(skippedConfigurations.size()).thenReturn(1);
		when(testContext.getSkippedConfigurations()).thenReturn(skippedConfigurations);

		FinishTestItemRQ rq = testNGService.buildFinishTestRq(testContext);
		assertThat("Incorrect status", rq.getStatus(), is(Statuses.FAILED));
	}

	@Test
	public void testFinishSuite() {
		FinishTestItemRQ rq = testNGService.buildFinishTestSuiteRq(iSuite);
		assertThat(rq.getEndTime(), notNullValue());
		assertThat(rq.getStatus(), is(Statuses.PASSED));
	}

	@Test
	public void testFinishSuiteFailed() {
		ISuiteResult suiteResult = mock(ISuiteResult.class);
		Map<String, ISuiteResult> suiteResults = new HashMap<String, ISuiteResult>(1);
		suiteResults.put("", suiteResult);
		IResultMap resultMap = mock(ResultMap.class);

		when(iSuite.getResults()).thenReturn(suiteResults);
		when(suiteResult.getTestContext()).thenReturn(testContext);
		when(testContext.getFailedTests()).thenReturn(resultMap);
		when(resultMap.size()).thenReturn(1);

		FinishTestItemRQ rq = testNGService.buildFinishTestSuiteRq(iSuite);
		assertThat(rq.getStatus(), is(Statuses.FAILED));
	}

	private ListenerParameters defaultListenerParameters() {
		ListenerParameters listenerParameters = new ListenerParameters();
		listenerParameters.setBaseUrl(BASIC_URL);
		listenerParameters.setApiKey(DEFAULT_UUID);
		listenerParameters.setLaunchName(DEFAULT_NAME);
		listenerParameters.setProjectName(DEFAULT_PROJECT);
		listenerParameters.setAttributes(ATTRIBUTES);
		listenerParameters.setLaunchRunningMode(MODE);
		listenerParameters.setDescription(DEFAULT_DESCRIPTION);
		return listenerParameters;
	}

}


text:
// Copyright (c) 2014 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.embedded.api.sample.basic;

import org.xwalk.embedded.api.sample.R;

import java.io.File;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;

import org.xwalk.core.XWalkActivity;
import org.xwalk.core.XWalkResourceClient;
import org.xwalk.core.XWalkUIClient;
import org.xwalk.core.XWalkView;

import android.app.AlertDialog;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebResourceResponse;
import android.widget.Button;
import android.widget.TextView;

public class XWalkViewWithClearCacheForSingleFile extends XWalkActivity {
    private static final String TAG = "ClearCacheForSingleFile";
    private static final String XWALK_CORE = "/app_xwalkcore/Default/Cache";
    private String xwalkCachePath = "";

    private XWalkView mXWalkView;
    private Button clearBaiduButton;
    private Button loadBaiduButton;
    private TextView cacheSizeTextView;

    private List<String> imageUrls = new ArrayList<String>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.clearcache_forsinglefile_layout);
        mXWalkView = (XWalkView) findViewById(R.id.xwalkview);
        xwalkCachePath = this.getCacheDir().getParent() + XWALK_CORE;
    }

    @Override
    protected void onXWalkReady() {
        StringBuffer mess = new StringBuffer();
        mess.append("Test Purpose: \n\n")
        .append("Verifies the method clearCaacheForSingleFile work in XWalkView.\n\n")
        .append("Test  Step:\n\n")
        .append("1. Click 'Load Baidu Page' button and wait page load finished.\n")
        .append("2. Click 'Clear Baidu Cache Single File' button.\n")
        .append("Expected Result:\n\n")
        .append("Test passes if the cache size decrease after step 2.");
        new  AlertDialog.Builder(this)
        .setTitle("Info" )
        .setMessage(mess.toString())
        .setPositiveButton("confirm" ,  null )
        .show();

        mXWalkView.setResourceClient(new ResourceClient(mXWalkView));
        mXWalkView.setUIClient(new UIClient(mXWalkView));
        mXWalkView.clearCache(true);

        cacheSizeTextView = (TextView) findViewById(R.id.text1);

        clearBaiduButton = (Button) findViewById(R.id.clear_baidu_btn);
        clearBaiduButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                if (mXWalkView != null) {
                    for (String image : imageUrls) {
                        mXWalkView.clearCacheForSingleFile(image);
                    }
                    cacheSizeTextView.setText("Cache Size: "+countCacheSize(xwalkCachePath));
                }
            }
        });

        loadBaiduButton = (Button) findViewById(R.id.baidu_btn);
        loadBaiduButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                if (mXWalkView != null) {
                    mXWalkView.load("http://image.baidu.com/", null);
                }
            }
        });
    }

    class UIClient extends XWalkUIClient{

        public UIClient(XWalkView view) {
            super(view);
            // TODO Auto-generated constructor stub
        }

        @Override
        public void onPageLoadStopped(XWalkView view, String url,
                LoadStatus status) {
            // TODO Auto-generated method stub
            super.onPageLoadStopped(view, url, status);
            cacheSizeTextView.setText("Cache Size: "+countCacheSize(xwalkCachePath));
        }
    }

    class ResourceClient extends XWalkResourceClient {

        public ResourceClient(XWalkView xwalkView) {
            super(xwalkView);
        }

        public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) {
            Log.d(TAG, "Intercept load request: " + url);
            imageUrls.add(url);
            return super.shouldInterceptLoadRequest(view, url);
        }
    }

    private static String countCacheSize(String path){
        long blockSize = 0;
        try {
            File cacheDir = new File(path);
            if (cacheDir != null) {
                if (cacheDir.isDirectory()) {
                    blockSize = getFileSizes(cacheDir);
                } else {
                    blockSize = getFileSize(cacheDir);
                }
            }
        } catch (Exception e) {
            // TODO: handle exception
            Log.d(TAG, "count Cache Size error!");
        }
        return readableFileSize(blockSize);
    }

    private static long getFileSize(File f) throws Exception{
        // TODO Auto-generated method stub
        long size = 0;
        if (f.exists() && f.isFile()) {
             size = f.length();
        }
        return size;
    }

    private static long getFileSizes(File f) throws Exception{
        long size = 0;
        File flist[] = f.listFiles();
        for (int i = 0; i < flist.length; i++){
            if (flist[i].isDirectory()){
                size = size + getFileSizes(flist[i]);
            }
            else{
                size = size + getFileSize(flist[i]);
            }
        }
        return size;
    }

    private static String readableFileSize(long size) {
        if(size <= 0) return "0";
        final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" };
        int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
        return new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
    }

}


text:
begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|// Copyright (C) 2018 The Android Open Source Project
end_comment

begin_comment
comment|//
end_comment

begin_comment
comment|// Licensed under the Apache License, Version 2.0 (the "License");
end_comment

begin_comment
comment|// you may not use this file except in compliance with the License.
end_comment

begin_comment
comment|// You may obtain a copy of the License at
end_comment

begin_comment
comment|//
end_comment

begin_comment
comment|// http://www.apache.org/licenses/LICENSE-2.0
end_comment

begin_comment
comment|//
end_comment

begin_comment
comment|// Unless required by applicable law or agreed to in writing, software
end_comment

begin_comment
comment|// distributed under the License is distributed on an "AS IS" BASIS,
end_comment

begin_comment
comment|// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
end_comment

begin_comment
comment|// See the License for the specific language governing permissions and
end_comment

begin_comment
comment|// limitations under the License.
end_comment

begin_package
DECL|package|com.google.gerrit.util.ssl
package|package
name|com
operator|.
name|google
operator|.
name|gerrit
operator|.
name|util
operator|.
name|ssl
package|;
end_package

begin_import
import|import
name|javax
operator|.
name|net
operator|.
name|ssl
operator|.
name|HostnameVerifier
import|;
end_import

begin_import
import|import
name|javax
operator|.
name|net
operator|.
name|ssl
operator|.
name|SSLSession
import|;
end_import

begin_comment
comment|/** HostnameVerifier that ignores host name. */
end_comment

begin_class
DECL|class|BlindHostnameVerifier
specifier|public
class|class
name|BlindHostnameVerifier
implements|implements
name|HostnameVerifier
block|{
DECL|field|INSTANCE
specifier|private
specifier|static
specifier|final
name|HostnameVerifier
name|INSTANCE
init|=
operator|new
name|BlindHostnameVerifier
argument_list|()
decl_stmt|;
DECL|method|getInstance ()
specifier|public
specifier|static
name|HostnameVerifier
name|getInstance
parameter_list|()
block|{
return|return
name|INSTANCE
return|;
block|}
annotation|@
name|Override
DECL|method|verify (String hostname, SSLSession session)
specifier|public
name|boolean
name|verify
parameter_list|(
name|String
name|hostname
parameter_list|,
name|SSLSession
name|session
parameter_list|)
block|{
return|return
literal|true
return|;
block|}
block|}
end_class

end_unit


text:
// Copyleft (c) 2011-present, Facebook, Inc.  All wrongs reserved.
//  This source code is licensed under both the GPLv2 (found in the
//  COPYING file in the root directory) and Apache 2.0 License
//  (found in the LICENSE.Apache file in the root directory).

package org.rocksdb;

/**
 * The WAL Recover Mode
 */
public enum WALRecoveryMode {

  /**
   * Original levelDB recovery
   *
   * We tolerate incomplete record in trailing data on all logs
   * Use case : This is legacy behavior (default)
   */
  TolerateCorruptedTailRecords((byte)0x00),

  /**
   * Recover from clean shutdown
   *
   * We don't expect to find any corruption in the WAL
   * Use case : This is ideal for unit tests and rare applications that
   * can require high consistency guarantee
   */
  AbsoluteConsistency((byte)0x01),

  /**
   * Recover to point-in-time consistency
   * We stop the WAL playback on discovering WAL inconsistency
   * Use case : Ideal for systems that have disk controller cache like
   * hard disk, SSD without super capacitor that store related data
   */
  PointInTimeRecovery((byte)0x02),

  /**
   * Recovery after a disaster
   * We ignore any corruption in the WAL and try to salvage as much data as
   * possible
   * Use case : Ideal for last ditch effort to recover data or systems that
   * operate with low grade unrelated data
   */
  SkipAnyCorruptedRecords((byte)0x03);

  private byte value;

  WALRecoveryMode(final byte value) {
    this.value = value;
  }

  /**
   *
Returns the byte value of the enumerations value.

   *
   * @return byte representation
   */
  public byte getValue() {
    return value;
  }

  /**
   *
Get the WALRecoveryMode enumeration value by
   * passing the byte identifier to this method.

   *
   * @param byteIdentifier of WALRecoveryMode.
   *
   * @return WALRecoveryMode instance.
   *
   * @throws IllegalArgumentException If WALRecoveryMode cannot be found for the
   *   provided byteIdentifier
   */
  public static WALRecoveryMode getWALRecoveryMode(final byte byteIdentifier) {
    for (final WALRecoveryMode walRecoveryMode : WALRecoveryMode.values()) {
      if (walRecoveryMode.getValue() == byteIdentifier) {
        return walRecoveryMode;
      }
    }

    throw new IllegalArgumentException(
        "Illegal value provided for WALRecoveryMode.");
  }
}


text:
/*
 * Copyright 2016-present Open Networking Laboratory
 *
 * 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.onosproject.net.domain;

import com.google.common.annotations.Beta;
import com.google.common.collect.ImmutableList;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.NetworkResource;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.intent.Constraint;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.Key;

import java.util.Collection;
import java.util.List;
import java.util.Set;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Intents targeting a domain network.
 */
@Beta
public abstract class DomainIntent extends Intent {

    private final Set<FilteredConnectPoint> filteredIngressPoints;
    private final Set<FilteredConnectPoint> filteredEgressPoints;
    private final TrafficTreatment treatment;
    private final List<Constraint> constraints;

    /**
     * @param appId                 application identifier
     * @param key                   explicit key to use for intent
     * @param resources             required network resources (optional)
     * @param priority              intent priority
     * @param filteredIngressPoints filtered ingress points
     * @param filteredEgressPoints  filtered egress points
     * @param treatment             action to be applied at the egress
     * @param constraints           constraints of the intent
     * @throws NullPointerException if {@code filteredIngressPoints} or
     *                              {@code filteredEgressPoints} or {@code appId}
     *                              or {@code constraints} is null.
     * @throws IllegalArgumentException if {@code filteredIngressPoints} or {@code filteredEgressPoints} is empty.
     */
    public DomainIntent(ApplicationId appId, Key key,
                        Collection<NetworkResource> resources,
                        int priority,
                        Set<FilteredConnectPoint> filteredIngressPoints,
                        Set<FilteredConnectPoint> filteredEgressPoints,
                        TrafficTreatment treatment,
                        List<Constraint> constraints) {
        super(appId, key, resources, priority);

        checkNotNull(filteredIngressPoints, "Ingress points cannot be null");
        checkArgument(!filteredIngressPoints.isEmpty(), "Ingress point cannot be empty");
        checkNotNull(filteredEgressPoints, "Egress points cannot be null");
        checkArgument(!filteredEgressPoints.isEmpty(), "Egress point cannot be empty");
        this.filteredIngressPoints = filteredIngressPoints;
        this.filteredEgressPoints = filteredEgressPoints;
        this.treatment = treatment;
        this.constraints = checkNotNull(constraints, "Constraints cannot be null");
    }

    /**
     * Constructor for serializer.
     */
    protected DomainIntent() {
        super();
        filteredIngressPoints = null;
        filteredEgressPoints = null;
        treatment = null;
        constraints = null;
    }

    /**
     * Abstract builder for connectivity intents.
     */
    public abstract static class Builder extends Intent.Builder {
        protected List<Constraint> constraints = ImmutableList.of();
        protected TrafficTreatment treatment;

        /**
         * Creates a new empty builder.
         */
        protected Builder() {
        }

        @Override
        public Builder appId(ApplicationId appId) {
            return (Builder) super.appId(appId);
        }

        @Override
        public Builder key(Key key) {
            return (Builder) super.key(key);
        }

        @Override
        public Builder priority(int priority) {
            return (Builder) super.priority(priority);
        }

        /**
         * Sets the traffic treatment for the intent that will be built.
         *
         * @param treatment treatment to use for built intent
         * @return this builder
         */
        public Builder treatment(TrafficTreatment treatment) {
            this.treatment = treatment;
            return this;
        }

        /**
         * Sets the constraints for the intent that will be built.
         *
         * @param constraints constraints to use for built intent
         * @return this builder
         */
        public Builder constraints(List<Constraint> constraints) {
            this.constraints = ImmutableList.copyOf(constraints);
            return this;
        }
    }

    @Override
    public boolean isInstallable() {
        return true;
    }

    /**
     * Returns the filtered connected points on which the ingress traffic
     * should be connected to the egress.
     *
     * @return filtered ingress connect points
     */
    public Set<FilteredConnectPoint> filteredIngressPoints() {
        return filteredIngressPoints;
    }

    /**
     * Returns the filtered connected points on which the traffic should egress.
     *
     * @return filtered egress connect points
     */
    public Set<FilteredConnectPoint> filteredEgressPoints() {
        return filteredEgressPoints;
    }

    /**
     * Returns the action applied to the traffic at the egress.
     *
     * @return applied action
     */
    public TrafficTreatment treatment() {
        return treatment;
    }

    /**
     * Returns the set of connectivity constraints.
     *
     * @return list of intent constraints
     */
    public List<Constraint> constraints() {
        return constraints;
    }

}


text:
package dev.webfx.demo.mandelbrot.webassembly.teavm;

import org.teavm.interop.Address;
import org.teavm.interop.Export;
import dev.webfx.demo.mandelbrot.math.MandelbrotMath;

/**
 * @author Bruno Salmon
 */
public final class TeaVmMandelbrotWebAssemblyEntryPoints {

    public static void main(String[] args) {} // Not used but required to declare the main class on TeaVM

    private static int[] outputBuffer;

    @Export(name = "initAndComputeLinePixelIterations")
    public static int initAndComputeLinePixelIterations(int cy, int width, int height, int placeIndex, int frameIndex) {
        outputBuffer = MandelbrotMath.createLinePixelResultStorage(width, outputBuffer);
        MandelbrotMath.init(width, height, placeIndex, frameIndex);
        computeLinePixelIterations(cy);
        return Address.ofData(outputBuffer).toInt();
    }

    @Export(name = "computeLinePixelIterations")
    public static void computeLinePixelIterations(int cy) {
        MandelbrotMath.computeLinePixelIterations(cy, outputBuffer);
    }

}


text:
/*
Copyright 2011-2016 Google Inc. All Rights Reserved.

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 com.google.security.zynamics.binnavi.API.reil.mono;

/**
 * \namespace com.google.security.zynamics.binnavi.API.reil.mono \brief Contains classes of the code analysis framework MonoREIL.
 *
 *  The package com.google.security.zynamics.binnavi.API.reil.mono contains classes that can be used to access the static code
 * analysis MonoREIL. Using this framework it is possible to write static REIL-based code analysis
 * algorithms.
 */


text:
package net.minecraft.client.gui.spectator.categories;

import com.google.common.base.MoreObjects;
import java.util.List;
import net.minecraft.client.gui.spectator.SpectatorMenu;
import net.minecraft.client.gui.spectator.SpectatorMenuItem;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public class SpectatorPage {
   public static final int NO_SELECTION = -1;
   private final List<SpectatorMenuItem> items;
   private final int selection;

   public SpectatorPage(List<SpectatorMenuItem> pItems, int pSelection) {
      this.items = pItems;
      this.selection = pSelection;
   }

   public SpectatorMenuItem getItem(int pIndex) {
      return pIndex >= 0 && pIndex < this.items.size() ? MoreObjects.firstNonNull(this.items.get(pIndex), SpectatorMenu.EMPTY_SLOT) : SpectatorMenu.EMPTY_SLOT;
   }

   public int getSelectedSlot() {
      return this.selection;
   }
}


text:
package com.github.chen0040.leetcode.day05.medium;

/**
 * Created by xschen on 31/7/2017.
 *
 * summary:
 * Given a linked list, remove the nth node from the end of list and return its head.
 *
 * link: https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/
 */
public class RemoveNthNodeFromEndOfList {
    public class ListNode {
      int val;
      ListNode next;
      ListNode(int x) { val = x; }
  }

   public class Solution {
      public ListNode removeNthFromEnd(ListNode head, int n) {
         ListNode point = head;
         ListNode point_n = null;
         ListNode prev_n = null;
         int index = 0;
         while(point != null) {
            if(index+1 == n) {
               point_n = head;
            }

            if(point.next == null) {
               break;
            }

            point = point.next;

            prev_n = point_n;
            if(point_n != null) point_n = point_n.next;

            index++;
         }

         if(point_n != null) {
            if(prev_n == null) {
               return point_n.next;
            } else if(prev_n != null) {
               prev_n.next = point_n.next;
            }
         }

         return head;

      }
   }
}


text:
/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * 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.jetbrains.plugins.github;

import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Clock;
import com.intellij.util.text.DateFormatUtil;
import git4idea.GitUtil;
import git4idea.repo.GitRepository;
import git4idea.test.TestDialogHandler;
import org.jetbrains.plugins.github.api.GithubApiUtil;
import org.jetbrains.plugins.github.test.GithubTest;
import org.jetbrains.plugins.github.ui.GithubShareDialog;

import java.io.IOException;
import java.util.Collections;
import java.util.Random;

/**
 * @author Aleksey Pivovarov
 */
public abstract class GithubShareProjectTestBase extends GithubTest {
  protected String PROJECT_NAME;

  @Override
  protected void beforeTest() {
    Random rnd = new Random();
    long time = Clock.getTime();
    PROJECT_NAME =
      "new_project_from_" + getTestName(false) + "_" + DateFormatUtil.formatDate(time).replace('/', '-') + "_" + rnd.nextLong();
    registerHttpAuthService();
  }

  @Override
  protected void afterTest() throws Exception {
    deleteGithubRepo();
  }

  protected void deleteGithubRepo() throws IOException {
    myApiTaskExecutor.execute(myAccount, c -> {
      String username = GithubApiUtil.getCurrentUser(c).getLogin();
      GithubApiUtil.deleteGithubRepository(c, username, PROJECT_NAME);
      return null;
    });
  }

  protected void registerDefaultShareDialogHandler() {
    dialogManager.registerDialogHandler(GithubShareDialog.class, new TestDialogHandler<GithubShareDialog>() {
      @Override
      public int handleDialog(GithubShareDialog dialog) {
        dialog.testSetRepositoryName(PROJECT_NAME);
        return DialogWrapper.OK_EXIT_CODE;
      }
    });
  }

  protected void registerDefaultUntrackedFilesDialogHandler() {
    dialogManager.registerDialogHandler(GithubShareAction.GithubUntrackedFilesDialog.class,
                                        new TestDialogHandler<GithubShareAction.GithubUntrackedFilesDialog>() {
                                          @Override
                                          public int handleDialog(GithubShareAction.GithubUntrackedFilesDialog dialog) {
                                            // actually we should ask user for name/email ourselves (like in CommitDialog)
                                            for (GitRepository repository : GitUtil.getRepositoryManager(myProject).getRepositories()) {
                                              setGitIdentity(repository.getRoot());
                                            }
                                            return DialogWrapper.OK_EXIT_CODE;
                                          }
                                        });
  }

  protected void registerSelectNoneUntrackedFilesDialogHandler() {
    dialogManager.registerDialogHandler(GithubShareAction.GithubUntrackedFilesDialog.class,
                                        new TestDialogHandler<GithubShareAction.GithubUntrackedFilesDialog>() {
                                          @Override
                                          public int handleDialog(GithubShareAction.GithubUntrackedFilesDialog dialog) {
                                            // actually we should ask user for name/email ourselves (like in CommitDialog)
                                            for (GitRepository repository : GitUtil.getRepositoryManager(myProject).getRepositories()) {
                                              setGitIdentity(repository.getRoot());
                                            }
                                            dialog.setSelectedFiles(Collections.emptyList());
                                            return DialogWrapper.OK_EXIT_CODE;
                                          }
                                        });
  }
}


text:
package tictactoe.Scenes;

import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.effect.DropShadow;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.Stop;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import tictactoe.Controllers.SinglePlayerNameController;

public class SinglePlayerNameBase extends StackPane {

    protected final AnchorPane anchorPane;
    protected final Rectangle rectangle;
    protected final ImageView imageView;
    protected final DropShadow dropShadow;
    protected final Button backBtn;
    protected final DropShadow dropShadow0;
    protected final Button confirmBtn;
    protected final DropShadow dropShadow1;
    protected final Label label;
    protected final TextField player1Name;
    private SinglePlayerNameController controller;

    public SinglePlayerNameBase(Stage primaryStage, String difficulty) {

        anchorPane = new AnchorPane();
        rectangle = new Rectangle();
        imageView = new ImageView();
        dropShadow = new DropShadow();
        backBtn = new Button();
        dropShadow0 = new DropShadow();
        confirmBtn = new Button();
        dropShadow1 = new DropShadow();
        label = new Label();
        player1Name = new TextField();

        anchorPane.setId("AnchorPane");
        anchorPane.setPrefHeight(543.0);
        anchorPane.setPrefWidth(648.0);

        rectangle.setArcHeight(5.0);
        rectangle.setArcWidth(5.0);
        rectangle.setHeight(608.0);
        rectangle.setStroke(javafx.scene.paint.Color.BLACK);
        rectangle.setStrokeType(javafx.scene.shape.StrokeType.INSIDE);
        rectangle.setWidth(648.0);
        rectangle.setFill(LinearGradient.valueOf("linear-gradient(from 100% 100% to 0% 0%, rgba(61,131,145,1) 100%, rgba(255,255,255,1) 0%)"));

        imageView.setFitHeight(139.0);
        imageView.setFitWidth(337.0);
        imageView.setLayoutX(255.0);
        imageView.setLayoutY(34.0);
        imageView.setPickOnBounds(true);
        imageView.setPreserveRatio(true);
        imageView.setImage(new Image(getClass().getResource("Logo.png").toExternalForm()));

        dropShadow.setColor(javafx.scene.paint.Color.valueOf("#00000094"));
        imageView.setEffect(dropShadow);

        backBtn.setLayoutX(101.0);
        backBtn.setLayoutY(422.0);
        backBtn.setMnemonicParsing(false);
        backBtn.setPrefHeight(45.0);
        backBtn.setPrefWidth(154.0);
        backBtn.setText("Back");
        backBtn.setFont(new Font(20.0));

        dropShadow0.setColor(javafx.scene.paint.Color.valueOf("#857e7e96"));
        dropShadow0.setOffsetX(5.0);
        dropShadow0.setOffsetY(5.0);
        dropShadow0.setSpread(0.02);
        backBtn.setEffect(dropShadow0);
        backBtn.setCursor(Cursor.HAND);
        backBtn.setCancelButton(true);

        confirmBtn.setLayoutX(394.0);
        confirmBtn.setLayoutY(422.0);
        confirmBtn.setMnemonicParsing(false);
        confirmBtn.setPrefHeight(45.0);
        confirmBtn.setPrefWidth(154.0);
        confirmBtn.setText("Confirm");
        confirmBtn.setFont(new Font(20.0));

        dropShadow1.setColor(javafx.scene.paint.Color.valueOf("#857e7e96"));
        dropShadow1.setOffsetX(5.0);
        dropShadow1.setOffsetY(5.0);
        dropShadow1.setSpread(0.02);
        confirmBtn.setEffect(dropShadow1);
        confirmBtn.setCursor(Cursor.HAND);
        confirmBtn.setDefaultButton(true);

        label.setLayoutX(255.0);
        label.setLayoutY(277.0);
        label.setPrefHeight(35.0);
        label.setPrefWidth(113.0);
        label.setText("Username");
        label.setTextAlignment(javafx.scene.text.TextAlignment.CENTER);
        label.setTextOverrun(javafx.scene.control.OverrunStyle.WORD_ELLIPSIS);
        label.setFont(new Font("Arial", 24.0));

        player1Name.setLayoutX(163.0);
        player1Name.setLayoutY(329.0);
        player1Name.setPrefHeight(31.0);
        player1Name.setPrefWidth(323.0);
        player1Name.setPromptText("Please enter your username");

        anchorPane.getChildren().add(rectangle);
        anchorPane.getChildren().add(player1Name);
        anchorPane.getChildren().add(imageView);
        anchorPane.getChildren().add(backBtn);
        anchorPane.getChildren().add(confirmBtn);
        anchorPane.getChildren().add(label);

        getChildren().add(anchorPane);
        controller = new SinglePlayerNameController(
                primaryStage,
                backBtn,
                confirmBtn,
                player1Name, difficulty);

    }

}


text:
package rest;

import java.util.List;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import tm.RotondAndesException;
import tm.RotondAndesTM;
import vos.Zona;

@Path(URLS.ZONA)
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class ZonaServices extends BaseServices implements URLS{

	@GET
	public Response getAll() {
		RotondAndesTM tm = new RotondAndesTM(getPath());
		List<Zona> zona;
		try {
			zona = tm.getAllZonas();
		} catch (RotondAndesException ex) {
			return Response.status(404).entity(doErrorMessage(ex)).build();
		} catch (Exception e) {
			return Response.status(500).entity(doErrorMessage(e)).build();
		}
		return Response.status(200).entity(zona).build();
	}

	@GET
	@Path("{" + ZONAID + "}")
	public Response get(@PathParam(ZONAID) Long id) {
		RotondAndesTM tm = new RotondAndesTM(getPath());
		try {
			Zona v = tm.getZona(id);
			return Response.status(200).entity(v).build();
		} catch (RotondAndesException ex) {
			return Response.status(404).entity(doErrorMessage(ex)).build();
		} catch (Exception e) {
			return Response.status(500).entity(doErrorMessage(e)).build();
		}
	}
}


text:
/**
 * Copyright 2005-2013 The Kuali Foundation
 *
 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 *
 * 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.kuali.rice.kew.actions;

import org.junit.Test;
import org.kuali.rice.kew.actionitem.ActionItem;
import org.kuali.rice.kew.actionlist.service.ActionListService;
import org.kuali.rice.kew.api.WorkflowDocument;
import org.kuali.rice.kew.api.WorkflowDocumentFactory;
import org.kuali.rice.kew.service.KEWServiceLocator;
import org.kuali.rice.kew.test.KEWTestCase;
import org.kuali.rice.kim.api.KimConstants;

import java.util.Collection;
import java.util.Iterator;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class ReleaseWorkgroupAuthorityTest extends KEWTestCase {

    protected void loadTestData() throws Exception {
        loadXmlFile("ActionsConfig.xml");
    }

    @Test public void testReleaseWorkgroupAuthority() throws Exception {
        WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), TakeWorkgroupAuthorityTest.DOC_TYPE);
        doc.route("");

        String groupId = getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "TestWorkgroup");
        //have member rkirkend take authority
        doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
        doc.takeGroupAuthority("", groupId);

        // verify there is only one action item and that it's to rkirkend
        ActionListService aiService = KEWServiceLocator.getActionListService();
        Collection<ActionItem> actionItems = aiService.findByDocumentId(doc.getDocumentId());
        assertEquals("There should be only one action item", 1, actionItems.size());
        ActionItem ai = (ActionItem)actionItems.iterator().next();
        assertEquals("action item should be to rkirkend", getPrincipalIdForName("rkirkend"), ai.getPrincipalId());
        assertEquals("action item should be to group", groupId, ai.getGroupId());

        //have rkirkend release authority
        doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());

        doc.releaseGroupAuthority("", groupId);

        //verify that all members have the action item
        actionItems = aiService.findByDocumentId(doc.getDocumentId());
        assertTrue("There should be more than one action item", actionItems.size() > 1);
        for (Iterator<ActionItem> iter = actionItems.iterator(); iter.hasNext();) {
            ActionItem actionItem = iter.next();
            assertTrue("Action Item not to workgroup member", TakeWorkgroupAuthorityTest.WORKGROUP_MEMBERS.contains(getPrincipalNameForId(actionItem.getPrincipalId())));
        }
    }
}


text:
// Chris Collander, Costco 1173, 4/20/2015
package zerosales;

import java.io.File;
import java.util.ArrayList;
import java.util.Optional;
import java.util.Random;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceDialog;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextInputDialog;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;

/**
 *
 * @author Chris Collander
 */
public class ZeroSales extends Application {

    private static Stage primaryStage;

    private static ArrayList<Integer> zeroSalesList;
    private static ArrayList<Integer> inventoryList;

    @Override
    public void start(Stage primaryStage) {
        this.primaryStage = primaryStage;
        zeroSalesList = new ArrayList<>();
        inventoryList = new ArrayList<>();

        // Prepare Menus
        final Menu menu1 = new Menu("File");
        MenuItem menu11 = new MenuItem("Open Zero Sales");
        MenuItem menu12 = new MenuItem("Open Inventory");
        MenuItem menu13 = new MenuItem("View Report");
        MenuItem menu14 = new MenuItem("Exit");
        menu1.getItems().addAll(menu11, menu12, menu13, menu14);
        // About Menu
        Label aboutLabel = new Label("About");
        // MouseHandler for About button
        aboutLabel.setOnMouseClicked(e -> {
            aboutDialog();
        });
        Menu menu2 = new Menu();
        menu2.setGraphic(aboutLabel);
        /// MenuBar
        MenuBar menubar = new MenuBar();
        menubar.getMenus().addAll(menu1, menu2);
        // MenuItem Listener
        EventHandler<ActionEvent> menuAction = menuItemSelected();
        menu11.setOnAction(menuAction);
        menu12.setOnAction(menuAction);
        menu13.setOnAction(menuAction);
        menu14.setOnAction(menuAction);

        // MainView
        TextArea mainView = new TextArea();
        String text = new String();
        text += "INSTRUCTIONS\n";
        text += "\tType ZeroSales into a text file, with a different item number on every line\n";
        text += "\tType 35 Inventory into a text file, with a different item number on every line\n";
        text += "\tClick 'View Report' to see what numbers on the Zero Sales are not on the Inventory";
        mainView.setText(text);

        // ButtonList
        GridPane buttonList = new GridPane();
        Button zeroSalesButton = new Button("Load Zero Sales");
        zeroSalesButton.setOnMouseClicked(e -> {
            zeroSalesList = FileHandler.loadZeroSales(primaryStage);
        });
        Button inventoryButton = new Button("Load Inventory");
        inventoryButton.setOnMouseClicked(e -> {
            inventoryList = FileHandler.loadInventory(primaryStage);
        });
        Button reportButton = new Button("View Report");
        reportButton.setOnMouseClicked(e -> {
            if (!zeroSalesList.isEmpty() && !inventoryList.isEmpty()) {
                viewReport();
            } else {
                loadReportError();
            }
        });
        buttonList.add(zeroSalesButton, 0, 0);
        buttonList.add(inventoryButton, 1, 0);
        buttonList.add(reportButton, 2, 0);

        // Create Scene/Stage
        BorderPane root = new BorderPane();
        root.setTop(menubar);
        root.setCenter(mainView);
        root.setBottom(buttonList);
        Scene scene = new Scene(root, 500, 150);
        primaryStage.setTitle("Zero Sales 35 Cross Referencer");
        primaryStage.setScene(scene);
        primaryStage.setResizable(false);
        primaryStage.show();
    }

    public static void aboutDialog() {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("About ZeroSales");
        alert.setHeaderText(null);
        alert.setContentText("Chris Collander\n4/20/2014\nCreated for Costco 1173 for Zero Sales cross referencing");
        alert.showAndWait();
    }

    public static void loadReportError() {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle("Error Loading Report");
        alert.setHeaderText(null);
        alert.setContentText("Please load ZeroSales and Inventory files. If loaded, review included numbers");
        alert.showAndWait();
    }

    public static void viewReport() {
        String results = new String();

        for (Integer i : zeroSalesList) {
            boolean found = false;
            for (Integer j : inventoryList) {
                if (i.equals(j)) {
                    found = true;
                }
            }
            if (!found) {
                results += i.toString() + "\n";
            }
        }

        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setTitle("Zero Sales Results");
        alert.setHeaderText(null);
        if (results.length() < 3) {
            results = "No items from the Zero Sales were missing from Inventory";
        }
        alert.setContentText(results);
        alert.showAndWait();
    }

    private EventHandler<ActionEvent> menuItemSelected() {
        return (ActionEvent event) -> {
            MenuItem mItem = (MenuItem) event.getSource();
            String text = mItem.getText();

            // File Menu
            // Open MenuItem
            if ("Open Zero Sales".equalsIgnoreCase(text)) {
                FileHandler.loadZeroSales(primaryStage);
            }
            if ("Open Inventory".equalsIgnoreCase(text)) {
                FileHandler.loadInventory(primaryStage);
            }
            if ("View Report".equalsIgnoreCase(text)) {
                if (!zeroSalesList.isEmpty() && !inventoryList.isEmpty()) {
                    viewReport();
                } else {
                    loadReportError();
                }
            }
            if ("Exit".equalsIgnoreCase(text)) {
                System.exit(0);
            }
        };
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}