/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.apache.jmeter.exceptions;

/**
 */
public class IllegalUserActionException extends Exception {
    private static final long serialVersionUID = 240L;

    /**
     * @deprecated - use IllegalUserActionException(String)
     */
    @Deprecated // Needed for serialisation testing
    public IllegalUserActionException() {
        super();
    }

    public IllegalUserActionException(String name) {
        super(name);
    }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.apache.jmeter.exceptions;

/**
 */
public class IllegalUserActionException extends Exception {
    private static final long serialVersionUID = 240L;

    /**
     * @deprecated - use IllegalUserActionException(String)
     */
    @Deprecated // Needed for serialisation testing
    public IllegalUserActionException() {
        super();
    }

    public IllegalUserActionException(String name) {
        super(name);
    }

    public IllegalUserActionException(String name, Throwable t) {
        super(name, t);
    }

}

Allow original exception to be provided if necessary


package de.unibonn.iai.eis.diachron.qualitymetrics.utilities;

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

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sparql.core.Quad;

public class TestLoader {

	protected List<Quad> streamingQuads = new ArrayList<Quad>();
	protected Model m;

	/**
	 * Loads a sample dataset which can be used to test metrics
	 */
	public void loadDataSet() {

		String filename = this.getClass().getClassLoader().getResource("testdumps/160114.ttl").toExternalForm();
		//String filename = this.getClass().getClassLoader().getResource("testdumps/chembl-rdf-void.ttl").toExternalForm();

		m = ModelFactory.createDefaultModel();
		m.read(filename, "TTL");

		StmtIterator si = m.listStatements();
		while(si.hasNext()){
			this.streamingQuads.add(new Quad(null, si.next().asTriple()));
		}
	}

	public Model getM() {
		return m;
	}

	/**
	 * Returns a list of triples from the loaded dataset. This can be used
	 * to simulate the streaming of triples
	 * @return list of Triples
	 */
	public List<Quad> getStreamingQuads(){
		return this.streamingQuads;
	}
}

package de.unibonn.iai.eis.diachron.qualitymetrics.utilities;

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

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sparql.core.Quad;

public class TestLoader {

	protected List<Quad> streamingQuads = new ArrayList<Quad>();

	/**
	 * Loads a sample dataset which can be used to test metrics
	 */
	public void loadDataSet() {

		String filename = this.getClass().getClassLoader().getResource("testdumps/160114.ttl").toExternalForm();
		//String filename = this.getClass().getClassLoader().getResource("testdumps/chembl-rdf-void.ttl").toExternalForm();

		Model m = ModelFactory.createDefaultModel();
		m.read(filename, "TTL");

		StmtIterator si = m.listStatements();
		while(si.hasNext()){
			this.streamingQuads.add(new Quad(null, si.next().asTriple()));
		}
	}

	/**
	 * Returns a list of triples from the loaded dataset. This can be used
	 * to simulate the streaming of triples
	 * @return list of Triples
	 */
	public List<Quad> getStreamingQuads(){
		return this.streamingQuads;
	}
}

Revert "Changed Model Variable m to protected. Used corresponding getters. changes made because dataset needed for calculating amount of triples."


package uk.ac.ebi.quickgo.annotation.validation.loader;

/**
 * @author Tony Wardell
 * Date: 07/11/2016
 * Time: 18:16
 * Created with IntelliJ IDEA.
 *
 * Specify the layout of the DB_XREFS_ENTITIES.dat.gz file.
 * DATABASE        ENTITY_TYPE_ID  ENTITY_TYPE_NAME        LOCAL_ID_SYNTAX URL_SYNTAX
 *
 */
public enum DBXrefEntityColumns {

    COLUMN_DB(0),
    COLUMN_ENTITY_TYPE_ID(1),
    COLUMN_ENTITY_TYPE_NAME(2),
    COLUMN_LOCAL_ID_SYNTAX(3),
    COLUMN_URL_SYNTAX(4);

    private int position;

    DBXrefEntityColumns(int position) {
        this.position = position;
    }

    public int getPosition() {
        return position;
    }

    public static int numColumns() {
        return DBXrefEntityColumns.values().length;
    }

}

package uk.ac.ebi.quickgo.annotation.validation.loader;

/**
 * Specify the columns for Database Cross Reference file.
 *
 * @author Tony Wardell
 * Date: 07/11/2016
 * Time: 18:16
 * Created with IntelliJ IDEA.
 *
 * Specify the layout of the DB_XREFS_ENTITIES.dat.gz file.
 * DATABASE        ENTITY_TYPE_ID  ENTITY_TYPE_NAME        LOCAL_ID_SYNTAX URL_SYNTAX
 *
 */
public enum DBXrefEntityColumns {

    COLUMN_DB(0),
    COLUMN_ENTITY_TYPE_ID(1),
    COLUMN_ENTITY_TYPE_NAME(2),
    COLUMN_LOCAL_ID_SYNTAX(3),
    COLUMN_URL_SYNTAX(4);

    private final int position;

    DBXrefEntityColumns(int position) {
        this.position = position;
    }

    public int getPosition() {
        return position;
    }

    public static int numColumns() {
        return DBXrefEntityColumns.values().length;
    }

}

Add javadoc, make position final.


/*
 * Copyright 2006-2022 The MZmine Development Team
 *
 * This file is part of MZmine.
 *
 * MZmine is free software; you can redistribute it and/or modify it under the terms of the GNU
 * General Public License as published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * MZmine is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with MZmine; if not,
 * write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

package io.github.mzmine.modules.io.spectraldbsubmit.batch;

public enum SpectralLibraryExportFormats {
  json, msp;

  @Override
  public String toString() {
    return switch (this) {
      case json -> "GNPS json (recommended)";
      case msp -> "NIST msp";
    };
  }

  public String getExtension() {
    return switch (this) {
      case json -> "json";
      case msp -> "msp";
    };
  }
}

/*
 * Copyright (c) 2004-2022 The MZmine Development Team
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

package io.github.mzmine.modules.io.spectraldbsubmit.batch;

public enum SpectralLibraryExportFormats {
  json, msp;

  @Override
  public String toString() {
    return switch (this) {
      case json -> "MZmine json (recommended)";
      case msp -> "NIST msp";
    };
  }

  public String getExtension() {
    return switch (this) {
      case json -> "json";
      case msp -> "msp";
    };
  }
}

Change export format name to mzmine


package in.twizmwaz.cardinal.module.modules.regions.parsers;

import in.twizmwaz.cardinal.module.modules.regions.RegionParser;
import org.bukkit.util.Vector;
import org.jdom2.Element;

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

public class CuboidParser extends RegionParser {

    private final Vector min, max;

    public CuboidParser(Element element) {
        super(element.getAttributeValue("name"));
        List<String> values = new ArrayList<>();
        values.addAll(Arrays.asList(element.getAttributeValue("min").contains(",") ?
                element.getAttributeValue("min").trim().split(",") : element.getAttributeValue("min").trim().split(" ")));
        values.addAll(Arrays.asList(element.getAttributeValue("max").trim().replaceAll(" ", ",").split(",")));
        for (String string : values) {
            values.set(values.indexOf(string), string.trim());
            if (string.equalsIgnoreCase("oo")) values.set(values.indexOf(string), "256");
            if (string.equalsIgnoreCase("-oo")) values.set(values.indexOf(string), "0");
        }
        this.min = new Vector(Double.parseDouble(values.get(0)), Double.parseDouble(values.get(1)), Double.parseDouble(values.get(2)));
        this.max = new Vector(Double.parseDouble(values.get(3)), Double.parseDouble(values.get(4)), Double.parseDouble(values.get(5)));
    }

    public Vector getMin() {
        return min;
    }

    public Vector getMax() {
        return max;
    }
}

package in.twizmwaz.cardinal.module.modules.regions.parsers;

import in.twizmwaz.cardinal.module.modules.regions.RegionParser;
import in.twizmwaz.cardinal.util.NumUtils;
import org.bukkit.util.Vector;
import org.jdom2.Element;

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

public class CuboidParser extends RegionParser {

    private final Vector min, max;

    public CuboidParser(Element element) {
        super(element.getAttributeValue("name"));
        List<String> values = new ArrayList<>();
        values.addAll(Arrays.asList(element.getAttributeValue("min").contains(",") ?
                element.getAttributeValue("min").trim().split(",") : element.getAttributeValue("min").trim().split(" ")));
        values.addAll(Arrays.asList(element.getAttributeValue("max").trim().replaceAll(" ", ",").split(",")));
        for (String string : values) {
            values.set(values.indexOf(string), string.trim());
        }
        this.min = new Vector(NumUtils.parseDouble(values.get(0)), NumUtils.parseDouble(values.get(1)), NumUtils.parseDouble(values.get(2)));
        this.max = new Vector(NumUtils.parseDouble(values.get(3)), NumUtils.parseDouble(values.get(4)), NumUtils.parseDouble(values.get(5)));
    }

    public Vector getMin() {
        return min;
    }

    public Vector getMax() {
        return max;
    }
}

Fix cuboid regions not extending all the way to negative infinity


/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.lang3.test;

/**
 * Allows for testing an exception that is not visible to
 * {@link org.apache.commons.lang3.exception.ExceptionUtils}
 */
public class NotVisibleExceptionFactory {

  private NotVisibleExceptionFactory() {}

  /**
   * Create a new Exception whose getCause method returns the
   * provided cause.
   * @param cause the cause of the exception
   * @return a new {@link Exception}
   */
  public static Exception createException(final Throwable cause) {
    return new NotVisibleException(cause);
  }

  private static class NotVisibleException extends Exception {

    private static final long serialVersionUID = 1L; // avoid warning

    private final Throwable cause;

    private NotVisibleException(final Throwable cause) {
      this.cause = cause;
    }

    @Override
    public Throwable getCause() {
      return cause;
    }
  }
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.lang3.test;

/**
 * Allows for testing an exception that is not visible to
 * {@link org.apache.commons.lang3.exception.ExceptionUtils}
 */
public class NotVisibleExceptionFactory {

  private NotVisibleExceptionFactory() {}

  /**
   * Create a new Exception whose getCause method returns the
   * provided cause.
   * @param cause the cause of the exception
   * @return a new {@link Exception}
   */
  public static Exception createException(final Throwable cause) {
    return new NotVisibleException(cause);
  }

  private static class NotVisibleException extends Exception {

    private static final long serialVersionUID = 1L; // avoid warning

    private final Throwable cause;

    private NotVisibleException(final Throwable cause) {
      this.cause = cause;
    }

    @Override
    public synchronized Throwable getCause() {
      return cause;
    }
  }
}

Document unused type parameter for tests


package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

package com.thaiopensource.resolver;

import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.io.IOException;

/**
 *
 */
public class BasicResolver implements Resolver {
  static private final BasicResolver theInstance = new BasicResolver();

  protected BasicResolver() {
  }

  public static BasicResolver getInstance() {
    return theInstance;
  }

  public void resolve(Identifier id, Input input) throws IOException, ResolverException {
    if (!input.isResolved())
      input.setUri(resolveUri(id));
  }

  public void open(Input input) throws IOException, ResolverException {
    if (!input.isUriDefinitive())
      return;
    URI uri;
    try {
      uri = new URI(input.getUri());
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
    if (!uri.isAbsolute())
      throw new ResolverException("cannot open relative URI: " + uri);
    URL url = new URL(uri.toASCIIString());
    // XXX should set the encoding properly
    // XXX if this is HTTP and we've been redirected, should do input.setURI with the new URI
    input.setByteStream(url.openStream());
  }

  public static String resolveUri(Identifier id) throws ResolverException {
    try {
      URI uri = new URI(id.getUriReference());
      String base = id.getBase();
      if (base != null)
        uri = new URI(base).resolve(uri);
      return uri.toString();
    }
    catch (URISyntaxException e) {
      throw new ResolverException(e);
    }
  }
}

Add note that we need to handle HTTP redirection


package org.verapdf.model.impl.pb.operator.textposition;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.operator.Op_TD_Big;

import java.util.List;

/**
 * @author Evgeniy Muravitskiy
 */
public class PBOp_TD_Big extends PBOp_General_Td implements Op_TD_Big {

	public static final String OP_TD_BIG_TYPE = "Op_Td_Big";

	public PBOp_TD_Big(List<COSBase> arguments) {
		super(arguments);
		setType(OP_TD_BIG_TYPE);
	}
}

package org.verapdf.model.impl.pb.operator.textposition;

import org.apache.pdfbox.cos.COSBase;
import org.verapdf.model.operator.Op_TD_Big;

import java.util.List;

/**
 * @author Evgeniy Muravitskiy
 */
public class PBOp_TD_Big extends PBOp_General_Td implements Op_TD_Big {

	public static final String OP_TD_BIG_TYPE = "Op_TD_Big";

	public PBOp_TD_Big(List<COSBase> arguments) {
		super(arguments);
		setType(OP_TD_BIG_TYPE);
	}
}

Change type Name for TD operator


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_14r1_14r2;

import protocolsupport.protocol.ConnectionImpl;
import protocolsupport.protocol.packet.PacketType;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleInventoryHorseOpen;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.packet.middleimpl.IPacketData;
import protocolsupport.protocol.serializer.VarNumberSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class InventoryHorseOpen extends MiddleInventoryHorseOpen {

	public InventoryHorseOpen(ConnectionImpl connection) {
		super(connection);
	}

	@Override
	public RecyclableCollection<? extends IPacketData> toData() {
		ClientBoundPacketData horseopen = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_WINDOW_HORSE_OPEN);
		horseopen.writeByte(windowId);
		VarNumberSerializer.writeVarInt(horseopen, windowId);
		horseopen.writeInt(entityId);
		return RecyclableSingletonList.create(horseopen);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_14r1_14r2;

import protocolsupport.protocol.ConnectionImpl;
import protocolsupport.protocol.packet.PacketType;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleInventoryHorseOpen;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.packet.middleimpl.IPacketData;
import protocolsupport.protocol.serializer.VarNumberSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class InventoryHorseOpen extends MiddleInventoryHorseOpen {

	public InventoryHorseOpen(ConnectionImpl connection) {
		super(connection);
	}

	@Override
	public RecyclableCollection<? extends IPacketData> toData() {
		ClientBoundPacketData horseopen = ClientBoundPacketData.create(PacketType.CLIENTBOUND_PLAY_WINDOW_HORSE_OPEN);
		horseopen.writeByte(windowId);
		VarNumberSerializer.writeVarInt(horseopen, slots);
		horseopen.writeInt(entityId);
		return RecyclableSingletonList.create(horseopen);
	}

}

Fix hrose inventory open for 1.14+


// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.gerrit.reviewdb;

import com.google.gwtorm.client.Access;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.PrimaryKey;
import com.google.gwtorm.client.Query;
import com.google.gwtorm.client.ResultSet;
import com.google.gwtorm.client.SecondaryKey;

public interface ApprovalCategoryAccess extends
    Access<ApprovalCategory, ApprovalCategory.Id> {
  @PrimaryKey("categoryId")
  ApprovalCategory get(ApprovalCategory.Id id) throws OrmException;

  @SecondaryKey("name")
  ApprovalCategory byName(String name) throws OrmException;

  @Query("ORDER BY position, name")
  ResultSet<ApprovalCategory> all() throws OrmException;
}

// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.gerrit.reviewdb;

import com.google.gwtorm.client.Access;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.PrimaryKey;
import com.google.gwtorm.client.Query;
import com.google.gwtorm.client.ResultSet;

public interface ApprovalCategoryAccess extends
    Access<ApprovalCategory, ApprovalCategory.Id> {
  @PrimaryKey("categoryId")
  ApprovalCategory get(ApprovalCategory.Id id) throws OrmException;

  @Query("ORDER BY position, name")
  ResultSet<ApprovalCategory> all() throws OrmException;
}

Remove unused byName @SecondaryKey from ApprovalCategory


/*
 * Copyright (c) 2016 Armel Soro
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package org.rm3l.maoni.sample;

import android.app.Application;

import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary;

public class MaoniSampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            LeakCanary.install(this);
            Stetho.initializeWithDefaults(this);
        }
    }
}

/*
 * Copyright (c) 2016 Armel Soro
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package org.rm3l.maoni.sample;

import android.app.Application;

import com.facebook.stetho.Stetho;

public class MaoniSampleApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        if (BuildConfig.DEBUG) {
            Stetho.initializeWithDefaults(this);
        }
    }
}

Remove explicit installation of LeakCanary


package edu.oakland.OUSoft.linkedList;

import static org.junit.Assert.*;

/**
 * Created on 3/15/17.
 */
public class cseSortedArrayLinkedListTest {
	@org.junit.Test
	public void add() throws Exception {

	}

	@org.junit.Test
	public void add1() throws Exception {

	}

}

package edu.oakland.OUSoft.linkedList;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class cseSortedArrayLinkedListTest {

	private cseSortedArrayLinkedList<Integer> list;

	@Before
	public void setUp() throws Exception {
		list = new cseSortedArrayLinkedList<>(6);
	}

	@Test
	public void add() throws Exception {
		assertTrue(list.add(10));
		assertTrue(list.contains(10));
		assertEquals((Object) 10, list.get(0));
		assertEquals(1, list.size());

		assertTrue(list.add(5));
		assertTrue(list.contains(5));
		assertEquals((Object) 5, list.get(0));
		assertEquals((Object) 10, list.get(1));
		assertEquals(2, list.size());

		assertTrue(list.add(1));
		assertTrue(list.contains(1));
		assertEquals((Object) 1, list.get(0));
		assertEquals((Object) 5, list.get(1));
		assertEquals((Object) 10, list.get(2));
		assertEquals(3, list.size());

		assertTrue(list.add(20));
		assertEquals((Object) 1, list.get(0));
		assertEquals((Object) 5, list.get(1));
		assertEquals((Object) 10, list.get(2));
		assertEquals((Object) 20, list.get(3));
		assertEquals(4, list.size());

		assertTrue(list.add(1));
		assertEquals((Object) 1, list.get(0));
		assertEquals((Object) 1, list.get(1));
		assertEquals((Object) 5, list.get(2));
		assertEquals((Object) 10, list.get(3));
		assertEquals((Object) 20, list.get(4));
		assertEquals(5, list.size());

		assertTrue(list.add(7));
		assertEquals((Object) 1, list.get(0));
		assertEquals((Object) 1, list.get(1));
		assertEquals((Object) 5, list.get(2));
		assertEquals((Object) 7, list.get(3));
		assertEquals((Object) 10, list.get(4));
		assertEquals((Object) 20, list.get(5));
		assertEquals(6, list.size());
	}
}

Make test for sorted array linked list


package ca.corefacility.bioinformatics.irida.ria.integration.utilities;

import org.openqa.selenium.WebDriver;

import ca.corefacility.bioinformatics.irida.ria.integration.pages.remoteapi.CreateRemoteAPIPage;
import ca.corefacility.bioinformatics.irida.ria.integration.pages.remoteapi.RemoteAPIDetailsPage;

import static org.junit.Assert.assertTrue;

public class RemoteApiUtilities {
	protected static final String BASE_URL =
			System.getProperty("server.base.url", "http://localhost:" + System.getProperty("jetty.port", "8080")) + "/";

	public static void addRemoteApi(WebDriver driver, String clientId, String clientSecret) {
		CreateRemoteAPIPage page = new CreateRemoteAPIPage(driver);

		String baseUrl = page.getBaseUrl();
		String url = baseUrl + "api";

		page.createRemoteAPIWithDetails("new name", url, clientId, clientSecret);

		RemoteAPIDetailsPage remoteAPIDetailsPage = RemoteAPIDetailsPage.gotoDetailsPage(driver);

		remoteAPIDetailsPage.clickConnect();
		remoteAPIDetailsPage.clickAuthorize();

		assertTrue("api status should be connected", remoteAPIDetailsPage.isRemoteAPIConnected());
	}

	/**
	 * Get the location of the OAuth redirect URI for this test server.
	 *
	 * @return The oauth/authorization/token location for this server
	 */
	public static String getRedirectLocation() {
		return BASE_URL + "api/oauth/authorization/token";
	}
}

package ca.corefacility.bioinformatics.irida.ria.integration.utilities;

import org.openqa.selenium.WebDriver;

import ca.corefacility.bioinformatics.irida.ria.integration.pages.remoteapi.CreateRemoteAPIPage;
import ca.corefacility.bioinformatics.irida.ria.integration.pages.remoteapi.RemoteAPIDetailsPage;

import static org.junit.Assert.assertTrue;

public class RemoteApiUtilities {
	protected static final String BASE_URL =
			System.getProperty("server.base.url", "http://localhost:" + System.getProperty("server.port", "8080")) + "/";

	public static void addRemoteApi(WebDriver driver, String clientId, String clientSecret) {
		CreateRemoteAPIPage page = new CreateRemoteAPIPage(driver);

		String baseUrl = page.getBaseUrl();
		String url = baseUrl + "api";

		page.createRemoteAPIWithDetails("new name", url, clientId, clientSecret);

		RemoteAPIDetailsPage remoteAPIDetailsPage = RemoteAPIDetailsPage.gotoDetailsPage(driver);

		remoteAPIDetailsPage.clickConnect();
		remoteAPIDetailsPage.clickAuthorize();

		assertTrue("api status should be connected", remoteAPIDetailsPage.isRemoteAPIConnected());
	}

	/**
	 * Get the location of the OAuth redirect URI for this test server.
	 *
	 * @return The oauth/authorization/token location for this server
	 */
	public static String getRedirectLocation() {
		return BASE_URL + "api/oauth/authorization/token";
	}
}

Remove last reference to jetty.port in the code.


/*
 * Copyright Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.samples.quickstart.analytics;

import android.app.Application;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Logger;
import com.google.android.gms.analytics.Tracker;

/**
 * This is a subclass of {@link Application} used to provide shared objects for this app, such as
 * the {@link Tracker}.
 */
public class AnalyticsApplication extends Application {
  private Tracker mTracker;

  /**
   * Gets the default {@link Tracker} for this {@link Application}.
   * @return tracker
   */
  synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
      GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
      analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
      mTracker = analytics.newTracker(R.xml.tracker);
    }
    return mTracker;
  }
}

/*
 * Copyright Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.samples.quickstart.analytics;

import android.app.Application;

import com.google.android.gms.analytics.GoogleAnalytics;
import com.google.android.gms.analytics.Logger;
import com.google.android.gms.analytics.Tracker;

/**
 * This is a subclass of {@link Application} used to provide shared objects for this app, such as
 * the {@link Tracker}.
 */
public class AnalyticsApplication extends Application {
  private Tracker mTracker;

  /**
   * Gets the default {@link Tracker} for this {@link Application}.
   * @return tracker
   */
  synchronized public Tracker getDefaultTracker() {
    if (mTracker == null) {
      GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
      analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
      mTracker = analytics.newTracker(R.xml.global_tracker);
    }
    return mTracker;
  }
}

Move to generated tracker name


package ca.six.unittestapp.todo;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import ca.six.unittestapp.todo.data.source.TasksRepositoryTest;
import ca.six.unittestapp.todo.statistics.StatisticsPresenterTest;
import ca.six.unittestapp.todo.taskdetail.TaskDetailPresenterTest;
import ca.six.unittestapp.todo.tasks.TasksPresenterTest;

/**
 * @author hellenxu
 * @date 2017-09-23
 * Copyright 2017 Six. All rights reserved.
 */

@RunWith(Suite.class)
@Suite.SuiteClasses({TasksRepositoryTest.class, StatisticsPresenterTest.class,
        TaskDetailPresenterTest.class, TasksPresenterTest.class})
public class TodoUnitTestSuite {
}

package ca.six.unittestapp.todo;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import ca.six.unittestapp.todo.addedittask.AddEditTaskPresenterTest;
import ca.six.unittestapp.todo.data.source.TasksRepositoryTest;
import ca.six.unittestapp.todo.statistics.StatisticsPresenterTest;
import ca.six.unittestapp.todo.taskdetail.TaskDetailPresenterTest;
import ca.six.unittestapp.todo.tasks.TasksPresenterTest;

/**
 * @author hellenxu
 * @date 2017-09-23
 * Copyright 2017 Six. All rights reserved.
 */

@RunWith(Suite.class)
@Suite.SuiteClasses({AddEditTaskPresenterTest.class, TasksRepositoryTest.class,
        StatisticsPresenterTest.class, TaskDetailPresenterTest.class, TasksPresenterTest.class})
public class TodoUnitTestSuite {
}

Add AddEditTaskPresenter into test suite.


/*
 * Copyright 2012-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.context.embedded.tomcat;

import org.apache.catalina.Container;
import org.apache.catalina.core.StandardContext;

/**
 * Tomcat {@link StandardContext} used by {@link TomcatEmbeddedServletContainer} to
 * support deferred initialization.
 *
 * @author Phillip Webb
 */
class TomcatEmbeddedContext extends StandardContext {

	@Override
	public void loadOnStartup(Container[] children) {
	}

	public void deferredLoadOnStartup() {
		super.loadOnStartup(findChildren());
	}

}

/*
 * Copyright 2012-2014 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.context.embedded.tomcat;

import org.apache.catalina.Container;
import org.apache.catalina.core.StandardContext;
import org.springframework.util.ClassUtils;

/**
 * Tomcat {@link StandardContext} used by {@link TomcatEmbeddedServletContainer} to
 * support deferred initialization.
 *
 * @author Phillip Webb
 */
class TomcatEmbeddedContext extends StandardContext {

	@Override
	public void loadOnStartup(Container[] children) {
	}

	public void deferredLoadOnStartup() {
		// Some older Servlet frameworks (e.g. Struts, BIRT) use the Thread context class
		// loader to create servlet instances in this phase. If they do that and then try
		// to initialize them later the class loader may have changed, so wrap the call to
		// loadOnStartup in what we think its going to be the main webapp classloader at
		// runtime.
		ClassLoader classLoader = getLoader().getClassLoader();
		ClassLoader existingLoader = null;
		if (classLoader != null) {
			existingLoader = ClassUtils.overrideThreadContextClassLoader(classLoader);
		}
		super.loadOnStartup(findChildren());
		if (existingLoader != null) {
			ClassUtils.overrideThreadContextClassLoader(existingLoader);
		}
	}

}

Set Thread context class loader while Tomcat starts up


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.StudySegment;

/**
 * @author Moses Hohman
 * @author Rhett Sutphin
 */
public class StudySegmentDao extends StudyCalendarMutableDomainObjectDao<StudySegment> {
    @Override
    public Class<StudySegment> domainClass() {
        return StudySegment.class;
    }

    public void delete(StudySegment segment) {
        getHibernateTemplate().delete(segment);
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.StudySegment;

/**
 * @author Moses Hohman
 * @author Rhett Sutphin
 */
public class StudySegmentDao extends StudyCalendarMutableDomainObjectDao<StudySegment> {
    @Override
    public Class<StudySegment> domainClass() {
        return StudySegment.class;
    }

    /**
     * Deletes the given study segment
     *
     * @param  segment the study segment to delete
     */
    public void delete(StudySegment segment) {
        getHibernateTemplate().delete(segment);
    }
}

Add javadoc to study segment dao.


package uk.gov.register.filters;

import com.google.common.net.HttpHeaders;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;

@Provider
public class ContentSecurityPolicyFilter implements ContainerResponseFilter {
    @Override
    public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
        responseContext.getHeaders().add(HttpHeaders.CONTENT_SECURITY_POLICY, "default-src 'self'");
    }
}

package uk.gov.register.filters;

import com.google.common.net.HttpHeaders;

import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;

@Provider
public class ContentSecurityPolicyFilter implements ContainerResponseFilter {
    @Override
    public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException {
        responseContext.getHeaders().add(HttpHeaders.CONTENT_SECURITY_POLICY, "default-src 'self' www.google-analytics.com");
    }
}

Enable google analytics in content security policy filter


package htmlflow;

import java.io.PrintStream;

public interface HtmlWriter<T>{
	/**
	 * Writes into an internal PrintStream the HTML content
	 * of this element with initial indentation of zero.
	 *
	 * @param model An optional object model that could be bind to this element.
	 */
	default void write(T model) {
		write(0, model);
	}
	/**
	 * Writes into an internal PrintStream the HTML content
	 * of this element.
	 *
	 * @param depth The number of tabs indentation.
	 * @param model An optional object model that could be bind to this element.
	 */
	void write(int depth, T model);

	/**
	 * Sets the current PrintStream.
	 * @param out
	 */
	HtmlWriter<T> setPrintStream(PrintStream out);
}

package htmlflow;

import java.io.PrintStream;

public interface HtmlWriter<T>{
	/**
	 * Writes into an internal PrintStream the HTML content
	 * of this element with zero indentation and without a
	 * domain object.
	 */
	default void write() {
		write(0, null);
	}
	/**
	 * Writes into an internal PrintStream the HTML content
	 * of this element with initial indentation of zero.
	 *
	 * @param model An optional object model that could be bind to this element.
	 */
	default void write(T model) {
		write(0, model);
	}
	/**
	 * Writes into an internal PrintStream the HTML content
	 * of this element.
	 *
	 * @param depth The number of tabs indentation.
	 * @param model An optional object model that could be bind to this element.
	 */
	void write(int depth, T model);

	/**
	 * Sets the current PrintStream.
	 * @param out
	 */
	HtmlWriter<T> setPrintStream(PrintStream out);
}

Add a parameterless write() method


/*
 * Copyright 2012 Ecwid, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ecwid.mailchimp.method.helper;

import java.util.List;
import com.ecwid.mailchimp.MailChimpMethod;

/**
 * See http://apidocs.mailchimp.com/api/1.3/getaccountdetails.func.php
 *
 * @author Matt Farmer <matt@frmr.me>
 */
@MailChimpMethod.Name("getAccountDetails")
public class GetAccountDetailsMethod extends MailChimpMethod<AccountDetails> {

	@Field
	public String apikey;

	@Field
	public List<String> exclude;

	@Override
	public Class<AccountDetails> getResultType() {
		return AccountDetails.class;
	}
}

/*
 * Copyright 2012 Ecwid, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.ecwid.mailchimp.method.helper;

import java.util.List;
import com.ecwid.mailchimp.MailChimpMethod;

/**
 * See http://apidocs.mailchimp.com/api/1.3/getaccountdetails.func.php
 *
 * @author Matt Farmer <matt@frmr.me>
 */
@MailChimpMethod.Name("getAccountDetails")
public class GetAccountDetailsMethod extends MailChimpMethod<AccountDetails> {

	@Field
	public List<String> exclude;

	@Override
	public Class<AccountDetails> getResultType() {
		return AccountDetails.class;
	}
}

Remove api key field from GetACcountDetailsMethod.


package io.quarkus.it.bouncycastle;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class BouncyCastleJsseITCase extends BouncyCastleJsseTestCase {
    @Test
    @Override
    public void testListProviders() {
        doTestListProviders();
        checkLog(true);
    }
}

package io.quarkus.it.bouncycastle;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.DisabledOnNativeImage;
import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class BouncyCastleJsseITCase extends BouncyCastleJsseTestCase {
    @Test
    @DisabledOnNativeImage
    @Override
    public void testListProviders() {
        doTestListProviders();
        checkLog(true);
    }
}

Disable Bouncycastle JSSE native test


/*
 * Copyright 2015-2017 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.junit.platform.engine.support.hierarchical;

import java.util.HashSet;
import java.util.Set;

import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.UniqueId;

/**
 * @since 1.0
 */
class ExecutionTracker {

	private final Set<UniqueId> executedUniqueIds = new HashSet<>();

	void markExecuted(TestDescriptor testDescriptor) {
		executedUniqueIds.add(testDescriptor.getUniqueId());
	}

	boolean wasAlreadyExecuted(TestDescriptor testDescriptor) {
		return executedUniqueIds.contains(testDescriptor.getUniqueId());
	}
}

/*
 * Copyright 2015-2017 the original author or authors.
 *
 * All rights reserved. This program and the accompanying materials are
 * made available under the terms of the Eclipse Public License v1.0 which
 * accompanies this distribution and is available at
 *
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.junit.platform.engine.support.hierarchical;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.junit.platform.engine.TestDescriptor;
import org.junit.platform.engine.UniqueId;

/**
 * @since 1.0
 */
class ExecutionTracker {

	private final Set<UniqueId> executedUniqueIds = ConcurrentHashMap.newKeySet();

	void markExecuted(TestDescriptor testDescriptor) {
		executedUniqueIds.add(testDescriptor.getUniqueId());
	}

	boolean wasAlreadyExecuted(TestDescriptor testDescriptor) {
		return executedUniqueIds.contains(testDescriptor.getUniqueId());
	}
}

Use ConcurrentHashMap for possible concurrent execution in the future


/**
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.elasticsearch.plugin.querytemplate;

import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.script.querytemplate.QueryTemplateEngineService;

/**
 * Plugin to enable referencing query templates and parameters.
 *
 * This class is also referenced in the plugin configuration - make sure
 * you change the class name in src/main/resources/es.plugin.properties
 * when refactoring this class to a different name.
 */
public class QueryTemplatePlugin extends AbstractPlugin {

    @Override
    public String name() {
        return "query-template";
    }

    @Override
    public String description() {
        return "Query template plugin allowing to add reference queries by template name";
    }

    public void onModule(ScriptModule module) {
        module.addScriptEngine(QueryTemplateEngineService.class);
    }
}

/**
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.elasticsearch.plugin.querytemplate;

import org.elasticsearch.plugins.AbstractPlugin;

/**
 * Plugin to enable referencing query templates and parameters.
 *
 * This class is also referenced in the plugin configuration - make sure
 * you change the class name in src/main/resources/es.plugin.properties
 * when refactoring this class to a different name.
 */
public class QueryTemplatePlugin extends AbstractPlugin {

    @Override
    public String name() {
        return "query-template";
    }

    @Override
    public String description() {
        return "Query template plugin allowing to add reference queries by template name";
    }

//    public void onModule() {

//    }
}

Remove onModule method that is no longer needed.


/*
 * Copyright 2017-2018, EnMasse authors.
 * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
 */
package io.enmasse.controller.common;

import io.enmasse.address.model.AuthenticationService;
import io.enmasse.address.model.AuthenticationServiceResolver;

import java.util.Optional;

/**
 * Resolves the none authentication service host name.
 */
public class StandardAuthenticationServiceResolver implements AuthenticationServiceResolver {
    private final String host;
    private final int port;

    public StandardAuthenticationServiceResolver(String host, int port) {
        this.host = host;
        this.port = port;
    }

    @Override
    public String getHost(AuthenticationService authService) {
        return host;
    }

    @Override
    public int getPort(AuthenticationService authService) {
        return port;
    }

    @Override
    public Optional<String> getCaSecretName(AuthenticationService authService) {
        return Optional.of("standard-authservice-cert");
    }

    @Override
    public Optional<String> getClientSecretName(AuthenticationService authService) {
        return Optional.empty();
    }

    @Override
    public Optional<String> getSaslInitHost(String addressSpaceName, AuthenticationService authService) {
        return Optional.of(addressSpaceName);
    }
}

/*
 * Copyright 2017-2018, EnMasse authors.
 * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
 */
package io.enmasse.controller.common;

import io.enmasse.address.model.AuthenticationService;
import io.enmasse.address.model.AuthenticationServiceResolver;

import java.util.Optional;

/**
 * Resolves the none authentication service host name.
 */
public class StandardAuthenticationServiceResolver implements AuthenticationServiceResolver {
    private final String host;
    private final int port;

    public StandardAuthenticationServiceResolver(String host, int port) {
        this.host = host;
        this.port = port;
    }

    @Override
    public String getHost(AuthenticationService authService) {
        String overrideHost = (String) authService.getDetails().get("host");
        if (overrideHost != null) {
            return overrideHost;
        } else {
            return host;
        }
    }

    @Override
    public int getPort(AuthenticationService authService) {
        String overridePort = (String) authService.getDetails().get("port");
        if (overridePort != null) {
            return Integer.parseInt(overridePort);
        } else {
            return port;
        }
    }

    @Override
    public Optional<String> getCaSecretName(AuthenticationService authService) {
        return Optional.of("standard-authservice-cert");
    }

    @Override
    public Optional<String> getClientSecretName(AuthenticationService authService) {
        return Optional.empty();
    }

    @Override
    public Optional<String> getSaslInitHost(String addressSpaceName, AuthenticationService authService) {
        return Optional.of(addressSpaceName);
    }
}

Allow standard authservice host port to be overridden


/*
 * Copyright 2017 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.samples.apps.iosched.server.schedule.reservations.model;

/**
 * Representation of a Reservation object in RTDB.
 */
public class Reservation implements Comparable<Reservation> {

  public long last_status_changed;
  public String status;

  @Override
  public int compareTo(Reservation reservation) {
    if (last_status_changed < reservation.last_status_changed) {
      return -1;
    } else if (last_status_changed > reservation.last_status_changed) {
      return 1;
    }
    return 0;
  }
}

/*
 * Copyright 2017 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.samples.apps.iosched.server.schedule.reservations.model;

import java.util.Map;

/**
 * Representation of a Reservation object in RTDB.
 */
public class Reservation implements Comparable<Reservation> {

  public long last_status_changed;
  public String status;
  public Map<String, String> results;

  @Override
  public int compareTo(Reservation reservation) {
    if (last_status_changed < reservation.last_status_changed) {
      return -1;
    } else if (last_status_changed > reservation.last_status_changed) {
      return 1;
    }
    return 0;
  }
}

Add results to LoadSessionServlet model.


package fi.nls.oskari.spring.security.database;

import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;
import fi.nls.oskari.spring.security.OskariUserHelper;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Hooks in OskariUserHelper.onAuthenticationSuccess(). Extends different Spring class than the similar class
 * in SAML package.
 */
public class OskariAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
    private Logger log = LogFactory.getLogger(OskariAuthenticationSuccessHandler.class);
    private OskariUserHelper helper = new OskariUserHelper();

    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
            throws IOException, javax.servlet.ServletException {
        log.debug("Database based login successful:", authentication.getPrincipal());
        super.onAuthenticationSuccess(request, response, authentication);
        helper.onAuthenticationSuccess(request, response, authentication);
    }
}

package fi.nls.oskari.spring.security.database;

import fi.nls.oskari.log.LogFactory;
import fi.nls.oskari.log.Logger;
import fi.nls.oskari.spring.security.OskariUserHelper;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Hooks in OskariUserHelper.onAuthenticationSuccess(). Extends different Spring class than the similar class
 * in SAML package.
 */
public class OskariAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
    private Logger log = LogFactory.getLogger(OskariAuthenticationSuccessHandler.class);
    private OskariUserHelper helper = new OskariUserHelper();
    public OskariAuthenticationSuccessHandler() {
        super();
        setUseReferer(true);
    }

    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)
            throws IOException, javax.servlet.ServletException {
        log.debug("Database based login successful:", authentication.getPrincipal());
        super.onAuthenticationSuccess(request, response, authentication);
        helper.onAuthenticationSuccess(request, response, authentication);
    }
}

Use referer to detect where to take the user after login


package com.opcoach.training.e4.codesamples;

import javax.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.wizard.Wizard;

public class SampleWizard extends Wizard
{
	private SampleWizardPage firstPage = null;

	private IEclipseContext context;

    @Inject
	public SampleWizard(IEclipseContext ctx)
	{
		setWindowTitle("New Wizard");
		context = ctx;
	}

	@Override
	public void addPages()
	{
		firstPage = ContextInjectionFactory.make(SampleWizardPage.class, context);
		addPage(firstPage);
	}

	@Override
	public boolean performFinish()
	{
		// Do your stuff here by asking the pages...
		return true;
	}

}

package com.opcoach.training.e4.codesamples;

import javax.inject.Inject;

import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.jface.wizard.Wizard;

public class SampleWizard extends Wizard
{
	private SampleWizardPage firstPage = null;
	private IEclipseContext context;

    @Inject
	public SampleWizard(IEclipseContext ctx)
	{
		setWindowTitle("New Wizard");
		context = ctx;
	}

	@Override
	public void addPages()
	{
		firstPage = ContextInjectionFactory.make(SampleWizardPage.class, context);
		addPage(firstPage);
	}

	@Override
	public void dispose()
	{
		// Don't forget to uninject pages created with make !
		ContextInjectionFactory.uninject(firstPage, context);
		super.dispose();
	}

	@Override
	public boolean performFinish()
	{
		// Do your stuff here by asking the pages...
		// Use an AntRunner to create projects structures or to manipulate files !
		return true;
	}
}

Add an uninject in the wizard dispose


package ir_course;

/**
 * Created by martin on 4/9/14.
 */
public class SearchSuite {

    public static final String corpusPath = "corpus_part2.xml";
    private static String[] defaults = {corpusPath};
    public static final String BM25 = "bm25";
    private static String[] bm25Standard = {corpusPath, BM25};
    public static final String PORTER = "PORTER";
    private static String[] bm25Porter = {corpusPath, BM25, PORTER};
    private static String[] vsmPorter = {corpusPath, PORTER};
    public static final String SIMPLE = "SIMPLE";
    private static String[] vsmSimple = {corpusPath, SIMPLE};
    private static String[] bm25Simple = {corpusPath, BM25, SIMPLE};
    public static void main(String[] args) {
        LuceneSearchApp app = new LuceneSearchApp();
        app.main(defaults);
        app.main(bm25Standard);
        app.main(bm25Porter);
        app.main(bm25Simple);
        app.main(vsmSimple);
        app.main(vsmPorter);
    }
}

package ir_course;

/**
 * Created by martin on 4/9/14.
 */
public class SearchSuite {

    public static final String corpusPath = "corpus_part2.xml";
    private static String[] defaults = {corpusPath};
    public static final String BM25 = "bm25";
    private static String[] bm25Standard = {corpusPath, BM25};
    public static final String PORTER = "PORTER";
    private static String[] bm25Porter = {corpusPath, BM25, PORTER};
    private static String[] vsmPorter = {corpusPath, PORTER};
    public static final String SIMPLE = "SIMPLE";
    private static String[] vsmSimple = {corpusPath, SIMPLE};
    private static String[] bm25Simple = {corpusPath, BM25, SIMPLE};
    public static void main(String[] args) {
        LuceneSearchApp app = new LuceneSearchApp();
        app.main(defaults);
        app.main(bm25Standard);
        app.main(bm25Porter);
        app.main(bm25Simple);
        app.main(vsmSimple);
        app.main(vsmPorter);

        runCombination(app, "BM25", defaults, bm25Standard, bm25Porter, bm25Simple, vsmSimple, vsmPorter);
    }

    public static void runCombination(LuceneSearchApp app, String label, String[]... tests) {
    	for( String[] test : tests) {
    		// TODO: print label here
    		app.main(test);
    	}
    }
}

Add combination code to runner


/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.journal.noop;

import alluxio.master.journal.Journal;
import alluxio.proto.journal.Journal.JournalEntry;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * Implementation of {@link Journal} that does nothing.
 */
public class NoopJournal implements Journal {

  /**
   * Creates a new instance of {@link NoopJournal}.
   */
  public NoopJournal() {}

  @Override
  public URI getLocation() {
    try {
      return new URI("/noop");
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }

  @Override
  public void write(JournalEntry entry) throws IOException {}

  @Override
  public void flush() throws IOException {}

  @Override
  public void close() throws IOException {}
}

/*
 * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
 * (the "License"). You may not use this work except in compliance with the License, which is
 * available at www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied, as more fully set forth in the License.
 *
 * See the NOTICE file distributed with this work for information regarding copyright ownership.
 */

package alluxio.master.journal.noop;

import alluxio.master.journal.Journal;
import alluxio.master.journal.JournalContext;
import alluxio.master.journal.NoopJournalContext;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * Implementation of {@link Journal} that does nothing.
 */
public class NoopJournal implements Journal {

  /**
   * Creates a new instance of {@link NoopJournal}.
   */
  public NoopJournal() {}

  @Override
  public URI getLocation() {
    try {
      return new URI("/noop");
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
  }

  @Override
  public JournalContext createJournalContext() {
    return new NoopJournalContext();
  }

  @Override
  public void close() throws IOException {}
}

Update noop journal to use JournalContext


package org.ds.chronos.aws;

import org.ds.chronos.api.Chronicle;
import org.ds.chronos.api.PartitionPeriod;
import org.ds.chronos.api.PartitionedChronicle;

import com.amazonaws.services.s3.AmazonS3Client;

public class S3ParitionedChronicle extends PartitionedChronicle {

	final AmazonS3Client client;
	final String bucket;

	public S3ParitionedChronicle(AmazonS3Client client, String bucket, String keyPrefix, PartitionPeriod period) {
		super(keyPrefix, period);
		this.client = client;
		this.bucket = bucket;
	}

	@Override
  protected Chronicle getPartition(String key) {
	  return new S3Chronicle(client, bucket, key);
  }

}

package org.ds.chronos.aws;

import org.ds.chronos.api.Chronicle;
import org.ds.chronos.api.PartitionPeriod;
import org.ds.chronos.api.PartitionedChronicle;

import com.amazonaws.services.s3.AmazonS3Client;

public class S3ParitionedChronicle extends PartitionedChronicle {

	final AmazonS3Client client;
	final String bucket;
	final boolean gzip;

	public S3ParitionedChronicle(AmazonS3Client client, String bucket, String keyPrefix, PartitionPeriod period) {
		this(client, bucket, keyPrefix, period, false);
	}

	public S3ParitionedChronicle(AmazonS3Client client, String bucket, String keyPrefix, PartitionPeriod period,
	    boolean gzip) {
		super(keyPrefix, period);
		this.client = client;
		this.bucket = bucket;
		this.gzip = gzip;
	}

	@Override
	protected Chronicle getPartition(String key) {
		return new S3Chronicle(client, bucket, key, gzip);
	}

}

Add gzip constructor arg to partitioned s3 chronicle


package internal.org.springframework.content.rest.utils;

import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.repository.support.Repositories;

import internal.org.springframework.content.rest.controllers.ResourceNotFoundException;

public final class PersistentEntityUtils {

	private PersistentEntityUtils() {}

	public static PersistentEntity<?,?> findPersistentEntity(Repositories repositories,
													  Class<?> domainType) {

		PersistentEntity<?, ?> persistentEntity = repositories.getPersistentEntity(domainType);
		return persistentEntity;
	}

	public static PersistentProperty<?> getPersistentProperty(PersistentEntity<?,?> entity, String propertyName) {

		PersistentProperty<?> prop = entity.getPersistentProperty(propertyName);
		if (null == prop)
			throw new ResourceNotFoundException();

		return prop;
	}

	public static boolean isPropertyMultiValued(PersistentProperty<?> prop) {
		return (prop.isArray() || prop.isCollectionLike());
	}
}

package internal.org.springframework.content.rest.utils;

import org.springframework.data.mapping.PersistentProperty;

public final class PersistentEntityUtils {

	private PersistentEntityUtils() {}

	public static boolean isPropertyMultiValued(PersistentProperty<?> prop) {
		return (prop.isArray() || prop.isCollectionLike());
	}
}

Remove unused persistententity utils code


package fi.nls.oskari.mybatis;

import fi.nls.oskari.service.ServiceRuntimeException;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;

import javax.sql.DataSource;

public class MyBatisHelper {

    public static SqlSessionFactory initMyBatis(DataSource ds, Class<?>... mappers) {
        return build(getConfig(ds, mappers));
    }

    public static Configuration getConfig(DataSource ds, Class<?>... mappers) {
        if(ds == null) {
            throw new ServiceRuntimeException("Tried initializing MyBatis without a datasource");
        }
        final TransactionFactory transactionFactory = new JdbcTransactionFactory();
        final Environment environment = new Environment("development", transactionFactory, ds);
        final Configuration configuration = new Configuration(environment);
        configuration.setLazyLoadingEnabled(true);
        addMappers(configuration, mappers);
        return configuration;
    }

    public static void addAliases(Configuration config, Class<?>... aliases) {
        for (Class<?> alias : aliases) {
            config.getTypeAliasRegistry().registerAlias(alias);
        }
    }

    public static void addMappers(Configuration config, Class<?>... mappers) {
        for (Class<?> mapper : mappers) {
            config.addMapper(mapper);
        }
    }

    public static SqlSessionFactory build(Configuration config) {
        return new SqlSessionFactoryBuilder().build(config);
    }
}

package fi.nls.oskari.mybatis;

import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.transaction.TransactionFactory;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import javax.sql.DataSource;

public class MyBatisHelper {

    public static SqlSessionFactory initMyBatis(DataSource ds, Class<?>... mappers) {
        return build(getConfig(ds, mappers));
    }

    public static Configuration getConfig(DataSource ds, Class<?>... mappers) {
        if (ds == null) {
            throw new NullPointerException("Tried initializing MyBatis without a datasource");
        }
        final TransactionFactory transactionFactory = new JdbcTransactionFactory();
        final Environment environment = new Environment("development", transactionFactory, ds);
        final Configuration configuration = new Configuration(environment);
        configuration.setLazyLoadingEnabled(true);
        addMappers(configuration, mappers);
        return configuration;
    }

    public static void addAliases(Configuration config, Class<?>... aliases) {
        for (Class<?> alias : aliases) {
            config.getTypeAliasRegistry().registerAlias(alias);
        }
    }

    public static void addMappers(Configuration config, Class<?>... mappers) {
        for (Class<?> mapper : mappers) {
            config.addMapper(mapper);
        }
    }

    public static SqlSessionFactory build(Configuration config) {
        return new SqlSessionFactoryBuilder().build(config);
    }
}

Throw NPE instead of ServiceRuntimeException, more fitting


package uk.ac.ebi.quickgo.annotation.service.statistics;

import java.util.List;

/**
 * A source of {@link RequiredStatistics} instances.
 *
 * @author Tony Wardell
 * Date: 19/12/2017
 * Time: 11:04
 * Created with IntelliJ IDEA.
 */
public class RequiredStatisticsProvider {

    private final RequiredStatistics standardUsage;
    private final RequiredStatistics downloadUsage;
    private final RequiredStatistics standardUsageWithGeneProductFiltering;
    private final RequiredStatistics downloadUsageWithGeneProductFiltering;

    public RequiredStatisticsProvider(StatisticsTypeConfigurer standardConfiguration, StatisticsTypeConfigurer
            downloadConfiguration) {
        standardUsage = new RequiredStatistics(standardConfiguration);
        downloadUsage = new RequiredStatistics(downloadConfiguration);
        standardUsageWithGeneProductFiltering = new RequiredStatisticsWithGeneProduct(standardConfiguration);
        downloadUsageWithGeneProductFiltering = new RequiredStatisticsWithGeneProduct(downloadConfiguration);
    }

    public List<RequiredStatistic> getStandardUsage() {
        return standardUsage.getRequiredStatistics();
    }

    public List<RequiredStatistic> getDownloadUsage() {
        return downloadUsage.getRequiredStatistics();
    }

    public List<RequiredStatistic> getStandardUsageWithGeneProductFiltering() {
        return standardUsageWithGeneProductFiltering.getRequiredStatistics();
    }

    public List<RequiredStatistic> getDownloadUsageWithGeneProductFiltering() {
        return downloadUsageWithGeneProductFiltering.getRequiredStatistics();
    }
}

package uk.ac.ebi.quickgo.annotation.service.statistics;

import java.util.List;
import java.util.Objects;

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

/**
 * A source of {@link RequiredStatistics} instances.
 *
 * @author Tony Wardell
 * Date: 19/12/2017
 * Time: 11:04
 * Created with IntelliJ IDEA.
 */
public class RequiredStatisticsProvider {

    private final RequiredStatistics standardUsage;
    private final RequiredStatistics downloadUsage;
    private final RequiredStatistics standardUsageWithGeneProductFiltering;
    private final RequiredStatistics downloadUsageWithGeneProductFiltering;

    public RequiredStatisticsProvider(StatisticsTypeConfigurer standardConfiguration, StatisticsTypeConfigurer
            downloadConfiguration) {
        checkArgument(Objects.nonNull(standardConfiguration), "The standard StatisticsTypeConfigurer instance cannot" +
                " be null");
        checkArgument(Objects.nonNull(standardConfiguration), "The download StatisticsTypeConfigurer instance cannot" +
                " be null");
        standardUsage = new RequiredStatistics(standardConfiguration);
        downloadUsage = new RequiredStatistics(downloadConfiguration);
        standardUsageWithGeneProductFiltering = new RequiredStatisticsWithGeneProduct(standardConfiguration);
        downloadUsageWithGeneProductFiltering = new RequiredStatisticsWithGeneProduct(downloadConfiguration);
    }

    public List<RequiredStatistic> getStandardUsage() {
        return standardUsage.getRequiredStatistics();
    }

    public List<RequiredStatistic> getDownloadUsage() {
        return downloadUsage.getRequiredStatistics();
    }

    public List<RequiredStatistic> getStandardUsageWithGeneProductFiltering() {
        return standardUsageWithGeneProductFiltering.getRequiredStatistics();
    }

    public List<RequiredStatistic> getDownloadUsageWithGeneProductFiltering() {
        return downloadUsageWithGeneProductFiltering.getRequiredStatistics();
    }
}

Check configuration objects passed to the constructor are not null.


package org.realityforge.replicant.client;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * An event indicating that an imitation has changed.
 */
public final class EntityChangeEvent
{
  private final EntityChangeType _type;
  private final Object _object;
  private final String _name;
  private final Object _value;

  public EntityChangeEvent( @Nonnull final EntityChangeType type, @Nonnull final Object object )
  {
    this( type, object, null, null );
  }

  @SuppressWarnings( { "ConstantConditions" } )
  public EntityChangeEvent( @Nonnull final EntityChangeType type,
                            @Nonnull final Object object,
                            @Nullable final String name,
                            @Nullable final Object value )
  {
    if ( null == type )
    {
      throw new NullPointerException( "type" );
    }
    if ( null == object )
    {
      throw new NullPointerException( "object" );
    }
    _type = type;
    _object = object;
    _name = name;
    _value = value;
  }

  @Nonnull
  public final EntityChangeType getType()
  {
    return _type;
  }

  @Nonnull
  public final Object getObject()
  {
    return _object;
  }

  @Nullable
  public final String getName()
  {
    return _name;
  }

  @Nullable
  public final Object getValue()
  {
    return _value;
  }

  public final String toString()
  {
    final StringBuilder sb = new StringBuilder();
    sb.append( "EntityChange[type=" );
    sb.append( getType().name() );
    sb.append( ",name=" );
    sb.append( getName() );
    sb.append( ",value=" );
    sb.append( getValue() );
    sb.append( ",object=" );
    sb.append( getObject() );
    sb.append( "]" );
    return sb.toString();
  }
}

package org.realityforge.replicant.client;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/**
 * An event indicating that an imitation has changed.
 */
public final class EntityChangeEvent
{
  private final EntityChangeType _type;
  private final Object _object;
  private final String _name;
  private final Object _value;

  protected EntityChangeEvent( @Nonnull final EntityChangeType type,
                               @Nonnull final Object object,
                               @Nullable final String name,
                               @Nullable final Object value )
  {
    _type = type;
    _object = object;
    _name = name;
    _value = value;
  }

  @Nonnull
  public final EntityChangeType getType()
  {
    return _type;
  }

  @Nonnull
  public final Object getObject()
  {
    return _object;
  }

  @Nullable
  public final String getName()
  {
    return _name;
  }

  @Nullable
  public final Object getValue()
  {
    return _value;
  }

  /**
   * {@inheritDoc}
   */
  public final String toString()
  {
    final StringBuilder sb = new StringBuilder();
    sb.append( "EntityChange[type=" );
    sb.append( getType().name() );
    sb.append( ",name=" );
    sb.append( getName() );
    sb.append( ",value=" );
    sb.append( getValue() );
    sb.append( ",object=" );
    sb.append( getObject() );
    sb.append( "]" );
    return sb.toString();
  }
}

Simplify the construction of change events and make them protected


/*
 * Copyright 2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.groovy.scripts;

import org.gradle.internal.service.ServiceRegistry;
import org.gradle.logging.StandardOutputCapture;

/**
 * The base class for all scripts executed by Gradle.
 */
public abstract class Script extends groovy.lang.Script {
    private ScriptSource source;
    private ClassLoader contextClassloader;

    public ScriptSource getScriptSource() {
        return source;
    }

    public void setScriptSource(ScriptSource source) {
        this.source = source;
    }

    public void setContextClassloader(ClassLoader contextClassloader) {
        this.contextClassloader = contextClassloader;
    }

    public ClassLoader getContextClassloader() {
        return contextClassloader;
    }

    public abstract void init(Object target, ServiceRegistry services);

    public abstract StandardOutputCapture getStandardOutputCapture();
}

/*
 * Copyright 2010 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.groovy.scripts;

import org.gradle.internal.service.ServiceRegistry;
import org.gradle.logging.StandardOutputCapture;

/**
 * The base class for all scripts executed by Gradle.
 */
public abstract class Script extends groovy.lang.Script {
    private ScriptSource source;
    private ClassLoader contextClassloader;

    public ScriptSource getScriptSource() {
        return source;
    }

    public void setScriptSource(ScriptSource source) {
        this.source = source;
    }

    public void setContextClassloader(ClassLoader contextClassloader) {
        this.contextClassloader = contextClassloader;
    }

    public ClassLoader getContextClassloader() {
        return contextClassloader;
    }

    public abstract void init(Object target, ServiceRegistry services);

    public abstract StandardOutputCapture getStandardOutputCapture();

    @Override
    public Object getProperty(String property) {
        // Refactoring of groovy.lang.Script.getProperty logic
        // to avoid unnecessary MissingPropertyException in binding variable lookup
        if (getBinding().hasVariable(property)) {
            return super.getProperty(property);
        } else {
            return getMetaClass().getProperty(this, property);
        }
    }
}

Reduce MissingPropertyExceptions in Groovy script execution


package com.arondor.common.reflection.bean.config;

import java.util.Map;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import com.arondor.common.reflection.model.config.ElementConfiguration;
import com.arondor.common.reflection.model.config.MapConfiguration;

@Entity
@DiscriminatorValue("MAP")
public class MapConfigurationBean extends ElementConfigurationBean implements MapConfiguration
{
    /**
     *
     */
    private static final long serialVersionUID = 2968136864852828441L;

    public ElementConfigurationType getFieldConfigurationType()
    {
        return ElementConfigurationType.Map;
    }

    public MapConfigurationBean()
    {

    }

    // @ManyToMany(cascade = CascadeType.ALL)
    // , targetEntity = ElementConfigurationBean.class
    @Transient
    private Map<ElementConfiguration, ElementConfiguration> mapConfiguration;

    public Map<ElementConfiguration, ElementConfiguration> getMapConfiguration()
    {
        return mapConfiguration;
    }

    public void setMapConfiguration(Map<ElementConfiguration, ElementConfiguration> mapConfiguration)
    {
        this.mapConfiguration = mapConfiguration;
    }

}

package com.arondor.common.reflection.bean.config;

import java.util.Map;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import com.arondor.common.reflection.model.config.ElementConfiguration;
import com.arondor.common.reflection.model.config.MapConfiguration;

@Entity
@DiscriminatorValue("MAP")
public class MapConfigurationBean extends ElementConfigurationBean implements MapConfiguration
{
    /**
     *
     */
    private static final long serialVersionUID = 2968136864852828441L;

    public ElementConfigurationType getFieldConfigurationType()
    {
        return ElementConfigurationType.Map;
    }

    public MapConfigurationBean()
    {

    }

    // @ManyToMany(cascade = CascadeType.ALL)
    // , targetEntity = ElementConfigurationBean.class
    @Transient
    private Map<ElementConfiguration, ElementConfiguration> mapConfiguration;

    public Map<ElementConfiguration, ElementConfiguration> getMapConfiguration()
    {
        return mapConfiguration;
    }

    public void setMapConfiguration(Map<ElementConfiguration, ElementConfiguration> mapConfiguration)
    {
        this.mapConfiguration = mapConfiguration;
    }

    public String toString()
    {
        return "MapConfigurationBean[" + mapConfiguration.entrySet() + "]";
    }
}

Add a correct toString() method


package com.redhat.ceylon.eclipse.core.debug;

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

import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.jdt.debug.core.IJavaVariable;

public class CeylonContentProviderFilter {
    public static Object[] filterVariables(Object[] variables, IPresentationContext context) throws DebugException {
        List<Object> keep = new ArrayList<Object>(variables.length);
        for (int i = 0; i < variables.length; i++) {
            boolean filter = false;
            if (variables[i] instanceof IJavaVariable){
                IJavaVariable var = (IJavaVariable)variables[i];
                if (var.getName().contains("$")){
                    filter = true;
                }
            }
            if (!filter){
                keep.add(variables[i]);
            }
        }
        return keep.toArray(new Object[keep.size()]);
    }

}

package com.redhat.ceylon.eclipse.core.debug;

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

import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.jdt.debug.core.IJavaVariable;

import com.redhat.ceylon.compiler.java.codegen.Naming;

public class CeylonContentProviderFilter {
    public static Object[] filterVariables(Object[] variables, IPresentationContext context) throws DebugException {
        List<Object> keep = new ArrayList<Object>(variables.length);
        for (int i = 0; i < variables.length; i++) {
            boolean filter = false;
            if (variables[i] instanceof IJavaVariable){
                String name = ((IJavaVariable)variables[i]).getName();
                if (name.charAt(0) == '$') {
                    if (Naming.isJavaKeyword(name, 1, name.length())) {
                        name = name.substring(1);
                    }
                }
                if (name.contains("$")){
                    filter = true;
                }
            }
            if (!filter){
                keep.add(variables[i]);
            }
        }
        return keep.toArray(new Object[keep.size()]);
    }

}

Manage quoted variables (because having the name of a Java keyword)


package com.minelittlepony.client.render;

import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.render.VertexFormats;

public class MagicGlow extends RenderPhase {

    public MagicGlow(String name, Runnable beginAction, Runnable endAction) {
        super(name, beginAction, endAction);
    }

    public static RenderLayer getRenderLayer() {
        return RenderLayer.method_24048("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, 7, 256, RenderLayer.MultiPhaseData.builder()
                .texture(NO_TEXTURE)
                .transparency(TRANSLUCENT_TRANSPARENCY)
                .lightmap(DISABLE_LIGHTMAP)
                .cull(DISABLE_CULLING)
                .build(false));
    }
}

package com.minelittlepony.client.render;

import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.RenderPhase;
import net.minecraft.client.render.VertexFormats;

public class MagicGlow extends RenderPhase {
    private MagicGlow(String name, Runnable beginAction, Runnable endAction) {
        super(name, beginAction, endAction);
    }

    static final RenderLayer MAGIC = RenderLayer.method_24048("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, 7, 256, RenderLayer.MultiPhaseData.builder()
            .texture(NO_TEXTURE)
            .transparency(TRANSLUCENT_TRANSPARENCY)
            .lightmap(DISABLE_LIGHTMAP)
            .cull(DISABLE_CULLING)
            .build(false));

    public static RenderLayer getRenderLayer() {
        return MAGIC;
    }
}

Tidy up the magic glow layer


/*
 * Copyright 2007-2009 Sun Microsystems, Inc.
 * This source code is available under the MIT license.
 * See the file LICENSE.txt for details.
 */

package org.jruby.rack;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jruby.rack.servlet.DefaultServletDispatcher;
import org.jruby.rack.servlet.ServletDispatcher;
import org.jruby.rack.servlet.ServletRackContext;

/**
 *
 * @author nicksieger
 */
public class RackServlet extends HttpServlet {
    private ServletDispatcher dispatcher;

    /** Default ctor, used by servlet container */
    public RackServlet() {
    }

    /** dependency injection ctor, used by unit tests */
    public RackServlet(ServletDispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    @Override
    public void init(ServletConfig config) {
        this.dispatcher = new DefaultServletDispatcher(new ServletRackContext(config.getServletContext()));
    }

    @Override
    public void service(ServletRequest request, ServletResponse response)
        throws ServletException, IOException {
        dispatcher.process((HttpServletRequest) request, (HttpServletResponse) response);
    }

}

/*
 * Copyright 2007-2009 Sun Microsystems, Inc.
 * This source code is available under the MIT license.
 * See the file LICENSE.txt for details.
 */

package org.jruby.rack;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.jruby.rack.servlet.DefaultServletDispatcher;
import org.jruby.rack.servlet.ServletDispatcher;
import org.jruby.rack.servlet.ServletRackContext;

/**
 *
 * @author nicksieger
 */
public class RackServlet extends HttpServlet {
    private ServletDispatcher dispatcher;

    /** Default ctor, used by servlet container */
    public RackServlet() {
    }

    /** dependency injection ctor, used by unit tests */
    public RackServlet(ServletDispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    @Override
    public void init(ServletConfig config) {
        this.dispatcher = new DefaultServletDispatcher(new ServletRackContext(config.getServletContext()));
    }

    @Override
    public void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
        dispatcher.process(request, response);
    }

    @Override
    public void service(ServletRequest request, ServletResponse response)
        throws ServletException, IOException {
        service((HttpServletRequest) request, (HttpServletResponse) response);
    }
}

Add override for both Servlet and HttpServlet service methods (Michael Pitman)


/*
 * Copyright 2016 SEARCH-The National Consortium for Justice Information and Statistics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.search.nibrs.stagingdata.repository;

import org.search.nibrs.stagingdata.model.UcrOffenseCodeType;
import org.springframework.data.repository.CrudRepository;

public interface UcrOffenseCodeTypeRepository extends CrudRepository<UcrOffenseCodeType, Integer>{
	public UcrOffenseCodeType findFirstByStateCode( String stateCode );
	public Iterable<UcrOffenseCodeType> findByOrderByStateDescription();
}

/*
 * Copyright 2016 SEARCH-The National Consortium for Justice Information and Statistics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.search.nibrs.stagingdata.repository;

import org.search.nibrs.stagingdata.model.UcrOffenseCodeType;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UcrOffenseCodeTypeRepository extends JpaRepository<UcrOffenseCodeType, Integer>{
	public UcrOffenseCodeType findFirstByStateCode( String stateCode );
}

Use JpaRepository instead of CrudRepository.


// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
package org.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Node;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

// ========================================================================
// Copyright 2010 NEXCOM Systems
// ------------------------------------------------------------------------
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========================================================================
package org.cipango.diameter.router;

import java.util.Hashtable;
import java.util.Map;

import org.cipango.diameter.node.DiameterRequest;
import org.cipango.diameter.node.Peer;

public class DefaultRouter implements DiameterRouter
{

	private Map<String, Peer> _peers = new Hashtable<String, Peer>();

	public Peer getRoute(DiameterRequest request)
	{
		if (request.getDestinationHost() == null)
			return null;
		return _peers.get(request.getDestinationHost());
	}

	public void peerAdded(Peer peer)
	{
		_peers.put(peer.getHost(), peer);
	}

	public void peerRemoved(Peer peer)
	{
		_peers.remove(peer.getHost());
	}

}

Fix CIPANGO-99: Creating a DiameterServletRequest without specifying the destinationhost field leads to a null pointer exception when sending a the request


package leetcode;

/**
 * https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
 */
public class Problem153 {
    public int findMin(int[] nums) {
        int min = nums[0];
        for (int n : nums) {
            if (n < min) {
                min = Math.min(n, min);
            }
        }
        return min;
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
 */
public class Problem153 {
    public int findMin(int[] nums) {
        return findMin(nums, 0, nums.length-1);
    }

    private int findMin(int[] nums, int left, int right) {
        if (left >= right) {
            return nums[left];
        }
        int mid = (left + right) / 2;
        int minLeft = nums[left];
        if (mid-1 >= 0) {
            minLeft = Math.min(minLeft, nums[mid-1]);
        }
        int minRight = nums[right];
        if (mid+1 < nums.length) {
            minRight = Math.min(minRight, nums[mid+1]);
        }
        int min = Math.min(minLeft, Math.min(nums[mid], minRight));
        if (min == nums[mid]) {
            return nums[mid];
        }
        if (minLeft < minRight) {
            return findMin(nums, left, mid-1);
        } else {
            return findMin(nums, mid+1, right);
        }
    }
}

Solve problem 153 (log n)