text:
package com.intellij.openapi.vcs;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.command.CommandAdapter;
import com.intellij.openapi.command.CommandEvent;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.util.*;

/**
 * @author yole
 */
public abstract class VcsVFSListener implements Disposable {
  protected static final Logger LOG = Logger.getInstance(VcsVFSListener.class);

  private final VcsDirtyScopeManager myDirtyScopeManager;
  private final ProjectLevelVcsManager myVcsManager;
  private final VcsFileListenerContextHelper myVcsFileListenerContextHelper;

  protected static class MovedFileInfo {
    public final String myOldPath;
    public String myNewPath;
    private final VirtualFile myFile;

    protected MovedFileInfo(VirtualFile file, final String newPath) {
      myOldPath = file.getPath();
      myNewPath = newPath;
      myFile = file;
    }

    @Override
    public String toString() {
      return "MovedFileInfo{myNewPath=" + myNewPath + ", myFile=" + myFile + '}';
    }
  }

  protected final Project myProject;
  protected final AbstractVcs myVcs;
  protected final ChangeListManager myChangeListManager;
  protected final VcsShowConfirmationOption myAddOption;
  protected final VcsShowConfirmationOption myRemoveOption;
  protected final List<VirtualFile> myAddedFiles = new ArrayList<>();
  protected final Map<VirtualFile, VirtualFile> myCopyFromMap = new HashMap<>();
  protected final List<VcsException> myExceptions = new SmartList<>();
  protected final List<FilePath> myDeletedFiles = new ArrayList<>();
  protected final List<FilePath> myDeletedWithoutConfirmFiles = new ArrayList<>();
  protected final List<MovedFileInfo> myMovedFiles = new ArrayList<>();
  protected final LinkedHashSet<VirtualFile> myDirtyFiles = ContainerUtil.newLinkedHashSet();

  protected enum VcsDeleteType {SILENT, CONFIRM, IGNORE}

  protected VcsVFSListener(@NotNull Project project, @NotNull AbstractVcs vcs) {
    myProject = project;
    myVcs = vcs;
    myChangeListManager = ChangeListManager.getInstance(project);
    myDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);

    final MyVirtualFileAdapter myVFSListener = new MyVirtualFileAdapter();
    final MyCommandAdapter myCommandListener = new MyCommandAdapter();

    myVcsManager = ProjectLevelVcsManager.getInstance(project);
    myAddOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, vcs);
    myRemoveOption = myVcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.REMOVE, vcs);

    VirtualFileManager.getInstance().addVirtualFileListener(myVFSListener, this);
    CommandProcessor.getInstance().addCommandListener(myCommandListener, this);
    myVcsFileListenerContextHelper = VcsFileListenerContextHelper.getInstance(myProject);
  }

  @Override
  public void dispose() {
  }

  protected boolean isEventIgnored(final VirtualFileEvent event, boolean putInDirty) {
    if (event.isFromRefresh()) return true;
    boolean vcsIgnored = !isUnderMyVcs(event.getFile());
    if (vcsIgnored) {
      myDirtyFiles.add(event.getFile());
    }
    return vcsIgnored;
  }

  private boolean isUnderMyVcs(VirtualFile file) {
    return myVcsManager.getVcsFor(file) == myVcs &&
           myVcsManager.isFileInContent(file) &&
           !myChangeListManager.isIgnoredFile(file);
  }

  protected void executeAdd() {
    final List<VirtualFile> addedFiles = acquireAddedFiles();
    LOG.debug("executeAdd. addedFiles: " + addedFiles);
    for (Iterator<VirtualFile> iterator = addedFiles.iterator(); iterator.hasNext(); ) {
      VirtualFile file = iterator.next();
      if (myVcsFileListenerContextHelper.isAdditionIgnored(file)) {
        iterator.remove();
      }
    }
    final Map<VirtualFile, VirtualFile> copyFromMap = acquireCopiedFiles();
    if (! addedFiles.isEmpty()) {
      executeAdd(addedFiles, copyFromMap);
    }
  }

  /**
   * @return get map of copied files and clear the map
   */
  protected Map<VirtualFile, VirtualFile> acquireCopiedFiles() {
    final Map<VirtualFile, VirtualFile> copyFromMap = new HashMap<>(myCopyFromMap);
    myCopyFromMap.clear();
    return copyFromMap;
  }

  /**
   * @return get list of added files and clear previous list
   */
  protected List<VirtualFile> acquireAddedFiles() {
    final List<VirtualFile> addedFiles = new ArrayList<>(myAddedFiles);
    myAddedFiles.clear();
    return addedFiles;
  }

  /**
   * Execute add that performs adding from specific collections
   *
   * @param addedFiles  the added files
   * @param copyFromMap the copied files
   */
  protected void executeAdd(List<VirtualFile> addedFiles, Map<VirtualFile, VirtualFile> copyFromMap) {
    LOG.debug("executeAdd. add-option: " + myAddOption.getValue() + ", files to add: " + addedFiles);
    if (myAddOption.getValue() == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) return;
    if (myAddOption.getValue() == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) {
      performAdding(addedFiles, copyFromMap);
    }
    else {
      final AbstractVcsHelper helper = AbstractVcsHelper.getInstance(myProject);
      // TODO[yole]: nice and clean description label
      Collection<VirtualFile> filesToProcess = helper.selectFilesToProcess(addedFiles, getAddTitle(), null,
                                                                           getSingleFileAddTitle(), getSingleFileAddPromptTemplate(),
                                                                           myAddOption);
      if (filesToProcess != null) {
        performAdding(new ArrayList<>(filesToProcess), copyFromMap);
      }
    }
  }

  private void addFileToDelete(VirtualFile file) {
    if (file.isDirectory() && file instanceof NewVirtualFile && !isDirectoryVersioningSupported()) {
      for (VirtualFile child : ((NewVirtualFile)file).getCachedChildren()) {
        addFileToDelete(child);
      }
    }
    else {
      final VcsDeleteType type = needConfirmDeletion(file);
      final FilePath filePath =
        VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(new File(file.getPath()), file.isDirectory());
      if (type == VcsDeleteType.CONFIRM) {
        myDeletedFiles.add(filePath);
      }
      else if (type == VcsDeleteType.SILENT) {
        myDeletedWithoutConfirmFiles.add(filePath);
      }
    }
  }

  protected void executeDelete() {
    final List<FilePath> filesToDelete = new ArrayList<>(myDeletedWithoutConfirmFiles);
    final List<FilePath> deletedFiles = new ArrayList<>(myDeletedFiles);
    myDeletedWithoutConfirmFiles.clear();
    myDeletedFiles.clear();

    for (Iterator<FilePath> iterator = filesToDelete.iterator(); iterator.hasNext(); ) {
      FilePath file = iterator.next();
      if (myVcsFileListenerContextHelper.isDeletionIgnored(file)) {
        iterator.remove();
      }
    }
    for (Iterator<FilePath> iterator = deletedFiles.iterator(); iterator.hasNext(); ) {
      FilePath file = iterator.next();
      if (myVcsFileListenerContextHelper.isDeletionIgnored(file)) {
        iterator.remove();
      }
    }

    if (deletedFiles.isEmpty() &&filesToDelete.isEmpty()) return;

    if (myRemoveOption.getValue() != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) {
      if (myRemoveOption.getValue() == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY || deletedFiles.isEmpty()) {
        filesToDelete.addAll(deletedFiles);
      }
      else {
        Collection<FilePath> filePaths = selectFilePathsToDelete(deletedFiles);
        if (filePaths != null) {
          filesToDelete.addAll(filePaths);
        }
      }
    }
    performDeletion(filesToDelete);
  }

  /**
   * Select file paths to delete
   *
   * @param deletedFiles deleted files set
   * @return selected files or null (that is considered as empty file set)
   */
  @Nullable
  protected Collection<FilePath> selectFilePathsToDelete(final List<FilePath> deletedFiles) {
    AbstractVcsHelper helper = AbstractVcsHelper.getInstance(myProject);
    return helper.selectFilePathsToProcess(deletedFiles, getDeleteTitle(), null, getSingleFileDeleteTitle(),
                                           getSingleFileDeletePromptTemplate(), myRemoveOption);
  }

  protected void beforeContentsChange(VirtualFileEvent event, VirtualFile file) {
  }

  protected void fileAdded(VirtualFileEvent event, VirtualFile file) {
    if (!isEventIgnored(event, true) && !myChangeListManager.isIgnoredFile(file) &&
        (isDirectoryVersioningSupported() || !file.isDirectory())) {
      LOG.debug("Adding [" + file.getPresentableUrl() + "] to added files");
      myAddedFiles.add(event.getFile());
    }
  }

  private void addFileToMove(final VirtualFile file, final String newParentPath, final String newName) {
    if (file.isDirectory() && !file.is(VFileProperty.SYMLINK) && !isDirectoryVersioningSupported()) {
      @SuppressWarnings("UnsafeVfsRecursion") VirtualFile[] children = file.getChildren();
      if (children != null) {
        for (VirtualFile child : children) {
          addFileToMove(child, newParentPath + "/" + newName, child.getName());
        }
      }
    }
    else {
      processMovedFile(file, newParentPath, newName);
    }
  }

  protected boolean filterOutUnknownFiles() {
    return true;
  }

  protected void processMovedFile(VirtualFile file, String newParentPath, String newName) {
    final FileStatus status = FileStatusManager.getInstance(myProject).getStatus(file);
    LOG.debug("Checking moved file " + file + "; status=" + status);
    if (status == FileStatus.IGNORED) {
      if (file.getParent() != null) {
        myDirtyFiles.add(file.getParent());
        myDirtyFiles.add(file); // will be at new path
      }
    }

    final String newPath = newParentPath + "/" + newName;
    MovedFileInfo existingMovedFile = ContainerUtil.find(myMovedFiles, (info) -> Comparing.equal(info.myFile, file));
    if (existingMovedFile != null) {
      LOG.debug("Reusing existing moved file " + file);
      existingMovedFile.myNewPath = newPath;
    }
    else {
      LOG.debug("Registered moved file " + file);
      myMovedFiles.add(new MovedFileInfo(file, newPath));
    }
  }

  private void executeMoveRename() {
    final List<MovedFileInfo> movedFiles = new ArrayList<>(myMovedFiles);
    LOG.debug("executeMoveRename " + movedFiles);
    myMovedFiles.clear();
    performMoveRename(ContainerUtil.filter(movedFiles, info -> {
      FileStatus status = FileStatusManager.getInstance(myProject).getStatus(info.myFile);
      return !(status == FileStatus.UNKNOWN && filterOutUnknownFiles()) && status != FileStatus.IGNORED;
    }));
  }

  protected VcsDeleteType needConfirmDeletion(final VirtualFile file) {
    return VcsDeleteType.CONFIRM;
  }

  protected abstract String getAddTitle();

  protected abstract String getSingleFileAddTitle();

  protected abstract String getSingleFileAddPromptTemplate();

  protected abstract void performAdding(final Collection<VirtualFile> addedFiles, final Map<VirtualFile, VirtualFile> copyFromMap)
    ;

  protected abstract String getDeleteTitle();

  protected abstract String getSingleFileDeleteTitle();

  protected abstract String getSingleFileDeletePromptTemplate();

  protected abstract void performDeletion(List<FilePath> filesToDelete);

  protected abstract void performMoveRename(List<MovedFileInfo> movedFiles);

  protected abstract boolean isDirectoryVersioningSupported();

  private class MyVirtualFileAdapter extends VirtualFileAdapter {
    @Override
    public void fileCreated(@NotNull final VirtualFileEvent event) {
      VirtualFile file = event.getFile();
      LOG.debug("fileCreated: " + file.getPresentableUrl());
      if (isUnderMyVcs(file)) {
        fileAdded(event, file);
      }
    }

    @Override
    public void fileCopied(@NotNull final VirtualFileCopyEvent event) {
      if (isEventIgnored(event, true) || myChangeListManager.isIgnoredFile(event.getFile())) return;
      final AbstractVcs oldVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getOriginalFile());
      if (oldVcs == myVcs) {
        final VirtualFile parent = event.getFile().getParent();
        if (parent != null) {
          myAddedFiles.add(event.getFile());
          myCopyFromMap.put(event.getFile(), event.getOriginalFile());
        }
      }
      else {
        myAddedFiles.add(event.getFile());
      }
    }

    @Override
    public void beforeFileDeletion(@NotNull final VirtualFileEvent event) {
      final VirtualFile file = event.getFile();
      if (isEventIgnored(event, true)) {
        return;
      }
      if (!myChangeListManager.isIgnoredFile(file)) {
        addFileToDelete(file);
        return;
      }
      // files are ignored, directories are handled recursively
      if (event.getFile().isDirectory()) {
        final List<VirtualFile> list = new LinkedList<>();
        VcsUtil.collectFiles(file, list, true, isDirectoryVersioningSupported());
        for (VirtualFile child : list) {
          if (!myChangeListManager.isIgnoredFile(child)) {
            addFileToDelete(child);
          }
        }
      }
    }

    @Override
    public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) {
      if (isEventIgnored(event, true)) return;
      final VirtualFile file = event.getFile();
      final AbstractVcs newVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getNewParent());
      LOG.debug("beforeFileMovement " + event + " into " + newVcs);
      if (newVcs == myVcs) {
        addFileToMove(file, event.getNewParent().getPath(), file.getName());
      }
      else {
        addFileToDelete(event.getFile());
      }
    }

    @Override
    public void fileMoved(@NotNull final VirtualFileMoveEvent event) {
      if (isEventIgnored(event, true)) return;
      final AbstractVcs oldVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getOldParent());
      if (oldVcs != myVcs) {
        myAddedFiles.add(event.getFile());
      }
    }

    @Override
    public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) {
      if (!isEventIgnored(event, false) && event.getPropertyName().equalsIgnoreCase(VirtualFile.PROP_NAME)) {
        LOG.debug("before file rename " + event);
        String oldName = (String)event.getOldValue();
        String newName = (String)event.getNewValue();
        // in order to force a reparse of a file, the rename event can be fired with old name equal to new name -
        // such events needn't be handled by the VCS
        if (!Comparing.equal(oldName, newName)) {
          final VirtualFile file = event.getFile();
          final VirtualFile parent = file.getParent();
          if (parent != null) {
            addFileToMove(file, parent.getPath(), newName);
          }
        }
      }
    }

    @Override
    public void beforeContentsChange(@NotNull VirtualFileEvent event) {
      VirtualFile file = event.getFile();
      assert !file.isDirectory();
      if (isUnderMyVcs(file)) {
        VcsVFSListener.this.beforeContentsChange(event, file);
      }
    }
  }

  private class MyCommandAdapter extends CommandAdapter {
    private int myCommandLevel;

    @Override
    public void commandStarted(final CommandEvent event) {
      if (myProject != event.getProject()) return;
      myCommandLevel++;
    }

    private void checkMovedAddedSourceBack() {
      if (myAddedFiles.isEmpty() || myMovedFiles.isEmpty()) return;

      final Map<String, VirtualFile> addedPaths = new HashMap<>(myAddedFiles.size());
      for (VirtualFile file : myAddedFiles) {
        addedPaths.put(file.getPath(), file);
      }

      for (Iterator<MovedFileInfo> iterator = myMovedFiles.iterator(); iterator.hasNext();) {
        final MovedFileInfo movedFile = iterator.next();
        if (addedPaths.containsKey(movedFile.myOldPath)) {
          iterator.remove();
          final VirtualFile oldAdded = addedPaths.get(movedFile.myOldPath);
          myAddedFiles.remove(oldAdded);
          myAddedFiles.add(movedFile.myFile);
          myCopyFromMap.put(oldAdded, movedFile.myFile);
        }
      }
    }

    // If a file is scheduled for deletion, and at the same time for copying or addition, don't delete it.
    // It happens during Overwrite command or undo of overwrite.
    private void doNotDeleteAddedCopiedOrMovedFiles() {
      Collection<String> copiedAddedMoved = new ArrayList<>();
      for (VirtualFile file : myCopyFromMap.keySet()) {
        copiedAddedMoved.add(file.getPath());
      }
      for (VirtualFile file : myAddedFiles) {
        copiedAddedMoved.add(file.getPath());
      }
      for (MovedFileInfo movedFileInfo : myMovedFiles) {
        copiedAddedMoved.add(movedFileInfo.myNewPath);
      }

      for (Iterator<FilePath> iterator = myDeletedFiles.iterator(); iterator.hasNext(); ) {
        if (copiedAddedMoved.contains(FileUtil.toSystemIndependentName(iterator.next().getPath()))) {
          iterator.remove();
        }
      }
      for (Iterator<FilePath> iterator = myDeletedWithoutConfirmFiles.iterator(); iterator.hasNext(); ) {
        if (copiedAddedMoved.contains(FileUtil.toSystemIndependentName(iterator.next().getPath()))) {
          iterator.remove();
        }
      }
    }

    @Override
    public void commandFinished(final CommandEvent event) {
      if (myProject != event.getProject()) return;
      myCommandLevel--;
      if (myCommandLevel == 0) {
        if (!myAddedFiles.isEmpty() || !myDeletedFiles.isEmpty() || !myDeletedWithoutConfirmFiles.isEmpty() || !myMovedFiles.isEmpty() ||
            ! myDirtyFiles.isEmpty()) {
          doNotDeleteAddedCopiedOrMovedFiles();
          checkMovedAddedSourceBack();
          if (!myAddedFiles.isEmpty()) {
            executeAdd();
            myAddedFiles.clear();
          }
          if (!myDeletedFiles.isEmpty() || !myDeletedWithoutConfirmFiles.isEmpty()) {
            executeDelete();
            myDeletedFiles.clear();
            myDeletedWithoutConfirmFiles.clear();
          }
          if (!myMovedFiles.isEmpty()) {
            executeMoveRename();
            myMovedFiles.clear();
          }
          if (! myDirtyFiles.isEmpty()) {
            final List<VirtualFile> files = new ArrayList<>();
            final List<VirtualFile> dirs = new ArrayList<>();
            for (VirtualFile dirtyFile : myDirtyFiles) {
              if (dirtyFile != null) {
                if (dirtyFile.isDirectory()) {
                  dirs.add(dirtyFile);
                } else {
                  files.add(dirtyFile);
                }
              }
            }
            myDirtyScopeManager.filesDirty(files, dirs);
            myDirtyFiles.clear();
          }
          if (! myExceptions.isEmpty()) {
            AbstractVcsHelper.getInstance(myProject).showErrors(myExceptions, myVcs.getDisplayName() + " operations errors");
          }
        }
      }
    }

  }
}


text:
package fi.nls.oskari.wms;

import fi.mml.map.mapwindow.service.wms.WebMapService;
import fi.nls.oskari.domain.map.OskariLayer;
import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;
import fi.nls.oskari.service.ServiceException;
import fi.nls.oskari.service.capabilities.CapabilitiesCacheService;
import fi.nls.oskari.service.capabilities.OskariLayerCapabilities;
import fi.nls.oskari.service.capabilities.OskariLayerCapabilitiesHelper;

import fi.nls.oskari.util.PropertyUtil;
import org.geotools.ows.wms.Layer;
import org.geotools.ows.wms.WMSCapabilities;
import org.geotools.ows.wms.xml.WMSSchema;
import org.geotools.xml.DocumentFactory;
import org.geotools.xml.handlers.DocumentHandler;
import org.oskari.maplayer.admin.LayerAdminJSONHelper;
import org.oskari.maplayer.model.MapLayerStructure;
import org.oskari.maplayer.model.ServiceCapabilitiesResultWMS;
import org.oskari.service.util.ServiceFactory;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class WMSCapabilitiesService {
    private static final Logger log = LogFactory.getLogger(WMSCapabilitiesService.class);
    private CapabilitiesCacheService capabilitiesService = ServiceFactory.getCapabilitiesCacheService();

    @Deprecated
    public WebMapService updateCapabilities (OskariLayer ml) throws ServiceException {
        String data =  CapabilitiesCacheService.getFromService(ml);
        WebMapService wms;
        try {
            wms = OskariLayerCapabilitiesHelper.parseWMSCapabilities(data, ml);
        } catch (Exception e) {
            throw new ServiceException("Failed to parse WMS capabilities xml", e);
        }
        return wms;
    }

    public void updateLayerCapabilities (OskariLayer ml, final Set<String> systemCRSs) throws ServiceException {
        String data =  CapabilitiesCacheService.getFromService(ml);
        WMSCapabilities caps = createCapabilities(data);
        Layer layer = findLayer(caps, ml.getName())
                .orElseThrow(()-> new ServiceException("Can't find layer from capabilities xml for update: " + ml.getId()));
        OskariLayerCapabilitiesHelper.setPropertiesFromCapabilitiesWMS(caps, layer, ml, systemCRSs);
        //update after parsing to cache valid xml
        capabilitiesService.save(ml, data);
    }
    public void updateLayerCapabilities (WMSCapabilities caps, OskariLayer ml, final Set<String> systemCRSs) throws ServiceException {
        Layer layer = findLayer(caps, ml.getName())
                .orElseThrow(()-> new ServiceException("Can't find layer from capabilities xml for update: " + ml.getId()));
        OskariLayerCapabilitiesHelper.setPropertiesFromCapabilitiesWMS(caps, layer, ml, systemCRSs);
    }

    public ServiceCapabilitiesResultWMS getCapabilitiesResults (final String url, final String version, final String user, final String pwd,
                                                                final Set<String> systemCRSs) throws ServiceException {
        try {
            OskariLayerCapabilities capabilities = capabilitiesService.getCapabilities(url, OskariLayer.TYPE_WMS, version, user, pwd);
            // if capabilities is more than 5 minutes old, get it from the service directly
            if (capabilities.isOlderThan(TimeUnit.MINUTES.toMillis(5))) {
                capabilities = capabilitiesService.getCapabilitiesFromService(url, OskariLayer.TYPE_WMS, version, user, pwd);
            }
            final String xml = capabilities.getData();
            ServiceCapabilitiesResultWMS results = parseCapabilitiesResults(xml, url, version, user, pwd, systemCRSs);
            if (capabilities.getId() == null) {
                capabilitiesService.save(capabilities);
            }
            return results;
        } catch (Exception ex) {
            throw new ServiceException("Couldn't read/get wms capabilities response from url: " + url, ex);
        }
    }

    protected static ServiceCapabilitiesResultWMS parseCapabilitiesResults(String xml, String url, String version,
            String user, String pwd, Set<String> systemCRSs) {
        WMSCapabilities caps = createCapabilities(xml);

        List<OskariLayer> layers = getActualLayers(caps)
                .map(layer -> layerToOskariLayer(caps, layer, url, version, user, pwd, systemCRSs))
                .collect(Collectors.toList());
        Layer capabilitiesLayer = caps.getLayer();

        ServiceCapabilitiesResultWMS results = new ServiceCapabilitiesResultWMS();
        results.setTitle(capabilitiesLayer.getTitle());
        results.setVersion(caps.getVersion());
        results.setLayers(layers.stream()
                .map(l -> LayerAdminJSONHelper.toJSON(l))
                .collect(Collectors.toList()));

        // capabilitiesResult.setLayersWithErrors((List<String>) capabilities.get(CapabilitiesConstants.KEY_ERROR_LAYERS));
        results.setStructure(parseStructureJson(capabilitiesLayer));

        return results;
    }

    protected static Stream<Layer> getActualLayers(WMSCapabilities caps) {
        return caps.getLayerList()
                .stream()
                .filter(WMSCapabilitiesService::isActualLayer);
    }

    private static boolean isActualLayer (Layer layer) {
        String layerName = layer.getName();
        return layerName != null && !layerName.isEmpty();
    }
    private static Optional<Layer> findLayer (WMSCapabilities caps, String name) {
        return getActualLayers(caps)
                .filter(layer -> name.equals(layer.getName()))
                .findFirst();
    }

    private static List<MapLayerStructure> parseStructureJson (Layer layer) {
        List<MapLayerStructure> layers = new ArrayList<>();
        List<Layer> sublayers = layer.getLayerChildren();
        boolean isLayer = isActualLayer(layer);
        if (sublayers == null || sublayers.isEmpty()) {
            if (!isLayer) {
                // no sublayers AND not an actual layer
                return layers;
            }
            // no sublayers: just return this layer
            MapLayerStructure cap = new MapLayerStructure();
            cap.setName(layer.getName());
            layers.add(cap);
            return layers;
        }
        // has sublayers
        if (!isLayer) {
            // just sublayers: skip the acu
            for (Layer sublayer : sublayers ) {
                layers.addAll(parseStructureJson(sublayer));
            }
            return layers;
        }
        // group layer
        MapLayerStructure cap = new MapLayerStructure();
        cap.setName(layer.getName());
        List<MapLayerStructure> sublayerOutput = new ArrayList<>();
        for (Layer sublayer : sublayers ) {
            sublayerOutput.addAll(parseStructureJson(sublayer));
        }
        cap.setStructure(sublayerOutput);
        layers.add(cap);
        return layers;
    }

    public static OskariLayer layerToOskariLayer(WMSCapabilities caps, Layer capabilitiesLayer, String url, String version, String user, String pw,
                                                 Set<String> systemCRSs) {
        final OskariLayer oskariLayer = new OskariLayer();
        final String layerName = capabilitiesLayer.getName();
        oskariLayer.setType(OskariLayer.TYPE_WMS);
        oskariLayer.setUrl(url);
        // THIS IS ON PURPOSE: min -> max, max -> min
        oskariLayer.setMaxScale(capabilitiesLayer.getScaleDenominatorMin());
        oskariLayer.setMinScale(capabilitiesLayer.getScaleDenominatorMax());
        oskariLayer.setName(layerName);
        oskariLayer.setVersion(version);
        oskariLayer.setUsername(user);
        oskariLayer.setPassword(pw);

        // setup UI names for all supported languages
        final String[] languages = PropertyUtil.getSupportedLanguages();
        String title = capabilitiesLayer.getTitle();
        for (String lang : languages) {
            oskariLayer.setName(lang, title);
        }

        try {
            OskariLayerCapabilitiesHelper.setPropertiesFromCapabilitiesWMS(caps,capabilitiesLayer, oskariLayer, systemCRSs);
        } catch (Exception ex) {
            log.warn ("Couldn't parse capabilities for WMS layer:", layerName, "message:", ex.getMessage());
        }
        OskariLayerCapabilitiesHelper.setDefaultStyleFromCapabilitiesJSON(oskariLayer);
        return oskariLayer;
    }
    public static WMSCapabilities createCapabilities(String xml) {
        if(xml == null || xml.isEmpty()) {
            return null;
        }
        final Map hints = new HashMap();
        hints.put(DocumentHandler.DEFAULT_NAMESPACE_HINT_KEY, WMSSchema.getInstance());
        hints.put(DocumentFactory.VALIDATION_HINT, false);
        try(InputStream stream = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))) {
            final Object object = DocumentFactory.getInstance(stream, hints, Level.WARNING);
            if(object instanceof WMSCapabilities) {
                return (WMSCapabilities) object;
            }
        } catch (Exception ex) {
            log.error(ex, "Error reading WMS capabilities");
        }

        return null;
    }
}

redpajama_set_name: RedPajamaGithub


text:
@interface NewsTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *newsImageView;

@property (weak, nonatomic) IBOutlet UILabel *newsTitleLable;
@property (weak, nonatomic) IBOutlet UILabel *newsSubtitleLable;

@end


text:
//
//  SingletonAdapterBase.h
//  AdViewSDK
//
//  Created by zhiwen on 12-1-13.
//  Copyright 2012 www.adview.cn. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AdViewAdNetworkAdapter.h"

@interface SingletonAdapterBase : NSObject {
	AdViewAdNetworkAdapter __weak	*mAdapter;
	NSMutableArray			*mIdelViewArr;
	NSObject				*mLockObj;
}

@property (nonatomic, weak) AdViewAdNetworkAdapter	*mAdapter;
@property (nonatomic, retain) NSMutableArray			*mIdelViewArr;
@property (nonatomic, retain) NSObject					*mLockObj;

- (void)setAdapterValue:(BOOL)bSetOrClean ByAdapter:(AdViewAdNetworkAdapter*)adapter;

/*
 * For use of analyze of xcode, return one with +0 retain
 */
- (UIView*)getIdelAdView;
- (void)addIdelAdView:(UIView*)view;
- (BOOL)isTestMode;

/*
 * For use of analyze of xcode, return one with +0 retain
 */
- (UIView*)makeAdView;

- (void)updateAdFrame:(UIView*)view;
- (BOOL)isAdViewValid:(UIView*)adView;

@end


text:
package com.appleframework.pay.common.core.entity;

import com.alibaba.fastjson.JSONObject;

/**
 * api请求正常返回结果,该实体作为API请求时,按照规范返回的实体. code 为返回码 msg 为返回描述 data 为返回的具体结果 Created
 * http://www.appleframework.com
 * @author Cruise.Xu
 */
public class ApiCommonResultVo {

	public ApiCommonResultVo(int code, String msg, Object data) {
		this.code = code;
		this.msg = msg;
		if (data != null) {
			this.data = data;
		}
	}

	public ApiCommonResultVo(Object data) {
		this.code = 0;
		this.msg = "";
		if (data != null) {
			this.data = data;
		}
	}

	/**
	 * 返回码
	 */
	private int code;

	/**
	 * 返回描述
	 */
	private String msg = "";

	/**
	 * 返回数据
	 */
	private Object data = new Object();

	public void setCode(int code) {
		this.code = code;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public int getCode() {
		return code;
	}

	public String getMsg() {
		return msg;
	}

	public Object getData() {
		return data;
	}

	public static void main(String[] args) {
		System.out.println(JSONObject.toJSONString(new ApiCommonResultVo(-1, "", null)));
	}
}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { AdminFooterComponent } from '@admin-layout/footer/admin-footer.component';

@NgModule({
  imports: [
    CommonModule
  ],
  declarations: [
    AdminFooterComponent
  ],
  exports: [
    AdminFooterComponent
  ]
})
export class AdminFooterModule { }


text:
<!DOCTYPE html>

    <title>Timer Storm</title>

<button onclick="startTime()">Start Clock</button>

Time:

Tick count:


text:
package org.apache.tinkerpop.gremlin.console.jsr223;

import org.apache.tinkerpop.gremlin.server.GremlinServer;
import org.apache.tinkerpop.gremlin.server.Settings;
import org.junit.After;
import org.junit.Before;

import java.io.InputStream;

/**
 * Starts and stops an instance for each executed test.
 *
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public abstract class AbstractGremlinServerIntegrationTest {
    private GremlinServer server;

    public Settings overrideSettings(final Settings settings) {
        return settings;
    }

    public InputStream getSettingsInputStream() {
        return AbstractGremlinServerIntegrationTest.class.getResourceAsStream("gremlin-server-integration.yaml");
    }

    @Before
    public void setUp() throws Exception {
        final InputStream stream = getSettingsInputStream();
        final Settings settings = Settings.read(stream);

        final Settings overridenSettings = overrideSettings(settings);
        this.server = new GremlinServer(overridenSettings);

        server.start().join();
    }

    @After
    public void tearDown() throws Exception {
        stopServer();
    }

    public void stopServer() throws Exception {
        server.stop().join();
    }
}


text:
;(function(module, undefined) {

  var EventEmitter2, EventVat;

  if(!EventEmitter2 && require) {
    EventEmitter2 = require('eventemitter2').EventEmitter2;
    if(!EventEmitter2) {
      throw new Error('`EventEmitter2` is not defined.');
    }
  }

  //
  // Determine if a key exists within an object
  //
  function has(obj, key) {
    return Object.prototype.hasOwnProperty.call(obj, key);
  }

  EventVat = module.exports = function EventVat(conf) {

    if (!(this instanceof EventVat)) {
      return new EventVat(conf);
    }

    var that = this;
    this.hash = {};
    this.autoexpire = (conf && conf.autoexpire) || 0;

    if (conf && conf.data) {

      Object.keys(conf.data).forEach(function(key) {
        that.hash[key] = { value: conf.data[key] };
      });
    }
  };

  var p = EventVat.prototype;

  for (var member in EventEmitter2.prototype) {
    p[member] = EventEmitter2.prototype[member];
  }

  p.publish     = EventEmitter2.prototype.emit;
  p.subscribe   = EventEmitter2.prototype.on;
  p.unsubscribe = EventEmitter2.prototype.removeListener;

  p.die = function(key) {
    for (var k in this.hash) {
      if (has(this.hash, k)) {
        if (this.hash[k].tid) {
          clearTimeout(this.hash[k].tid);
        }
      }
    }
  };

  // KEYS
  // ----

  //
  // Delete a key
  //
  p.del = function() {
    var n = 0, key;

    for (var i = 0, l = arguments.length; i < l; i++) {
      key = arguments[i];
      if(has(this.hash, key)) {
        this.persist(key);
        delete this.hash[key];
        this.emit('del ' + key);
        this.emit('del', key);
        n++;
      }
    }

    return n;
  };

  //
  // Determine if a key exists
  //
  p.exists = function(key) {
    var exists = has(this.hash, key);
    this.emit('exists ' + key, exists);
    this.emit('exists', key, exists);
    return exists;
  };

  //
  // Set a key's time to live in seconds
  //
  p.expire = function(key, ttl) {

    if (has(this.hash, key) && typeof ttl === 'number' && ttl > -1) {

      if (this.hash[key].tid) {
        clearTimeout(this.hash[key].tid);
      }

      var ms = ttl * 1000;
      var that = this;

      that.hash[key].tid = setTimeout(function() {
        that.del(key);
      }, ms);

      that.hash[key].tend = +new Date() + ms;

      this.emit('expire ' + key, ttl);
      this.emit('expire', key, ttl);
      return true;

    }
    else {
      return false;
    }
  };

  //
  // Set the expiration for a key as a UNIX timestamp
  //
  p.expireat = function(key, dueDate) {
    var ttl = dueDate - (Math.round(new Date() / 1000));
    var rs = this.expire(key, ttl);

    if (rs) {
      this.emit('expireat ' + key, dueDate);
      this.emit('expireat', key, dueDate);
    }

    return rs;
  };

  //
  // Find all keys matching the given pattern
  //
  p.keys = function(regex) {
    var keys = [];

    //
    // if no pattern is provided, report how many
    // keys that there are in the entire object.
    //
    if(!regex) {
      return Object.keys(this.hash).length;
    }

    if(typeof regex === 'string') {
      regex = new RegExp(regex);
    }

    for(var k in this.hash) {
      if(has(this.hash, k) && regex.test(k)) {
        keys.push(k);
      }
    }

    this.emit('keys', regex, keys);
    return keys;
  };

  //
  // Move a key to another database
  //
  p.move = function(key, db) {
    if(db && db.hash) {
      this.persist(key);
      db.hash[key] = this.hash[key];
      delete this.hash[key];
      this.emit('move ' + key, db);
      this.emit('move', key, db);
      return true;
    }
    return false;
  };

  //
  // Inspect the internals of EventVat objects
  //
  p.object = function(subcommend) {
    throw new Error('Not implemented.');
  };

  //
  // Remove the expiration from a key
  //
  p.persist = function(key) {
    if(has(this.hash, key) && this.hash[key].tid) {
      clearTimeout(this.hash[key].tid);
      delete this.hash[key].tid;
      delete this.hash[key].tend;
      this.emit('persist ' + key);
      this.emit('persist', key);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // Return a random key from the keyspace
  //
  p.randomkey = function() {
    var keys = this.keys(/^/);
    var index = Math.floor(Math.random()*keys.length);
    var key = keys[index] || null;
    this.emit('randomkey', key);
    return key;
  };

  //
  // Rename a key
  //
  p.rename = function(oldKey, newKey) {
    if(has(this.hash, oldKey)) {
      this.persist(oldKey);
      this.persist(newKey);
      this.hash[newKey] = this.hash[oldKey];
      delete this.hash[oldKey];
      this.emit('rename ' + oldKey, newKey);
      this.emit('rename', oldKey, newKey);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // Rename a key, only if the new key does not exist
  //
  p.renamenx = function(oldKey, newKey) {
    if(has(this.hash, oldKey) && !has(this.hash, newKey)) {
      this.persist(oldKey);
      this.hash[newKey] = this.hash[oldKey];
      this.emit('renamenx ' + oldKey, newKey);
      this.emit('renamenx', oldKey, newKey);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // Sort key by pattern
  //
  p.sort = function() {
    throw new Error('Not implemented.');

    // fast javascript sort...

    //
    //SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]
    //

  };

  //
  // Determine the type stored at key
  //
  p.type = function(key) {
    if (has(this.hash, key)) {
      var value = this.hash[key].value;
      var type = typeof value;

      if (type === 'object') {
        return this.hash[key].type
          || (Object.prototype.toString.call(value) === '[object Array]'
              ? 'list' : 'hash');
      } else {
        return type;
      }
    } else {
      return 'none';
    }
  };

  //
  // Get the time to live for a key
  //
  p.ttl = function(key) {
    var ttl = has(this.hash, key) && this.hash[key].tid
      ? Math.round((this.hash[key].tend - new Date()) / 1000)
      : -1;

    this.emit('ttl ' + key, ttl);
    this.emit('ttl', key, ttl);
    return ttl;
  };

  // STRINGS
  // -------

  //
  // Append a value to a key
  //
  p.append = function(key, value) {
    var type = this.type(key);
    if (type === 'none') {
      this.hash[key] = { value: '' };
    } else if (type !== 'string') {
      return 0;
    } else {
      this.persist(key);
    }

    var newValue = this.hash[key].value += value;
    var len = newValue.length;
    this.emit('append ' + key, value, len);
    this.emit('append', key, value, len);
    return len;
  };

  //
  // Decrement the integer value of a key by one
  //
  p.decr = function(key) {
    var value = this.decrby(key, 1);
    if (value !== false) {
      this.emit('decr ' + key, value);
      this.emit('decr', key, value);
    }
    return value;
  };

  //
  // Decrement the integer value of a key by N
  //
  p.decrby = function(key, value) {
    if (!has(this.hash, key)) {
      this.hash[key] = { value: 0 };
    } else if (this.type(key) !== 'number') {
      return false;
    }

    this.persist(key);
    var newValue = value ? this.hash[key].value -= value : this.hash[key].value--;
    this.emit('decrby ' + key, value, newValue);
    this.emit('decrby', key, value, newValue);
    return newValue;
  };

  //
  // Get the value of a key
  //
  p.get = function(key) {

    var newValue = null;

    if(has(this.hash, key)) {
      newValue = this.hash[key].value;
      this.emit('get ' + key, newValue);
      this.emit('get', key, newValue);
    }

    return newValue;

  };

  p.getDel = function (key) {
    var newValue = p.get(key);
    p.del(key);
    this.emit('getdel ' + key, newValue);
    this.emit('getdel', key, newValue);
  };

  p.gettime = function() {

    var newValue = null;

    if(has(this.hash, key)) {
      newValue = this.hash[key].time;
      this.emit('gettime ' + key, newValue);
      this.emit('gettime', key, newValue);
    }

    return newValue;

  };

  //
  // Returns the bit value at offset in the string value stored at key
  //
  p.getbit = function(key) {
    throw new Error('Not implemented.');
  };

  //
  // Get a substring of the string stored at a key
  //
  p.getrange = function(key, start, end) {
    if (this.type(key) === 'string') {
      var value = this.hash[key].value.slice(start, end);
      this.emit('getrange ' + key, start, end, value);
      this.emit('getrange', key, start, end, value);
      return value;
    } else {
      return false;
    }
  };

  //
  // Set the string value of a key and return its old value
  //
  p.getset = function(key, value) {
    var old = this.get(key);
    this.set(key, value);
    this.emit('getset ' + key, value, old);
    this.emit('getset', key, value, old);
    return old;
  };

  //
  // Increment the integer value of a key by one
  //
  p.incr = function(key) {
    var value = this.incrby(key, 1);
    if (value !== false) {
      this.emit('incr ' + key, value);
      this.emit('incr', key, value);
    }
    return value;
  };

  //
  // Increment the integer value of a key by the given number
  //
  p.incrby = function(key, value) {
    value = +value;

    if (!has(this.hash, key)) {
      this.hash[key] = { value: 0 };
    } else if (this.type(key) !== 'number') {
      return false;
    }

    this.persist(key);
    var newValue = this.hash[key].value += value;
    this.emit('incrby ' + key, value, newValue);
    this.emit('incrby', key, value, newValue);
    return newValue;
  };

  //
  // Get the values of all the given keys
  //
  p.mget = function() {
    var keys = Array.prototype.slice.call(arguments);
    var values = [];

    for(var i=0, l=keys.length; i < l; i++) {
      values.push(this.get(keys[i]));
    }

    keys.unshift('mget');
    keys.push(values);
    this.emit.apply(this, keys);
    return values;
  };

  //
  // Set multiple keys to multiple values
  //
  p.mset = function() {
    var key, value;

    for(var i=0, l=arguments.length; i < l; i += 2) {
      key = arguments[i];
      value = arguments[i + 1];

      if (has(this.hash, key)) {
        this.persist(key);
        delete this.hash[key].type;
        this.hash[key].value = value;
      }
      else {
        this.hash[key] = { value: value };
      }
    }

    // set events must be emitted after keys are updated
    for(i=0, l=arguments.length; i < l; i += 2) {
      key = arguments[i];
      value = arguments[i + 1];

      this.emit('set ' + key, value);
      this.emit('set', key, value);
    }

    var args = Array.prototype.slice.call(arguments);
    args.unshift('mset');

    //
    // if the number of arguments is even, we must have been provided with a
    // ttl, in which case, use it to expoire the new key
    //
    if (arguments.length % 2 === 0) {
      this.expire(key, arguments[arguments.length-1]);
    }
    else if (this.autoexpire) {
      this.expire(key, this.autoexpire);
    }

    this.emit.apply(this, args);
    return true;
  };

  //
  // Set multiple keys to multiple values, only if none of the keys exist
  //
  p.msetnx = function() {
    var key, value;

    for(var i=0, l=arguments.length; i < l; i += 2) {
      if (has(this.hash, arguments[i])) {
        return false;
      }
    }

    for(i=0, l=arguments.length; i < l; i += 2) {
      key = arguments[i];
      value = arguments[i + 1];

      if (!has(this.hash, key)) {
        this.hash[key] = { value: value };
      }
    }

    for(i=0, l=arguments.length; i < l; i += 2) {
      key = arguments[i];
      value = arguments[i + 1];

      this.emit('set ' + key, value);
      this.emit('set', key, value);
      this.emit('setnx ' + key, value);
      this.emit('setnx', key, value);
    }

    var args = Array.prototype.slice.call(arguments);
    args.unshift('msetnx');
    this.emit.apply(this, args);
    return true;
  };

  //
  // Set the string value of a key
  //
  p.set = function(key, value, ttl) {
    var that = this;

    if(has(this.hash, key)) {
      delete this.hash[key].type;
      this.hash[key].value = value;
    }
    else {
      this.hash[key] = { value: value };
    }

    this.hash[key].time = Date.now().toString();

    this.persist(key);

    if (ttl || this.autoexpire) {
      this.expire(key, ttl || this.autoexpire);
    }

    this.emit('set ' + key, value);
    this.emit('set', key, value);
    return true;
  };

  //
  // Sets or clears the bit at offset in the string value stored at key
  //
  p.setbit = function(key, offset, value) {
    throw new Error('Not implemented.');
  };

  //
  // Set the value and expiration of a key
  //
  p.setex = function(key, seconds, value) {
    throw new Error('Not implemented.');
  };

  //
  // Set the value of a key, only if the key does not exist
  //
  p.setnx = function(key, value, ttl) {
    if(!has(this.hash, key)) {
      this.set(key, value, ttl);
      this.emit('setnx ' + key, value);
      this.emit('setnx', key, value);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // Set the value of a string within the given range
  //
  p.setrange = function(key, offset, value) {
    if (this.type(key) === 'string') {
      var p1 = this.hash[key].value.slice(0, offset);
      var p2 = this.hash[key].value.slice(offset + value.length);
      var newValue = p1 + value + p2;
      var l = newValue.length;

      this.persist(key);
      this.hash.value = newValue;

      this.emit('setrange ' + key, offset, value, l);
      this.emit('setrange', key, offset, value, l);
      return l;
    } else {
      return false;
    }
  };

  //
  // Get the length of the value stored in a key
  //
  p.strlen = function(key) {
    if(this.type(key) === 'string') {
      var l = this.hash[key].value.length;
      this.emit('strlen ' + key, l);
      this.emit('strlen', key, l);
      return l;
    }
    return 0;
  };

  //
  // HASHES
  // ------
  //

  //
  // delete one or more hash fields
  //
  p.hdel = function(key) {
    var n = 0, field;

    if (this.type(key) === 'hash') {
      this.persist(key);

      for (var i=1, l = arguments.length; i < l; i++) {
        field = arguments[i];
        if (has(this.hash[key].value, field)) {
          delete this.hash[key].value[field];
          this.emit('hdel ' + key, field);
          this.emit('hdel', key, field);
          n++;
        }
      }
    }

    return n;
  };

  //
  // determine if a hash field exists
  //
  p.hexists = function(key, field) {
    var e = this.type(key) === 'hash' && has(this.hash[key].value, field);
    this.emit('hexists ' + key, field, e);
    this.emit('hexists', key, field, e);
    return e;
  };

  //
  // get the value of a hash field.
  //
  p.hget = function(key, field) {
    if(this.type(key) === 'hash' && has(this.hash[key].value, field)) {
      var value = this.hash[key].value[field];
      this.emit('hget ' + key, field, value);
      this.emit('hget', key, field, value);
      return value;
    }
    else {
      return null;
    }
  };

  //
  // get all the fields and values in a hash
  //
  p.hgetall = function(key) {
    var hash = this.type(key) === 'hash' ? this.hash[key].value : {};
    this.emit('hgetall ' + key, hash);
    this.emit('hgetall', key, hash);
    return hash;
  };

  //
  // increment the integer value of a hash field by 1
  //
  p.hincr = function(key, field) {
    var value = this.hincrby(key, field, 1);
    if (value !== false) {
      this.emit('hincr ' + key, field, value);
      this.emit('hincr', key, field, value);
    }
    return value;
  };

  //
  // increment the integer value of a hash field by the given number
  //
  p.hincrby = function(key, field, value) {
    value = +value;

    var type = this.type(key);
    if (type === 'none') {
      this.hash[key] = { value: {}, type: 'hash' };
    } else if (type !== 'hash') {
      return false;
    }

    if (!has(this.hash[key].value, field)) {
      this.hash[key].value[field] = 0;
    } else if (typeof this.hash[key].value[field] !== 'number') {
      return false;
    }

    var newValue = this.hash[key].value[field] += value;
    this.emit('hincrby ' + key, field, value, newValue);
    this.emit('hincrby', key, field, value, newValue);
    return newValue;
  };

  //
  // decrement the integer value of a hash field by 1
  //
  p.hdecr = function(key, field) {
    var value = this.hdecrby(key, field, 1);
    if (value !== false) {
      this.emit('hdecr ' + key, field, value);
      this.emit('hdecr', key, field, value);
    }
    return value;
  };

  //
  // decrement the integer value of a hash field by the given number
  //
  p.hdecrby = function(key, field, value) {
    value = +value;

    var type = this.type(key);
    if (type === 'none') {
      this.hash[key] = { value: {}, type: 'hash' };
    } else if (type !== 'hash') {
      return false;
    } else {
      this.persist(key);
    }

    if (!has(this.hash[key].value, field)) {
      this.hash[key].value[field] = 0;
    } else if (typeof this.hash[key].value[field] !== 'number') {
      return false;
    }

    var newValue = this.hash[key].value[field] -= value;
    this.emit('hdecrby ' + key, field, value, newValue);
    this.emit('hdecrby', key, field, value, newValue);
    return newValue;
  };

  //
  // get all the fields in a hash
  //
  p.hkeys = function(key) {
    var fields = [];

    if (this.type(key) === 'hash') {
      var hash = this.hash[key].value;
      for (var k in hash) {
        if (has(hash, k)) {
          fields.push(k);
        }
      }
    }

    this.emit('hkeys ' + key, fields);
    this.emit('hkeys', key, fields);
    return fields;
  };

  //
  // get the number of fields in a hash
  //
  p.hlen = function(key) {
    var len = 0;

    if (this.type(key) === 'hash') {
      var hash = this.hash[key].value;
      for (var k in hash) {
        if (has(hash, k)) {
          len++;
        }
      }
    }

    this.emit('hlen ' + key, len);
    this.emit('hlen', key, len);
    return len;
  };

  //
  // get the values of all the given hash fields
  //
  p.hmget = function(key, field) {
    var values = [];

    for(var i=1, l=arguments.length; i < l; i++) {
      values.push(this.hget(key, arguments[i]));
    }

    this.emit('hmget ' + key, values);
    this.emit('hmget', key, values);
    return values;
  };

  //
  // set multiple hash fields to multiple values
  //
  p.hmset = function(key) {
    var type = this.type(key);
    if (type === 'none') {
      this.hash[key] = { value: {}, type: 'hash' };
    } else if (type !== 'hash') {
      return false;
    } else {
      this.persist(key);
    }

    for(var i=1, l=arguments.length; i < l; i += 2) {
      this.hash[key].value[arguments[i]] = arguments[i + 1];
    }

    // set events must be emitted after keys are updated
    var field, value;
    for(i=1, l=arguments.length; i < l; i += 2) {
      field = arguments[i];
      value = arguments[i + 1];

      this.emit('hset ' + key, field, value);
      this.emit('hset', key, field, value);
    }

    var args = Array.prototype.slice.call(arguments);
    this.emit.apply(this, ['hmset ' + key].concat(args.slice(1)));
    this.emit.apply(this, ['hmset'].concat(args));
    return true;
  };

  //
  // set the string value of a hash field
  //
  p.hset = function(key, field, value) {

    var update;
    var type = this.type(key);

    if (type === 'none') {
      this.hash[key] = { value: {}, type: 'hash' };
      update = false;
    }
    else if (type === 'hash') {
      this.persist(key);
      update = has(this.hash[key].value, field);
    }
    else {
      return false;
    }

    this.hash[key].value[field] = value;

    //
    // if the number of arguments is even, we must have been provided with a
    // ttl, in which case, use it to expoire the new key
    //
    if (arguments.length % 2 === 0) {
      this.expire(key, arguments[arguments.length-1]);
    }
    else if (this.autoexpire) {
      this.expire(key, this.autoexpire);
    }

    this.emit('hset ' + key, field, value, update);
    this.emit('hset', key, field, value, update);

    return update;
  };

  //
  // Set the value of a hash field, only if the field does not exist
  //
  p.hsetnx = function(key, field, value) {
    var type = this.type(key);
    if (type === 'none') {
      this.hash[key] = { value: {}, type: 'hash' };
    }
    else if (type !== 'hash') {
      return false;
    }
    else {
      this.persist(key);
    }

    if (!has(this.hash[key].value, field)) {
      this.hset(key, field, value);
      this.emit('hsetnx ' + key, field, value);
      this.emit('hsetnx', key, field, value);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // get all the values in a hash
  //
  p.hvals = function(key) {
    var values = [];

    if (this.type(key) === 'hash') {
      var hash = this.hash[key].value;
      for (var k in hash) {
        if (has(hash, k)) {
          values.push(hash[k]);
        }
      }
    }

    this.emit('hvals ' + key, values);
    this.emit('hvals', key, values);
    return values;
  };

  //
  // LISTS
  // -----
  //

  //
  // Get an element from a list by its index
  //
  p.lindex = function(key, index) {
    if (this.type(key) === 'list') {
      var list = this.hash[key].value;
      var len = list.length;

      if (index < 0) {
        index = len + index;
      }
      if (index < 0 || index >= len) {
        return null;
      }

      var value = list[index];
      this.emit('lindex ' + key, index, value);
      this.emit('lindex', key, index, value);
      return value;
    }
    else {
      return false;
    }
  };

  //
  // Insert an element before or after another element in a list
  //
  p.linsert = function(key, ba, pivot, value) {
    throw new Error('Not implemented.');
  };

  //
  // Get the length of a list
  //
  p.llen = function(key) {
    var type = this.type(key);
    if (type === 'none') {
      return false;
    }

    var len = type === 'list' ? this.hash[key].value.length : 0;
    this.emit('llen ' + key, len);
    this.emit('llen', key, len);
    return len;
  };

  //
  // Remove and get the first element in a list
  //
  p.lpop = function(key) {
    if (this.type(key) === 'list') {
      this.persist(key);
      var value = this.hash[key].value.shift() || null;
      this.emit('lpop ' + key, value);
      this.emit('lpop', key, value);
      return value;
    }
    else {
      return null;
    }
  };

  //
  // Prepend one or multiple values to a list
  //
  p.lpush = function(key) {

    var type = this.type(key);
    var list;

    if (type === 'none') {
      list = [];
      this.hash[key] = { value: list, type: 'list' };
    }
    else if (type !== 'list') {
      return false;
    }
    else {
      this.persist(key);
      list = this.hash[key].value;
    }

    for (var i = 1, l = arguments.length; i < l; i++) {
      var val = arguments[i];
      var len = list.unshift(val);
      this.emit('lpush ' + key, val, len);
      this.emit('lpush', key, val, len);
    }

    if (this.autoexpire) {
      this.expire(key, this.autoexpire);
    }

    return len;
  };

  //
  // Prepend a value to a list, only if the list exists
  //
  p.lpushx = function(key, value) {
    if (this.type(key) === 'list') {
      var len = this.hash[key].value.unshift(value);
      this.emit('lpushx ' + key, value, len);
      this.emit('lpushx', key, value, len);
      return len;
    }
    else {
      return 0;
    }
  };

  //
  // Get a range of elements from a list
  //
  p.lrange = function(key, start, stop) {
    var range = this.type(key) === 'list'
      ? this.hash[key].value.slice(start, stop) : [];

    this.emit('lrange ' + key, start, stop, range);
    this.emit('lrange', key, start, stop, range);
    return range;
  };

  //
  // Remove elements from a list
  //
  p.lrem = function(key, count, value) {
    if (this.type(key) === 'list') {
      this.persist(key);
      var list = this.hash[key].value;
      var n = 0;

      var i, check, incr, cancel, ncount = count;
      // if count is positive, list will be traversed from 0 to list.length
      if (ncount >= 0) {
        i = 0;
        check = function() { return i < list.length; };
        incr = function() { i++; };
        cancel = function() { i--; };

        // if count is 0, there is no limit on the number of items
        // that match value to remove
        if (ncount === 0) {
          ncount = Infinity;
        }

      // if count is negative, list will be traversed backwards
      }
      else {
        i = list.length;
        check = function() { return i >= 0; };
        incr = function() { i--;};
        cancel = function() {};
        ncount *= -1;
      }

      for (; check(); incr()) {
        if (list[i] === value) {
          list.splice(i, 1);
          cancel();
          if (++n === ncount) {
            break;
          }
        }
      }

      this.emit('lrem ' + key, count, value, n);
      this.emit('lrem', key, count, value, n);
      return n;
    } else {
      return 0;
    }
  };

  //
  // Set the value of an element in a list by its index
  //
  p.lset = function(key, index, value) {
    if (this.type(key) === 'list') {
      this.persist(key);
      var list = this.hash[key].value;
      var len = list.length;

      if (index < 0) {
        index = len + index;
      }
      if (index < 0 || index >= len) {
        return false;
      }

      list[index] = value;
      this.emit('lset ' + key, index, value);
      this.emit('lset', key, index, value);

      if (this.autoexpire) {
        this.expire(key, this.autoexpire);
      }

      return true;
    }
    else {
      return false;
    }
  };

  //
  // Trim a list to the specified range
  //
  p.ltrim = function(key, start, stop) {
    if (this.type(key) === 'list') {
      this.persist(key);
      this.hash[key].value = this.hash[key].value.slice(start, stop);
      this.emit('ltrim ' + key, start, stop);
      this.emit('ltrim', key, start, stop);
      return true;
    }
    else {
      return false;
    }
  };

  //
  // Remove and get the last element in a list
  //
  p.rpop = function(key) {
    if (this.type(key) === 'list') {
      this.persist(key);
      var value = this.hash[key].value.pop() || null;
      this.emit('rpop ' + key, value);
      this.emit('rpop', key, value);
      return value;
    }
    else {
      return null;
    }
  };

  //
  // Remove the last element in a list, append it to another list and return it
  //
  p.rpoplpush = function(source, destination) {
    if (this.type(source) === 'list') {
      var dtype = this.type(destination);
      var dest;

      if (dtype === 'none') {
        dest = [];
        this.hash[destination] = { value: dest, type: 'list' };
      }
      else if (dtype !== 'list') {
        return null;
      }
      else {
        this.persist(destination);
        dest = this.hash[destination].value;
      }

      this.persist(source);
      var value = this.hash[source].value.pop();
      var len = dest.unshift(value);
      this.emit('rpoplpush ' + source, destination, value);
      this.emit('rpoplpush', source, destination, value);
      this.emit('rpop ' + source, value);
      this.emit('rpop', source, value);
      this.emit('lpush ' + destination, value, len);
      this.emit('lpush', destination, value, len);
      return value;
    }
    else {
      return null;
    }
  };

  //
  // Append one or multiple values to a list
  //
  p.rpush = function(key) {
    var type = this.type(key);
    var list;
    if (type === 'none') {
      list = [];
      this.hash[key] = { value: list, type: 'list' };
    }
    else if (type !== 'list') {
      return false;
    }
    else {
      this.persist(key);
      list = this.hash[key].value;
    }

    for (var i = 1, l = arguments.length; i < l; i++) {
      var val = arguments[i];
      var len = list.push(val);
      this.emit('rpush ' + key, val, len);
      this.emit('rpush', key, val, len);
    }

    if (this.autoexpire) {
      this.expire(key, this.autoexpire);
    }

    return len;
  };

  //
  // Append a value to a list, only if the list exists
  //
  p.rpushx = function(key, value) {
    if (this.type(key) === 'list') {
      var len = this.hash[key].value.push(value);
      this.emit('rpushx ' + key, value, len);
      this.emit('rpushx', key, value, len);
      return len;
    }
    else {
      return 0;
    }
  };

  //
  //
  // Non stsandard methods.
  //
  //
  p.dump = function(stringify) {

    var dump = {};

    for(var key in this.hash) {
      if(has(this.hash, key)) {
        dump[key] = this.hash[key].value;
      }
    }

    dump = stringify ? JSON.stringify(dump) : dump;

    this.emit('dump', null, dump);
    return dump;
  };

  //
  // swap the values of two keys
  //
  p.swap = function(a, b, depth) {
    if(has(this.hash, a) && has(this.hash, b)) {

      var av = this.hash[a];
      var bv = this.hash[b];

      if(depth) {
        av = this.hash[a] = [bv, bv = this.hash[b] = av][0];
      }
      else {
        av.value = [bv.value, bv.value = av.value][0];
      }

      this.persist(a);
      this.persist(b);
      this.emit('swap ' + a, b, depth);
      this.emit('swap ' + b, a, depth);
      this.emit('swap', a, b, depth);
      return depth ? [a, b] : [a.value, b.value];
    }
    else {
      return false;
    }

  };

  //
  // check if a value is in a key
  //
  p.findin = function(key, value) {
    if(has(this.hash, key)) {
      var index = this.hash[key].value.indexOf(value);
      this.emit('findin ' + key, value, index);
      this.emit('findin', key, value, index);
      return index;
    }
    else {
      return false;
    }
  };

}((typeof process !== 'undefined' && typeof process.title !== 'undefined') ? module : window));


text:
package xyz.vopen.cartier.classified.logger.async;

import org.slf4j.Logger;
import xyz.vopen.cartier.classified.logger.ClassifiedLogger;

import java.util.ArrayList;
import java.util.List;

/**
 * logger event
 *
 * @author Elve.xu [xuhw@yyft.com]
 * @version v1.0 - 17/08/2017.
 */
public class ClassifiedLoggerEvent {

    /**
     * logback logger instance
     */
    private Logger logger;

    /**
     * logger type
     */
    private ClassifiedLogger classifiedLogger;

    private boolean sortable = false;

    /**
     * logger content
     */
    private String content;

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

    public ClassifiedLoggerEvent () {
    }

    public ClassifiedLoggerEvent (ClassifiedLogger classifiedLogger, String content, Logger logger) {
        this.classifiedLogger = classifiedLogger;
        this.content = content;
        this.logger = logger;
    }

    public ClassifiedLogger getClassifiedLogger () {
        return classifiedLogger;
    }

    public void setClassifiedLogger (ClassifiedLogger classifiedLogger) {
        this.classifiedLogger = classifiedLogger;
    }

    public Logger getLogger () {
        return logger;
    }

    public void setLogger (Logger logger) {
        this.logger = logger;
    }

    public String getContent () {
        return content;
    }

    public void setContent (String content) {
        this.content = content;
    }

    public boolean isSortable () {
        return sortable;
    }

    public void setSortable (boolean sortable) {
        this.sortable = sortable;
    }

    public List<String> getContents () {
        return contents;
    }

    public void setContents (List<String> contents) {
        this.contents = contents;
    }

}


text:
package org.tools4j.mmap.region.impl;

import java.nio.channels.FileChannel;
import java.util.Objects;
import java.util.function.Supplier;

import org.agrona.DirectBuffer;

import org.tools4j.mmap.region.api.FileSizeEnsurer;
import org.tools4j.mmap.region.api.Region;

public class SyncRegion implements Region {
    private static final long NULL = -1;

    private final Supplier<? extends FileChannel> fileChannelSupplier;
    private final IoMapper ioMapper;
    private final IoUnmapper ioUnmapper;
    private final FileSizeEnsurer fileSizeEnsurer;
    private final FileChannel.MapMode mapMode;
    private final int length;

    private long currentPosition = NULL;
    private long currentAddress = NULL;

    public SyncRegion(final Supplier<? extends FileChannel> fileChannelSupplier,
                      final IoMapper ioMapper,
                      final IoUnmapper ioUnmapper,
                      final FileSizeEnsurer fileSizeEnsurer,
                      final FileChannel.MapMode mapMode,
                      final int length) {
        this.fileChannelSupplier = Objects.requireNonNull(fileChannelSupplier);
        this.ioMapper = Objects.requireNonNull(ioMapper);
        this.ioUnmapper = Objects.requireNonNull(ioUnmapper);
        this.fileSizeEnsurer = Objects.requireNonNull(fileSizeEnsurer);
        this.mapMode = Objects.requireNonNull(mapMode);
        this.length = length;
    }

    @Override
    public boolean wrap(final long position, final DirectBuffer source) {
        final int regionOffset = (int) (position & (this.length - 1));
        final long regionStartPosition = position - regionOffset;
        if (map(regionStartPosition)) {
            source.wrap(currentAddress + regionOffset, this.length - regionOffset);
            return true;
        }
        return false;
    }

    @Override
    public boolean map(final long regionStartPosition) {
        if (regionStartPosition < 0) throw new IllegalArgumentException("Invalid regionStartPosition " + regionStartPosition);

        if (currentPosition == regionStartPosition) return true;

        if (currentAddress != NULL) {
            ioUnmapper.unmap(fileChannelSupplier.get(), currentAddress, length);
            currentAddress = NULL;
        }
        if (fileSizeEnsurer.ensureSize(regionStartPosition + length)) {
            currentAddress = ioMapper.map(fileChannelSupplier.get(), mapMode, regionStartPosition, length);
            currentPosition = regionStartPosition;
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean unmap() {
        if (currentAddress != NULL) {
            ioUnmapper.unmap(fileChannelSupplier.get(), currentAddress, length);
            currentAddress = NULL;
            currentPosition = NULL;
        }
        return true;
    }

    @Override
    public void close() {
        unmap();
    }

    @Override
    public int size() {
        return length;
    }

}


text:
using System.Linq;

using LinqToDB;
using LinqToDB.Mapping;
using NUnit.Framework;

namespace Tests.xUpdate
{
	public partial class MergeTests
	{
		[Test]
		public void InsertUpdate([MergeDataContextSource(TestProvName.AllSapHana)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.UpdateWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(4, rows, context);

				Assert.AreEqual(6, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[1], result[3], null, null);
				AssertRow(InitialSourceData[2], result[4], null, null);
				AssertRow(InitialSourceData[3], result[5], null, 216);
			}
		}

		[Test]
		public void InsertDelete([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSapHana, TestProvName.AllFirebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.DeleteWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(4, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[2], result[2], null, null);
				AssertRow(InitialSourceData[3], result[3], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void UpdateWithConditionDelete([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.DeleteWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(2, rows);

				Assert.AreEqual(3, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
			}
		}

		[Test]
		public void UpdateWithConditionDeleteWithConditionUpdate([MergeDataContextSource(
			TestProvName.AllSqlServer2008Plus,
			ProviderName.PostgreSQL15,
			TestProvName.AllOracle,
			TestProvName.AllInformix,
			TestProvName.AllSapHana,
			ProviderName.Firebird,
			ProviderName.Sybase)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db).ToList().Concat(new[] { new TestMapping1() { Id = 1, Field1 = 123 } }))
					.OnTargetKey()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.DeleteWhenMatchedAnd((t, s) => s.Id == 1)
					.UpdateWhenMatched((t, s) => new TestMapping1()
					{
						Field1 = 222
					})
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(3, rows, context);

				Assert.AreEqual(3, result.Count);

				AssertRow(InitialTargetData[1], result[0], null, null);
				AssertRow(InitialTargetData[2], result[1], null, 203);

				Assert.AreEqual(4, result[2].Id);
				Assert.AreEqual(222, result[2].Field1);
				Assert.AreEqual(6, result[2].Field2);
				Assert.IsNull(result[2].Field3);
				Assert.IsNull(result[2].Field4);
				Assert.IsNull(result[2].Field5);
			}
		}

		[Test]
		public void InsertUpdateBySourceWithConditionDeleteBySource(
			[IncludeDataSources(true, TestProvName.AllSqlServer2008Plus)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.UpdateWhenNotMatchedBySourceAnd(
						t => t.Id == 2,
						t => new TestMapping1() { Field1 = 44 })
					.DeleteWhenNotMatchedBySource()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				Assert.AreEqual(2, result[0].Id);
				Assert.AreEqual(44, result[0].Field1);
				Assert.IsNull(result[0].Field2);
				Assert.IsNull(result[0].Field3);
				Assert.IsNull(result[0].Field4);
				Assert.IsNull(result[0].Field5);

				AssertRow(InitialTargetData[2], result[1], null, 203);
				AssertRow(InitialTargetData[3], result[2], null, null);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		[Test]
		public void InsertDeleteUpdateBySource([IncludeDataSources(true, TestProvName.AllSqlServer2008Plus)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.DeleteWhenMatched()
					.UpdateWhenNotMatchedBySource(t => new TestMapping1() { Field1 = 44 })
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(6, rows);

				Assert.AreEqual(4, result.Count);

				Assert.AreEqual(1, result[0].Id);
				Assert.AreEqual(44, result[0].Field1);
				Assert.IsNull(result[0].Field2);
				Assert.IsNull(result[0].Field3);
				Assert.IsNull(result[0].Field4);
				Assert.IsNull(result[0].Field5);

				Assert.AreEqual(2, result[1].Id);
				Assert.AreEqual(44, result[1].Field1);
				Assert.IsNull(result[1].Field2);
				Assert.IsNull(result[1].Field3);
				Assert.IsNull(result[1].Field4);
				Assert.IsNull(result[1].Field5);

				AssertRow(InitialSourceData[2], result[2], null, null);
				AssertRow(InitialSourceData[3], result[3], null, 216);
			}
		}

		[Test]
		public void InsertWithConditionInsertUpdateWithConditionDeleteWithConditionDelete([MergeDataContextSource(
			TestProvName.AllSqlServer2008Plus,
			TestProvName.AllOracle,
			ProviderName.PostgreSQL15,
			TestProvName.AllInformix,
			TestProvName.AllSapHana,
			ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db).ToList().Concat(new[] { new TestMapping1() { Id = 1, Field1 = 123 } }))
					.OnTargetKey()
					.InsertWhenNotMatchedAnd(s => s.Id == 5)
					.InsertWhenNotMatched()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.DeleteWhenMatchedAnd((t, s) => t.Id == 4)
					.DeleteWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(5, rows, context);

				if (!context.IsAnyOf(ProviderName.Sybase))
				{
					Assert.AreEqual(4, result.Count);

					AssertRow(InitialTargetData[1], result[0], null, null);
					AssertRow(InitialTargetData[2], result[1], null, 203);
					AssertRow(InitialSourceData[2], result[2], null, null);
					AssertRow(InitialSourceData[3], result[3], null, 216);
				}
			}
		}

		[Test]
		public void UpdateInsert([MergeDataContextSource] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatched()
					.InsertWhenNotMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(4, rows, context);

				Assert.AreEqual(6, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[1], result[3], null, null);
				AssertRow(InitialSourceData[2], result[4], null, null);
				AssertRow(InitialSourceData[3], result[5], null, 216);
			}
		}

		[Test]
		public void UpdateWithConditionUpdate([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSqlServer2008Plus,
			ProviderName.PostgreSQL15,
			TestProvName.AllInformix,
			TestProvName.AllSapHana,
			ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.UpdateWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(2, rows, context);

				Assert.AreEqual(4, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[1], result[3], null, null);
			}
		}

		[Test]
		public void DeleteInsert([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.DeleteWhenMatched()
					.InsertWhenNotMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(4, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[2], result[2], null, null);
				AssertRow(InitialSourceData[3], result[3], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void DeleteWithConditionUpdate([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.UpdateWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(2, rows);

				Assert.AreEqual(3, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
			}
		}

		[Test]
		public void UpdateWithDeleteWithDeleteCondition(
			[IncludeDataSources(true, TestProvName.AllOracle)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedThenDelete((t, s) => s.Id == 4)
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(2, rows, context);

				Assert.AreEqual(3, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
			}
		}

		// ASE: just fails
		[Test]
		public void InsertUpdateWithConditionDeleteWithCondition([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		[Test]
		public void InsertUpdateWithDelete([IncludeDataSources(true, TestProvName.AllOracle)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.UpdateWhenMatchedAndThenDelete((t, s) => t.Id == 3 || s.Id == 4, (t, s) => s.Id == 4)
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(4, rows, context);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void InsertDeleteWithConditionUpdate([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.InsertWhenNotMatched()
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.UpdateWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void UpdateWithConditionInsertDeleteWithCondition([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.InsertWhenNotMatched()
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void UpdateWithConditionDeleteWithConditionInsert([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.InsertWhenNotMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void DeleteWithConditionUpdateWithConditionInsert([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.InsertWhenNotMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		// ASE: just fails
		[Test]
		public void DeleteWithConditionInsertUpdateWithCondition([MergeDataContextSource(
			TestProvName.AllOracle,
			TestProvName.AllSybase, TestProvName.AllInformix,
			TestProvName.AllSapHana, ProviderName.Firebird)]
			string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.DeleteWhenMatchedAnd((t, s) => s.Id == 4)
					.InsertWhenNotMatched()
					.UpdateWhenMatchedAnd((t, s) => t.Id == 3)
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				Assert.AreEqual(4, rows);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		[Test]
		public void UpdateWithDeleteInsert([IncludeDataSources(true, TestProvName.AllOracle)] string context)
		{
			using (var db = GetDataContext(context))
			{
				PrepareData(db);

				var table = GetTarget(db);

				var rows = table
					.Merge()
					.Using(GetSource1(db))
					.OnTargetKey()
					.UpdateWhenMatchedAndThenDelete((t, s) => t.Id == 3 || t.Id == 4, (t, s) => s.Id == 4)
					.InsertWhenNotMatched()
					.Merge();

				var result = table.OrderBy(_ => _.Id).ToList();

				AssertRowCount(4, rows, context);

				Assert.AreEqual(5, result.Count);

				AssertRow(InitialTargetData[0], result[0], null, null);
				AssertRow(InitialTargetData[1], result[1], null, null);
				AssertRow(InitialSourceData[0], result[2], null, 203);
				AssertRow(InitialSourceData[2], result[3], null, null);
				AssertRow(InitialSourceData[3], result[4], null, 216);
			}
		}

		[Table]
		class PKOnlyTable
		{
			[PrimaryKey] public int ID { get; set; }
		}

		[Test]
		public void InsertUpdatePKOnly([MergeDataContextSource] string context)
		{
			var src = new []
				{
					new PKOnlyTable() { ID = 1 },
					new PKOnlyTable() { ID = 2 },
					new PKOnlyTable() { ID = 3 }
				};

			using (var db = GetDataContext(context))
			using (var table = db.CreateLocalTable(src.Skip(1).Take(1)))
			{
				var rows = table
					.Merge()
					.Using(src)
					.OnTargetKey()
					.InsertWhenNotMatched()
					.UpdateWhenMatched()
					.Merge();

				var result = table.OrderBy(_ => _.ID).ToList();

				if (context.IsAnyOf(TestProvName.AllSybase))
					Assert.AreEqual(3, rows);
				else if (context.IsAnyOf(TestProvName.AllOracleNative))
					Assert.AreEqual(-1, rows);
				else
					Assert.AreEqual(2, rows);

				Assert.AreEqual(3, result.Count);

				Assert.AreEqual(1, result[0].ID);
				Assert.AreEqual(2, result[1].ID);
				Assert.AreEqual(3, result[2].ID);
			}
		}
	}
}


text:
/*
 * This source file was generated by FireStorm/DAO.
 *
 * If you purchase a full license for FireStorm/DAO you can customize this header file.
 *
 * For more information please visit http://www.codefutures.com/products/firestorm
 */

package co.edu.sena.model.dao.dto;

import co.edu.sena.controller.dao.*;
import co.edu.sena.controller.factory.*;
import co.edu.sena.controller.dao.exceptions.*;
import java.io.Serializable;
import java.util.*;

public class GrupoProyecto implements Serializable
{
	/**
	 * This attribute maps to the column numero_ficha in the grupo_proyecto table.
	 */
	protected String numeroFicha;

	/**
	 * This attribute maps to the column codigo in the grupo_proyecto table.
	 */
	protected int codigo;

	/**
	 * This attribute maps to the column nombre_proyecto in the grupo_proyecto table.
	 */
	protected String nombreProyecto;

	/**
	 * This attribute maps to the column estado_grupo in the grupo_proyecto table.
	 */
	protected String estadoGrupo;

	/**
	 * Method 'GrupoProyecto'
	 *
	 */
	public GrupoProyecto()
	{
	}

	/**
	 * Method 'getNumeroFicha'
	 *
	 * @return String
	 */
	public String getNumeroFicha()
	{
		return numeroFicha;
	}

	/**
	 * Method 'setNumeroFicha'
	 *
	 * @param numeroFicha
	 */
	public void setNumeroFicha(String numeroFicha)
	{
		this.numeroFicha = numeroFicha;
	}

	/**
	 * Method 'getCodigo'
	 *
	 * @return int
	 */
	public int getCodigo()
	{
		return codigo;
	}

	/**
	 * Method 'setCodigo'
	 *
	 * @param codigo
	 */
	public void setCodigo(int codigo)
	{
		this.codigo = codigo;
	}

	/**
	 * Method 'getNombreProyecto'
	 *
	 * @return String
	 */
	public String getNombreProyecto()
	{
		return nombreProyecto;
	}

	/**
	 * Method 'setNombreProyecto'
	 *
	 * @param nombreProyecto
	 */
	public void setNombreProyecto(String nombreProyecto)
	{
		this.nombreProyecto = nombreProyecto;
	}

	/**
	 * Method 'getEstadoGrupo'
	 *
	 * @return String
	 */
	public String getEstadoGrupo()
	{
		return estadoGrupo;
	}

	/**
	 * Method 'setEstadoGrupo'
	 *
	 * @param estadoGrupo
	 */
	public void setEstadoGrupo(String estadoGrupo)
	{
		this.estadoGrupo = estadoGrupo;
	}

	/**
	 * Method 'equals'
	 *
	 * @param _other
	 * @return boolean
	 */
	public boolean equals(Object _other)
	{
		if (_other == null) {
			return false;
		}

		if (_other == this) {
			return true;
		}

		if (!(_other instanceof GrupoProyecto)) {
			return false;
		}

		final GrupoProyecto _cast = (GrupoProyecto) _other;
		if (numeroFicha == null ? _cast.numeroFicha != numeroFicha : !numeroFicha.equals( _cast.numeroFicha )) {
			return false;
		}

		if (codigo != _cast.codigo) {
			return false;
		}

		if (nombreProyecto == null ? _cast.nombreProyecto != nombreProyecto : !nombreProyecto.equals( _cast.nombreProyecto )) {
			return false;
		}

		if (estadoGrupo == null ? _cast.estadoGrupo != estadoGrupo : !estadoGrupo.equals( _cast.estadoGrupo )) {
			return false;
		}

		return true;
	}

	/**
	 * Method 'hashCode'
	 *
	 * @return int
	 */
	public int hashCode()
	{
		int _hashCode = 0;
		if (numeroFicha != null) {
			_hashCode = 29 * _hashCode + numeroFicha.hashCode();
		}

		_hashCode = 29 * _hashCode + codigo;
		if (nombreProyecto != null) {
			_hashCode = 29 * _hashCode + nombreProyecto.hashCode();
		}

		if (estadoGrupo != null) {
			_hashCode = 29 * _hashCode + estadoGrupo.hashCode();
		}

		return _hashCode;
	}

	/**
	 * Method 'createPk'
	 *
	 * @return GrupoProyectoPk
	 */
	public GrupoProyectoPk createPk()
	{
		return new GrupoProyectoPk(numeroFicha, codigo);
	}

	/**
	 * Method 'toString'
	 *
	 * @return String
	 */
	public String toString()
	{
		StringBuffer ret = new StringBuffer();
		ret.append( "co.edu.sena.model.dao.dto.GrupoProyecto: " );
		ret.append( "numeroFicha=" + numeroFicha );
		ret.append( ", codigo=" + codigo );
		ret.append( ", nombreProyecto=" + nombreProyecto );
		ret.append( ", estadoGrupo=" + estadoGrupo );
		return ret.toString();
	}

}


text:
/**
 *    @file
 *     This file implements a unit test suite for <tt>nl::Inet::InetTimer</tt>,
 *     a class that provides timers for the Inet library.
 *
 */

#include <InetLayer/InetConfig.h>

#if INET_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES

#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif

#include <stdint.h>
#include <string.h>

#include <InetLayer/InetLayer.h>
#include <InetLayer/InetTimer.h>

#include <nlunit-test.h>

#include "ToolCommon.h"

#define MEM_ALIGN_SIZE(SZ, ALIGN)       (((SZ) + (ALIGN) - 1) & ~((ALIGN) - 1))
#define INET_BUF_SIZE                   1536
#define INET_BUF_HEADER_SIZE            MEM_ALIGN_SIZE(sizeof(InetBuffer), 4)
#define INET_TO_PBUF(x)                 (static_cast<struct pbuf*>(static_cast<void *>(x)))

using namespace nl::Inet;

// Test input vector format.

struct TestContext {
    InetLayer *mInet;
    nlTestSuite *mTestSuite;
};

// Test input data.

static struct TestContext sContext;

static volatile bool sOverflowTestDone;

void HandleTimer0Failed(InetLayer *inetLayer, void *appState, INET_ERROR err)
{
    TestContext *context = static_cast<TestContext *>(appState);
    NL_TEST_ASSERT(context->mTestSuite, false);
    sOverflowTestDone = true;
}

void HandleTimer1Failed(InetLayer *inetLayer, void *appState, INET_ERROR err)
{
    TestContext *context = static_cast<TestContext *>(appState);
    NL_TEST_ASSERT(context->mTestSuite, false);
    sOverflowTestDone = true;
}

void HandleTimer10Success(InetLayer *inetLayer, void *appState, INET_ERROR err)
{
    TestContext *context = static_cast<TestContext *>(appState);
    NL_TEST_ASSERT(context->mTestSuite, true);
    sOverflowTestDone = true;
}

static void CheckOverflow(nlTestSuite *inSuite, void *inContext)
{
    uint32_t timeout_overflow_0ms = 652835029;
    uint32_t timeout_overflow_1ms = 1958505088;
    uint32_t timeout_10ms = 10;

    TestContext *context = static_cast<TestContext *>(inContext);

    sOverflowTestDone = false;
    context->mInet->StartTimer(timeout_overflow_0ms, HandleTimer0Failed, inContext);
    context->mInet->StartTimer(timeout_overflow_1ms, HandleTimer1Failed, inContext);
    context->mInet->StartTimer(timeout_10ms, HandleTimer10Success, inContext);
    while (!sOverflowTestDone)
    {
        struct timeval sleepTime;
        sleepTime.tv_sec = 0;
        sleepTime.tv_usec = 1000; // 1 ms tick
        ServiceNetwork(sleepTime);
    }
    context->mInet->CancelTimer(HandleTimer0Failed, inContext);
    context->mInet->CancelTimer(HandleTimer1Failed, inContext);
    context->mInet->CancelTimer(HandleTimer10Success, inContext);
}

// Test Suite

/**
 *   Test Suite. It lists all the test functions.
 */
static const nlTest sTests[] = {
    NL_TEST_DEF("InetTimer::TestOverflow",             CheckOverflow),
    NL_TEST_SENTINEL()
};

/**
 *  Set up the test suite.
 *  This is a work-around to initiate InetBuffer protected class instance's
 *  data and set it to a known state, before an instance is created.
 */
static int TestSetup(void *inContext)
{
    return (SUCCESS);
}

/**
 *  Tear down the test suite.
 *  Free memory reserved at TestSetup.
 */
static int TestTeardown(void *inContext)
{
    return (SUCCESS);
}

int main(int argc, char *argv[])
{
#if INET_SOCKETS
    nlTestSuite theSuite = {
        "inet-timer",
        &sTests[0],
        TestSetup,
        TestTeardown
    };

    // Generate machine-readable, comma-separated value (CSV) output.
    nl_test_set_output_style(OUTPUT_CSV);

    SetSIGUSR1Handler();

//    ParseArgs(argc, argv);

    InitSystemLayer();
    InitNetwork();
    sContext.mInet = &Inet;
    sContext.mTestSuite = &theSuite;
    // Run test suit againt one context.
    nlTestRunner(&theSuite, &sContext);

    return nlTestRunnerStats(&theSuite);
#else // !INET_SOCKETS
    return 0;
#endif // !INET_SOCKETS
}

#else // !INET_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES

int main(void)
{
    return 0;
}

#endif // !INET_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES


text:
<?php
/**
 * @license MIT
 * Full license text in LICENSE file
 */

namespace Humdir\Core\Usecase\Customer\Delete;
use Humdir\Core\Data;

class Interactor
{
    private $customer;
    private $repository;

    public function __construct(Data\Customer $customer, Repository $repository)
    {
        $this->customer = $customer;
        $this->repository = $repository;
    }

    public function interact()
    {
        $this->repository->delete_customer($this->customer->id);
    }
}


text:
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">

		<title>DatePicker ACC Test - sap.m</title>
		<link rel="shortcut icon" type="image/x-icon" href="../images/controls/sap.m.DatePicker.gif">

		<link href="DatePicker.css" rel="stylesheet">
		<script src="../shared-config.js"></script>
		<script id="sap-ui-bootstrap"
				src="../../../../resources/sap-ui-core.js"
				data-sap-ui-async="true"
				data-sap-ui-compatVersion="edge"
				data-sap-ui-libs="sap.m"
				data-sap-ui-onInit="module:local/DatePicker"
				data-sap-ui-resourceRoots='{
					"local": "./",
					"qunit.internal.acc": "../../../../test-resources/sap/ui/core/qunit/internal/acc"
				}'>
		</script>
	</head>
	<body id="body" class="sapUiBody">
	</body>
</html>


text:
{% extends "budget/base.html" %}

{% block title %}
Categories
{% endblock %}

{% block content %}

    Create

            Name
            Actions

        {% for category in category_list %}

            {{ category.name }}

                Update
                Delete

        {% endfor %}

{% include "budget/pagination.html" %}
{% endblock %}


text:
<?xml version="1.0" encoding="utf-8"?>

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="horizontal"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="@dimen/small"
    android:textSize="14sp"
    tools:text="Aardvark"
    android:background="@drawable/white_touch"
    tools:context=".MainActivity"/>


text:
<?php

namespace app\assets;

use yii\web\AssetBundle;

/**
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class NProgressAsset extends AssetBundle
{

    public $sourcePath = '@bower/nprogress';

    public $css = [
        'nprogress.css'
    ];

    public $js = [
        'nprogress.js'
    ];

    public $depends = [
        'yii\web\JqueryAsset',
    ];
}