package com.nosoftskills.predcomposer.prediction;

import com.nosoftskills.predcomposer.alternatives.PredictionsServiceAlternative;
import com.nosoftskills.predcomposer.alternatives.UserContextAlternative;
import org.jglue.cdiunit.ActivatedAlternatives;
import org.jglue.cdiunit.CdiRunner;
import org.jglue.cdiunit.ContextController;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.inject.Inject;

import static com.nosoftskills.predcomposer.common.TestData.game2;
import static org.junit.Assert.assertEquals;

/**
 * @author Ivan St. Ivanov
 */
@RunWith(CdiRunner.class)
@ActivatedAlternatives({
        PredictionsServiceAlternative.class, UserContextAlternative.class
})
public class ViewGamePredictionsBeanTest {

    @Inject
    private ContextController contextController;

    @Inject
    private ViewGamePredictionsBean bean;

    @Test
    public void shouldLoadGamePredictionsUponRequest() throws Exception {
        contextController.openRequest();
        bean.showGamePredictions(game2);
        assertEquals(game2, bean.getGame());
        assertEquals(2, bean.getPredictions().size());
        contextController.closeRequest();
        contextController.closeSession();
    }

}

package com.nosoftskills.predcomposer.prediction;

import com.nosoftskills.predcomposer.alternatives.PredictionsServiceAlternative;
import com.nosoftskills.predcomposer.alternatives.UserContextAlternative;
import org.jglue.cdiunit.ActivatedAlternatives;
import org.jglue.cdiunit.CdiRunner;
import org.jglue.cdiunit.InRequestScope;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.inject.Inject;

import static com.nosoftskills.predcomposer.common.TestData.game2;
import static org.junit.Assert.assertEquals;

/**
 * @author Ivan St. Ivanov
 */
@RunWith(CdiRunner.class)
@ActivatedAlternatives({
        PredictionsServiceAlternative.class, UserContextAlternative.class
})
public class ViewGamePredictionsBeanTest {

    @Inject
    private ViewGamePredictionsBean bean;

    @Test
    @InRequestScope
    public void shouldLoadGamePredictionsUponRequest() throws Exception {
        bean.showGamePredictions(game2);
        assertEquals(game2, bean.getGame());
        assertEquals(2, bean.getPredictions().size());
    }

}

Improve game prediction bean test


package stroom.data.store.api;

import stroom.meta.shared.FindMetaCriteria;
import stroom.util.shared.ResourcePaths;
import stroom.util.shared.RestResource;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

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

@Tag(name = "Data Download")
@Path("/dataDownload" + ResourcePaths.V1)
@Produces(MediaType.APPLICATION_OCTET_STREAM)
@Consumes(MediaType.APPLICATION_JSON)
public interface DataDownload extends RestResource {

    /*
    This method is defined separately to `DataResource` due to GWT incompatibility with the jaxax `Response` class.
     */
    @POST
    @Path("downloadZip")
    @Operation(
            summary = "Retrieve content matching the provided criteria as a zip file",
            operationId = "downloadZip",
            responses = {
                    @ApiResponse(description = "Returns Stroom content data as a zip file")
            })
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    Response downloadZip(@Parameter(description = "criteria", required = true) FindMetaCriteria criteria);
}

package stroom.data.store.api;

import stroom.meta.shared.FindMetaCriteria;
import stroom.util.shared.ResourcePaths;
import stroom.util.shared.RestResource;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;

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

@Tag(name = "Data Download")
@Path("/dataDownload" + ResourcePaths.V1)
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public interface DataDownload extends RestResource {

    /*
    This method is defined separately to `DataResource` due to GWT incompatibility with the jaxax `Response` class.
     */
    @POST
    @Path("downloadZip")
    @Operation(
            summary = "Retrieve content matching the provided criteria as a zip file",
            operationId = "downloadZip",
            responses = {
                    @ApiResponse(description = "Returns Stroom content data as a zip file")
            })
    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    Response downloadZip(@Parameter(description = "criteria", required = true) FindMetaCriteria criteria);
}

Set class producer type to application/json


package org.genericsystem.watch.beta;

import io.vertx.core.DeploymentOptions;
import io.vertx.core.Verticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.eventbus.EventBusOptions;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager;
import sun.security.x509.CertificateX509Key;

public class App_Flex {

	public static final String STEP1 = "app.AtoBEvents";
	public static final String STEP2 = "app.BtoCEvents";

	public static void deployVerticle(Verticle verticle) {

		ClusterManager mgr = new HazelcastClusterManager();

		VertxOptions vertxOptions = new VertxOptions().setClustered(true).setClusterManager(mgr);
		vertxOptions.setEventBusOptions(new EventBusOptions()).setClustered(true);

		vertxOptions.setClusterHost("192.168.1.11");

		vertxOptions.setMaxWorkerExecuteTime(Long.MAX_VALUE);

		Vertx.clusteredVertx(vertxOptions, res -> {
			if (res.succeeded()) {
				Vertx vertx = res.result();
				vertx.deployVerticle(verticle, result->{
					System.out.println(result.result());
				});
			} else {
				throw new IllegalStateException(res.cause());
			}
		});
	}

}

Test remote verticles with Cluster Host


package uk.ac.ebi.atlas.experimentpage.context;

import com.google.common.base.MoreObjects;
import uk.ac.ebi.atlas.model.experiment.differential.Contrast;
import uk.ac.ebi.atlas.model.experiment.differential.DifferentialExperiment;
import uk.ac.ebi.atlas.model.experiment.differential.Regulation;
import uk.ac.ebi.atlas.profiles.differential.DifferentialProfileStreamOptions;
import uk.ac.ebi.atlas.web.DifferentialRequestPreferences;

public class DifferentialRequestContext<E extends DifferentialExperiment, Preferences extends
        DifferentialRequestPreferences> extends RequestContext<Contrast,E, Preferences> implements
        DifferentialProfileStreamOptions {

    public DifferentialRequestContext(Preferences requestPreferences, E experiment) {
        super(requestPreferences, experiment);
    }

    public Regulation getRegulation() {
        return requestPreferences.getRegulation();
    }

    @Override
    public double getPValueCutOff() {
        return requestPreferences.getCutoff();
    }

    @Override
    public double getFoldChangeCutOff() {
        return requestPreferences.getFoldChangeCutOff();
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this.getClass())
                .addValue(super.toString())
                .add("regulation", getRegulation())
                .toString();
    }
}

package uk.ac.ebi.atlas.experimentpage.context;

import com.google.common.base.MoreObjects;
import uk.ac.ebi.atlas.model.experiment.differential.Contrast;
import uk.ac.ebi.atlas.model.experiment.differential.DifferentialExperiment;
import uk.ac.ebi.atlas.model.experiment.differential.Regulation;
import uk.ac.ebi.atlas.profiles.differential.DifferentialProfileStreamOptions;
import uk.ac.ebi.atlas.web.DifferentialRequestPreferences;

public class DifferentialRequestContext<E extends DifferentialExperiment, Preferences extends
        DifferentialRequestPreferences> extends RequestContext<Contrast,E, Preferences> implements
        DifferentialProfileStreamOptions {

    public DifferentialRequestContext(Preferences requestPreferences, E experiment) {
        super(requestPreferences, experiment);
    }

    public E getExperiment(){
        return experiment;
    }

    public Regulation getRegulation() {
        return requestPreferences.getRegulation();
    }

    @Override
    public double getPValueCutOff() {
        return requestPreferences.getCutoff();
    }

    @Override
    public double getFoldChangeCutOff() {
        return requestPreferences.getFoldChangeCutOff();
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this.getClass())
                .addValue(super.toString())
                .add("regulation", getRegulation())
                .toString();
    }
}

Patch the design of DifferentialHeatMap by providing the getExperiment() that's not needed anywhere else


package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.AbstractSection;
import ca.antonious.viewcelladapter.AbstractViewCell;
import ca.antonious.viewcelladapter.decorators.SectionDecorator;

/**
 * Created by George on 2016-12-17.
 */

public class HeaderSectionDecorator extends SectionDecorator {
    private AbstractViewCell headerViewCell;
    private boolean showHeaderIfEmpty = true;

    public HeaderSectionDecorator(AbstractSection decoratedSection, AbstractViewCell headerViewCell) {
        super(decoratedSection);
        this.headerViewCell = headerViewCell;
    }

    @Override
    public AbstractViewCell get(int position) {
        if (position == 0) {
            return headerViewCell;
        }
        return getDecoratedSection().get(position - 1);
    }

    @Override
    public void remove(int position) {
        getDecoratedSection().remove(position - 1);
    }

    @Override
    public int getItemCount() {
        if (isSectionEmpty()) {
            return 0;
        }
        return getDecoratedSection().getItemCount() + 1;
    }

    public boolean shouldShowHeaderIfEmpty() {
        return showHeaderIfEmpty;
    }

    public void setShowHeaderIfEmpty(boolean showHeaderIfEmpty) {
        this.showHeaderIfEmpty = showHeaderIfEmpty;
    }

    private boolean isSectionEmpty() {
        int count = getDecoratedSection().getItemCount();
        return count == 0 || (count == 1 && !showHeaderIfEmpty);
    }
}

package ca.antonious.viewcelladapter.decorators;

import ca.antonious.viewcelladapter.AbstractSection;
import ca.antonious.viewcelladapter.AbstractViewCell;
import ca.antonious.viewcelladapter.decorators.SectionDecorator;

/**
 * Created by George on 2016-12-17.
 */

public class HeaderSectionDecorator extends SectionDecorator {
    private AbstractViewCell headerViewCell;
    private boolean showHeaderIfEmpty = true;

    public HeaderSectionDecorator(AbstractSection decoratedSection, AbstractViewCell headerViewCell) {
        super(decoratedSection);
        this.headerViewCell = headerViewCell;
    }

    @Override
    public AbstractViewCell get(int position) {
        if (position == 0) {
            return headerViewCell;
        }
        return getDecoratedSection().get(position - 1);
    }

    @Override
    public void remove(int position) {
        getDecoratedSection().remove(position - 1);
    }

    @Override
    public int getItemCount() {
        if (isSectionEmpty()) {
            return 0;
        }
        return getDecoratedSection().getItemCount() + 1;
    }

    public boolean shouldShowHeaderIfEmpty() {
        return showHeaderIfEmpty;
    }

    public void setShowHeaderIfEmpty(boolean showHeaderIfEmpty) {
        this.showHeaderIfEmpty = showHeaderIfEmpty;
    }

    private boolean isSectionEmpty() {
        return getDecoratedSection().isEmpty() && !shouldShowHeaderIfEmpty();
    }
}

Fix logic for determining if a header decorator is empty


package com.example.android.miwok;

/**
 * {@link Word} represents a vocabulary word that the user wants to learn.
 * It contains a default translation and a Miwok translation for that word.
 */

public class Word {

    //Default translation for the word
    private String mDeafaultTranslation;

    //Miwok translation for the word
    private String mMiwokTranslation;

    //Store image resource id to associate icon with word
    private int mImageResourceId;

    //Constructor which takes in two string parameters
    public Word(String defaultTranslation, String miwokTranslation) {
        mDeafaultTranslation = defaultTranslation;
        mMiwokTranslation = miwokTranslation;
    }

    /**
     * Get the default translation of the word
     */
    public String getDefaultTranslation() {
        return mDeafaultTranslation;
    }

    /**
     * Get the Miwok translation of the word
     */
    public String getMiwokTranslation() {
        return mMiwokTranslation;
    }

    /**
     * Get the image resource id of the word
     */
    public int getImageResourceID() {
        return mImageResourceId;
    }
}

package com.example.android.miwok;

import java.lang.reflect.Constructor;

/**
 * {@link Word} represents a vocabulary word that the user wants to learn.
 * It contains a default translation and a Miwok translation for that word.
 */

public class Word {

    //Default translation for the word
    private String mDeafaultTranslation;

    //Miwok translation for the word
    private String mMiwokTranslation;

    //Store image resource id to associate icon with word
    private int mImageResourceId;

    /**
     * Constructor which takes in two string parameters
     * @param defaultTranslation is the word in a English language
     * @param miwokTranslation is the word in Miwok language
     */
    public Word(String defaultTranslation, String miwokTranslation) {
        mDeafaultTranslation = defaultTranslation;
        mMiwokTranslation = miwokTranslation;
    }

    /**
     * Constructor which takes in two string parameters and one image resource id
     * @param defaultTranslation is the word in a English language
     * @param miwokTranslation is the word in Miwok language
     * @param imageResourceID is the drawable resource id of the image associated with the word
     */
    public Word(String defaultTranslation, String miwokTranslation, int imageResourceID) {
        mDeafaultTranslation = defaultTranslation;
        mMiwokTranslation = miwokTranslation;
        mImageResourceId = imageResourceID;
    }

    /**
     * Get the default translation of the word
     */
    public String getDefaultTranslation() {
        return mDeafaultTranslation;
    }

    /**
     * Get the Miwok translation of the word
     */
    public String getMiwokTranslation() {
        return mMiwokTranslation;
    }

    /**
     * Get the image resource id of the word
     */
    public int getImageResourceID() {
        return mImageResourceId;
    }
}

Add a second constructor which will have 3 input parameters


/*
 * 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.
 */
@Version("9.0.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.plugins.segment;

import aQute.bnd.annotation.Export;
import aQute.bnd.annotation.Version;

/*
 * 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.
 */
@Version("10.0.0")
@Export(optional = "provide:=true")
package org.apache.jackrabbit.oak.plugins.segment;

import aQute.bnd.annotation.Export;
import aQute.bnd.annotation.Version;

Add filter capabilities to the segment graph run mode Bump export version


package pl.vehicle_history.api.model;

import org.joda.time.DateTime;

/**
 * TODO: Add a class header comment!
 */
public class Registration {
    private RegistrationStatus status;
    private DateTime firstAt;

    public RegistrationStatus getStatus() {
        return status;
    }

    public DateTime getFirstAt() {
        return firstAt;
    }
}

package pl.vehicle_history.api.model;

import org.joda.time.DateTime;

/**
 * TODO: Add a class header comment!
 */
public class Registration {
    private RegistrationStatus status;
    private String firstAt;

    public RegistrationStatus getStatus() {
        return status;
    }

    public String getFirstAt() {
        return firstAt;
    }
}

Change api model (date as String).


package net.gini.android.authorization.requests;

import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;

import net.gini.android.MediaTypes;
import net.gini.android.authorization.Session;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class BearerJsonObjectRequest extends JsonObjectRequest {
    final private Session mSession;

    public BearerJsonObjectRequest(int method, String url, JSONObject jsonRequest, Session session, Response.Listener<JSONObject> listener, Response.ErrorListener errorListener) {
        super(method, url, jsonRequest, listener, errorListener);

        mSession = session;
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        HashMap<String, String> headers = new HashMap<String, String>();
        headers.put("Accept", String.format("%s, %s", MediaTypes.APPLICATION_JSON, MediaTypes.GINI_JSON_V1));
        headers.put("Authorization", "BEARER " + mSession.getAccessToken());
        return headers;
    }
}

package net.gini.android.authorization.requests;

import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonObjectRequest;

import net.gini.android.MediaTypes;
import net.gini.android.authorization.Session;

import org.apache.http.protocol.HTTP;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

public class BearerJsonObjectRequest extends JsonObjectRequest {
    final private Session mSession;

    public BearerJsonObjectRequest(int method, String url, JSONObject jsonRequest, Session session, Response.Listener<JSONObject> listener, Response.ErrorListener errorListener) {
        super(method, url, jsonRequest, listener, errorListener);

        mSession = session;
    }

    @Override
    public Map<String, String> getHeaders() throws AuthFailureError {
        HashMap<String, String> headers = new HashMap<String, String>();
        headers.put("Accept", String.format("%s, %s", MediaTypes.APPLICATION_JSON, MediaTypes.GINI_JSON_V1));
        headers.put("Authorization", "BEARER " + mSession.getAccessToken());
        return headers;
    }

    @Override
    protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
        try {
            // The Gini API always uses UTF-8.
            final String jsonString = new String(response.data, HTTP.UTF_8);
            return Response.success(new JSONObject(jsonString),
                                    HttpHeaderParser.parseCacheHeaders(response));
        } catch (UnsupportedEncodingException e) {
            return Response.error(new ParseError(e));
        } catch (JSONException je) {
            return Response.error(new ParseError(je));
        }
    }
}

Fix the encoding of API responses.


/**
 * Copyright (c) 2015-present Jorge Díaz All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library 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 Lesser General Public License for more
 * details.
 */

package jorgediazest.indexchecker.util;

import com.liferay.portal.kernel.configuration.Configuration;
import com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;

/**
 * @author Jorge Díaz
 */
public class PortletPropsValues {

	public static final int INDEX_SEARCH_LIMIT = GetterUtil.getInteger(
		PortletPropsValues._configuration.get(
			PortletPropsKeys.INDEX_SEARCH_LIMIT),
		10000);

	public static final int NUMBER_THREADS = GetterUtil.getInteger(
		PortletPropsValues._configuration.get(PortletPropsKeys.NUMBER_THREADS),
		1);

	private static final Configuration _configuration =
		ConfigurationFactoryUtil.getConfiguration(
			PortletPropsValues.class.getClassLoader(), "portlet");

}

/**
 * Copyright (c) 2015-present Jorge Díaz All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library 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 Lesser General Public License for more
 * details.
 */

package jorgediazest.indexchecker.util;

import com.liferay.portal.kernel.configuration.Configuration;
import com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;

/**
 * @author Jorge Díaz
 */
public class PortletPropsValues {

	public static final int INDEX_SEARCH_LIMIT;

	public static final int NUMBER_THREADS;

	private static final Configuration _configuration;

	static {
		_configuration = ConfigurationFactoryUtil.getConfiguration(
			PortletPropsValues.class.getClassLoader(), "portlet");

		INDEX_SEARCH_LIMIT = GetterUtil.getInteger(
			_configuration.get(PortletPropsKeys.INDEX_SEARCH_LIMIT), 10000);

		NUMBER_THREADS = GetterUtil.getInteger(
			PortletPropsValues._configuration.get(
				PortletPropsKeys.NUMBER_THREADS),
			1);
	}

}

Fix NPE caused by automatic SF


// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.twitter.intellij.pants.jps.incremental.scala;

import com.twitter.intellij.pants.jps.incremental.model.JpsPantsProjectExtension;
import com.twitter.intellij.pants.jps.incremental.serialization.PantsJpsProjectExtensionSerializer;
import com.twitter.intellij.pants.jps.util.PantsJpsUtil;
import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.incremental.scala.ChunkExclusionService;
import org.jetbrains.jps.model.module.JpsModule;

import java.util.Set;

public class PantsScalaChunkExclusionService extends ChunkExclusionService {
  @Override
  public boolean isExcluded(ModuleChunk chunk) {
    final Set<JpsModule> modules = chunk.getModules();
    if (modules.isEmpty()) {
      return false;
    }

    final JpsPantsProjectExtension pantsProjectExtension =
      PantsJpsProjectExtensionSerializer.findPantsProjectExtension(modules.iterator().next().getProject());
    if (pantsProjectExtension == null) {
      return false;
    }
    return PantsJpsUtil.containsPantsModules(modules);
  }
}

// Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).

package com.twitter.intellij.pants.jps.incremental.scala;

import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.incremental.scala.ChunkExclusionService;

public class PantsScalaChunkExclusionService extends ChunkExclusionService {
  @Override
  public boolean isExcluded(ModuleChunk chunk) {
    // All compilations are handled by Pants, thus excluded from scala plugin.
    return true;
  }
}

Exclude all from scala plugin compilation


package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Population;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.nwu.bioinformatics.commons.CollectionUtils;

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

import org.springframework.transaction.annotation.Transactional;

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class PopulationDao extends StudyCalendarMutableDomainObjectDao<Population> {
    @Override
    public Class<Population> domainClass() {
        return Population.class;
    }

    @SuppressWarnings({ "unchecked" })
    public Population getByAbbreviation(Study study, String abbreviation) {
        return (Population) CollectionUtils.firstElement(getHibernateTemplate().find(
            "from Population p where p.abbreviation = ? and p.study = ?",
            new Object[] { abbreviation, study }));
    }

    /**
     * Collects and returns all the abbreviations for populations in the given study
     */
    @SuppressWarnings({ "unchecked" })
    public Set<String> getAbbreviations(Study study) {
        return new HashSet<String>(getHibernateTemplate().find(
            "select p.abbreviation from Population p where p.study = ?", study));
    }
}

package edu.northwestern.bioinformatics.studycalendar.dao;

import edu.northwestern.bioinformatics.studycalendar.domain.Population;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.nwu.bioinformatics.commons.CollectionUtils;
import org.springframework.transaction.annotation.Transactional;

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

/**
 * @author Rhett Sutphin
 */
@Transactional(readOnly = true)
public class PopulationDao extends StudyCalendarMutableDomainObjectDao<Population> {
    @Override
    public Class<Population> domainClass() {
        return Population.class;
    }

    /**
    * Finds the population based on study and the population abbreviation
    *
    * @param  study the study which you want to search for the population
    * @param  abbreviation the abbreviation for the population
    * @return      the population that corresponds to the study and the abbreviation that was passed in
    */
    @SuppressWarnings({ "unchecked" })
    public Population getByAbbreviation(Study study, String abbreviation) {
        return (Population) CollectionUtils.firstElement(getHibernateTemplate().find(
            "from Population p where p.abbreviation = ? and p.study = ?",
            new Object[] { abbreviation, study }));
    }

    /**
     * Collects and returns all the abbreviations for populations in the given study
     *
     * @param  study the study to return the populations from
     * @return populations retrieved from the given study
     */
    @SuppressWarnings({ "unchecked" })
    public Set<String> getAbbreviations(Study study) {
        return new HashSet<String>(getHibernateTemplate().find(
            "select p.abbreviation from Population p where p.study = ?", study));
    }
}

Add javadoc to planned population dao.


/*
 * Copyright (C) 2019 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.android.exoplayer2.ext.av1;

import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;

/** Configures and queries the underlying native library. */
public final class Gav1Library {

  static {
    ExoPlayerLibraryInfo.registerModule("goog.exo.gav1");
  }

  private static final LibraryLoader LOADER = new LibraryLoader("gav1JNI");

  private Gav1Library() {}

  /**
   * Override the names of the Gav1 native libraries. If an application wishes to call this method,
   * it must do so before calling any other method defined by this class, and before instantiating a
   * {@link Libgav1VideoRenderer} instance.
   *
   * @param libraries The names of the Gav1 native libraries.
   */
  public static void setLibraries(String... libraries) {
    LOADER.setLibraries(libraries);
  }

  /** Returns whether the underlying library is available, loading it if necessary. */
  public static boolean isAvailable() {
    return LOADER.isAvailable();
  }
}

/*
 * Copyright (C) 2019 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.android.exoplayer2.ext.av1;

import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.util.LibraryLoader;

/** Configures and queries the underlying native library. */
public final class Gav1Library {

  static {
    ExoPlayerLibraryInfo.registerModule("goog.exo.gav1");
  }

  private static final LibraryLoader LOADER = new LibraryLoader("gav1JNI");

  private Gav1Library() {}

  /** Returns whether the underlying library is available, loading it if necessary. */
  public static boolean isAvailable() {
    return LOADER.isAvailable();
  }
}

Remove method for setting custom gav1 libraries


package com.restfiddle.config.monitoring;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter;

import java.util.concurrent.TimeUnit;

/**
 * Created by santoshm1 on 28/06/14.
 */
public class MetricsConfig extends MetricsConfigurerAdapter{
    @Override
    public void configureReporters(MetricRegistry metricRegistry) {
	ConsoleReporter
			.forRegistry(metricRegistry)
			.build()
			.start(1, TimeUnit.MINUTES);
    }
}

package com.restfiddle.config.monitoring;

import com.codahale.metrics.ConsoleReporter;
import com.codahale.metrics.MetricRegistry;
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * Created by santoshm1 on 28/06/14.
 */
@Configuration
@EnableMetrics
public class MetricsConfig extends MetricsConfigurerAdapter{
    @Override
    public void configureReporters(MetricRegistry metricRegistry) {
	ConsoleReporter
			.forRegistry(metricRegistry)
			.build()
			.start(1, TimeUnit.MINUTES);
    }
}

Add annotations to begin logging to console


package de.evosec.gradle.gitflow.release;

import org.eclipse.jgit.transport.CredentialsProvider;
import org.gradle.api.Plugin;
import org.gradle.api.Project;

public class ReleasePlugin implements Plugin<Project> {

    private ReleaseExtension extension;

    @Override
    public void apply(Project project) {
        extension = project.getExtensions().create("release", ReleaseExtension.class, project);
        project.afterEvaluate(extension::afterEvaluate);

        CredentialsProvider.setDefault(new GitCredentialsProvider(extension));

        project.getTasks().create("releaseStart", StartReleaseTask.class, task -> task.setPlugin(ReleasePlugin.this));
        project.getTasks().create("releaseFinish", ReleaseFinishTask.class, task -> task.setPlugin(ReleasePlugin.this));
    }

    ReleaseExtension getExtension() {
        return extension;
    }
}

package de.evosec.gradle.gitflow.release;

import com.github.zafarkhaja.semver.Version;
import org.eclipse.jgit.transport.CredentialsProvider;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.plugins.ExtraPropertiesExtension;

public class ReleasePlugin implements Plugin<Project> {

    private ReleaseExtension extension;

    @Override
    public void apply(Project project) {
        extension = project.getExtensions().create("release", ReleaseExtension.class, project);
        project.afterEvaluate(extension::afterEvaluate);

        CredentialsProvider.setDefault(new GitCredentialsProvider(extension));

        project.allprojects(this::setAndroidVersion);

        project.getTasks().create("releaseStart", StartReleaseTask.class, task -> task.setPlugin(ReleasePlugin.this));
        project.getTasks().create("releaseFinish", ReleaseFinishTask.class, task -> task.setPlugin(ReleasePlugin.this));
    }

    ReleaseExtension getExtension() {
        return extension;
    }

    private void setAndroidVersion(Project project) {
        Object extObj = project.getExtensions().findByName("ext");
        if (!(extObj instanceof ExtraPropertiesExtension)) {
            return;
        }

        Version version = Version.valueOf(project.getVersion().toString());

        int versionCode = extension.getAndroidVersionCodeOffset();
        versionCode += version.getPatchVersion();
        versionCode += version.getMinorVersion() * 1000;
        versionCode += version.getMajorVersion() * 1000000;

        ExtraPropertiesExtension ext = (ExtraPropertiesExtension) extObj;
        ext.set("releaseAndroidVersionCode", versionCode);
        ext.set("releaseAndroidVersionName", project.getVersion().toString());
    }
}

Set releaseAndroidVersionCode and releaseAndroidVersionName to be used for android builds


package lb2xp;

import static org.junit.Assert.fail;

import org.junit.Test;

public class TestMBC
{
    @Test
    public void testExpand()
    {
        fail( "Not yet implemented" );
    }
}

package lb2xp;

import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.security.MessageDigest;

import org.junit.Test;

public class TestMBC
{
    private static String md5( byte[] arr )
        throws Exception
    {
        MessageDigest md = MessageDigest.getInstance( "MD5" );
        md.update( arr );
        StringBuilder sb = new StringBuilder();
        for ( byte c : md.digest() )
            sb.append( String.format( "%02x", c ) );
        return sb.toString();
    }

    private void oneFile( String name, String md5 )
        throws Exception
    {
        File bzf = new File( "test-data/" + name + ".bz2" );
        System.setIn( new FileInputStream( bzf ) );
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        System.setOut( new PrintStream( out ) );
        MBC mbc = new MBC();
        mbc.expand();
        assertEquals( md5, md5( out.toByteArray() ) );
    }

    @Test
    public void testExpand()
        throws Exception
    {
        oneFile( "concat", "2debfdcf79f03e4a65a667d21ef9de14" );
    }
}

Add initial test case for MBC


package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.enterprise.context.Dependent;
import org.realityforge.replicant.example.server.entity.tyrell.Building;
import org.realityforge.replicant.example.server.entity.tyrell.Room;
import org.realityforge.replicant.example.server.entity.tyrell.TyrellRouter;

@Dependent
public class EntityRouter
  implements TyrellRouter
{
  public static final String BUILDING_KEY = "Tyrell.BuildingID";

  @Nonnull
  @Override
  public Map<String, Serializable> routeBuilding( @Nonnull final Building entity )
  {
    final HashMap<String, Serializable> map = new HashMap<>();
    map.put( BUILDING_KEY, entity.getID() );
    return map;
  }

  @Nonnull
  @Override
  public Map<String, Serializable> routeRoom( @Nonnull final Room entity )
  {
    return routeBuilding( entity.getBuilding() );
  }
}

package org.realityforge.replicant.example.server.service.tyrell.replicate;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import javax.enterprise.context.Dependent;
import org.realityforge.replicant.example.server.entity.TyrellRouter;
import org.realityforge.replicant.example.server.entity.tyrell.Building;
import org.realityforge.replicant.example.server.entity.tyrell.Room;

@Dependent
public class EntityRouter
  implements TyrellRouter
{
  public static final String BUILDING_KEY = "Tyrell.BuildingID";

  @Nonnull
  @Override
  public Map<String, Serializable> routeBuilding( @Nonnull final Building entity )
  {
    final HashMap<String, Serializable> map = new HashMap<>();
    map.put( BUILDING_KEY, entity.getID() );
    return map;
  }

  @Nonnull
  @Override
  public Map<String, Serializable> routeRoom( @Nonnull final Room entity )
  {
    return routeBuilding( entity.getBuilding() );
  }
}

Upgrade to the new Domgen API


/**
 *  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 integration.glue;

import dom.simple.SimpleObject;

import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
import org.apache.isis.core.specsupport.scenarios.ScenarioExecution;

public class InMemoryDBForSimpleApp extends InMemoryDB {

    public InMemoryDBForSimpleApp(ScenarioExecution scenarioExecution) {
        super(scenarioExecution);
    }

    /**
     * Hook to initialize if possible.
     */
    @Override
    protected void init(Object obj, String str) {
        if(obj instanceof SimpleObject) {
            SimpleObject toDoItem = (SimpleObject) obj;
            toDoItem.setName(str);
        }
    }
}

/**
 *  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 integration.glue;

import dom.simple.SimpleObject;

import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
import org.apache.isis.core.specsupport.scenarios.ScenarioExecution;

public class InMemoryDBForSimpleApp extends InMemoryDB {

    public InMemoryDBForSimpleApp(ScenarioExecution scenarioExecution) {
        super(scenarioExecution);
    }

    /**
     * Hook to initialize if possible.
     */
    @Override
    protected void init(Object obj, String str) {
        if(obj instanceof SimpleObject) {
            SimpleObject simpleObject = (SimpleObject) obj;
            simpleObject.setName(str);
        }
    }
}

Improve the name of a local variable. Seems like copy/paste error


package io.live4.api3;

import org.stjs.javascript.annotation.Namespace;

@Namespace("live4api")
public class Api3UserUrls {
    public static final String API_3_USER = "/api/3/users";
    public static final String BYEMAIL = "/byemail";

    public static final String OBJECT = "/object";
    public static final String LIST = "/list";
    public static final String CHECK = "/check";

    public static final String createUrl() {
        return API_3_USER + OBJECT;
    }

    public static final String updateUrl() {
        return API_3_USER + OBJECT;
    }

    public static final String getUrl(String id) {
        return API_3_USER + OBJECT + "/" + id;
    }

    public static final String listUrl(String orgId) {
        return API_3_USER + LIST + "/" + orgId;
    }

    public static String byEmailUrl(String email) {
        return API_3_USER + BYEMAIL + "/" + email;
    }

    public static String checkUserByEmail(String email) {
        return API_3_USER + CHECK + "/" + email;
    }
}

package io.live4.api3;

import org.stjs.javascript.annotation.Namespace;

@Namespace("live4api")
public class Api3UserUrls {
    public static final String API_3_USER = "/api/3/users";
    public static final String BYEMAIL = "/byemail";

    public static final String OBJECT = "/object";
    public static final String LIST = "/list";

    public static final String createUrl() {
        return API_3_USER + OBJECT;
    }

    public static final String updateUrl() {
        return API_3_USER + OBJECT;
    }

    public static final String getUrl(String id) {
        return API_3_USER + OBJECT + "/" + id;
    }

    public static final String listUrl(String orgId) {
        return API_3_USER + LIST + "/" + orgId;
    }

    public static String byEmailUrl(String email) {
        return API_3_USER + BYEMAIL + "/" + email;
    }
}

Revert "check user exists by email"


package com.cedricziel.idea.typo3.codeInspection;

import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.php.lang.documentation.phpdoc.psi.PhpDocType;
import com.jetbrains.php.lang.inspections.PhpInspection;
import com.jetbrains.php.lang.psi.visitors.PhpElementVisitor;
import org.jetbrains.annotations.NotNull;

public class ExtbasePropertyInjectionInspection  extends PhpInspection{
    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
        return new PhpElementVisitor() {
            @Override
            public void visitPhpDocType(PhpDocType type) {
                super.visitPhpDocType(type);
            }
        };
    }
}

package com.cedricziel.idea.typo3.codeInspection;

import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.php.lang.documentation.phpdoc.psi.tags.PhpDocTag;
import com.jetbrains.php.lang.inspections.PhpInspection;
import com.jetbrains.php.lang.psi.elements.PhpPsiElement;
import com.jetbrains.php.lang.psi.visitors.PhpElementVisitor;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class ExtbasePropertyInjectionInspection extends PhpInspection {

    @Nls
    @NotNull
    @Override
    public String getGroupDisplayName() {
        return GroupNames.PERFORMANCE_GROUP_NAME;
    }

    @Nullable
    @Override
    public String getStaticDescription() {
        return "Property injection uses reflection to insert dependencies.\n" +
                "The alternative to property injection is setter-injection.\n" +
                "You should much rather use setter-injection:\n" +
                "<pre>" +
                "protected $myService;\n" +
                "\n" +
                "public function injectMyService(MyService $myService) {\n" +
                "   $this->myService = $myService;\n" +
                "}\n" +
                "</pre>";
    }

    @NotNull
    @Override
    public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder problemsHolder, boolean b) {
        return new PhpElementVisitor() {
            @Override
            public void visitPhpElement(PhpPsiElement element) {
                if (element instanceof PhpDocTag) {
                    PhpDocTag tag = (PhpDocTag) element;
                    if (tag.getName().equals("@inject")) {
                        problemsHolder.registerProblem(element, "Extbase property injection");
                    }
                }
            }
        };
    }
}

Add extbase @inject performance inspection


package org.icij.extract.core;

import java.io.IOException;

import java.nio.file.Path;
import java.nio.file.FileSystems;
import java.nio.charset.Charset;

import java.util.logging.Logger;

import org.apache.tika.parser.ParsingReader;
import org.apache.tika.exception.TikaException;

/**
 * Extract
 *
 * @author Matthew Caruana Galizia <mcaruana@icij.org>
 * @version 1.0.0-beta
 * @since 1.0.0-beta
 */
public abstract class Spewer {

	protected final Logger logger;

	private Path outputBase = null;

	public Spewer(Logger logger) {
		this.logger = logger;
	}

	public abstract void write(Path file, ParsingReader reader, Charset outputEncoding) throws IOException, TikaException, SpewerException;

	public void setOutputBase(Path outputBase) {
		this.outputBase = outputBase;
	}

	public void setOutputBase(String outputBase) {
		setOutputBase(FileSystems.getDefault().getPath(outputBase));
	}

	public Path filterOutputPath(Path file) {
		if (file.startsWith(outputBase)) {
			return file.subpath(outputBase.getNameCount(), file.getNameCount());
		}

		return file;
	}

	public void finish() throws IOException {
		logger.info("Spewer finishing pending jobs.");
	}
}

package org.icij.extract.core;

import java.io.IOException;

import java.nio.file.Path;
import java.nio.file.FileSystems;
import java.nio.charset.Charset;

import java.util.logging.Logger;

import org.apache.tika.parser.ParsingReader;
import org.apache.tika.exception.TikaException;

/**
 * Extract
 *
 * @author Matthew Caruana Galizia <mcaruana@icij.org>
 * @version 1.0.0-beta
 * @since 1.0.0-beta
 */
public abstract class Spewer {

	protected final Logger logger;

	private Path outputBase = null;

	public Spewer(Logger logger) {
		this.logger = logger;
	}

	public abstract void write(Path file, ParsingReader reader, Charset outputEncoding) throws IOException, TikaException, SpewerException;

	public void setOutputBase(Path outputBase) {
		this.outputBase = outputBase;
	}

	public void setOutputBase(String outputBase) {
		setOutputBase(FileSystems.getDefault().getPath(outputBase));
	}

	public Path filterOutputPath(Path file) {
		if (null != outputBase && file.startsWith(outputBase)) {
			return file.subpath(outputBase.getNameCount(), file.getNameCount());
		}

		return file;
	}

	public void finish() throws IOException {
		logger.info("Spewer finishing pending jobs.");
	}
}

Fix NullPointerException when output base is null


package cfvbaibai.cardfantasy.test;

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

import cfvbaibai.cardfantasy.Randomizer;
import cfvbaibai.cardfantasy.StaticRandomizer;
import cfvbaibai.cardfantasy.engine.GameEngine;
import cfvbaibai.cardfantasy.game.DeckBuilder;
import cfvbaibai.cardfantasy.game.DeckStartupInfo;

@RunWith(Suite.class)
@SuiteClasses({
    RacialBufferTest.class, AttackBuffTest.class, SpecialStatusTest.class,
    DelayTest.class
})
public class FeatureValidationTests {
    public static FeatureTestContext prepare(int playerALevel, int playerBLevel, String ... cards) {
        GameEngine engine = TestGameBuilder.buildEmptyGameForTest(50, 50);
        DeckStartupInfo dsi = DeckBuilder.build(cards);
        FeatureTestContext context = new FeatureTestContext();
        context.setEngine(engine);
        context.setDsi(dsi);
        return context;
    }

    private static StaticRandomizer random;
    public static StaticRandomizer getRandom() {
        return random;
    }
    static {
        random = new StaticRandomizer();
        Randomizer.registerRandomizer(random);
    }
}

package cfvbaibai.cardfantasy.test;

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

import cfvbaibai.cardfantasy.Randomizer;
import cfvbaibai.cardfantasy.StaticRandomizer;
import cfvbaibai.cardfantasy.engine.GameEngine;
import cfvbaibai.cardfantasy.game.DeckBuilder;
import cfvbaibai.cardfantasy.game.DeckStartupInfo;

@RunWith(Suite.class)
@SuiteClasses({
    RacialBufferTest.class, AttackBuffTest.class, SpecialStatusTest.class,
    DelayTest.class
})
public class FeatureValidationTests {
    public static FeatureTestContext prepare(int playerALevel, int playerBLevel, String ... cards) {
        GameEngine engine = TestGameBuilder.buildEmptyGameForTest(50, 50);
        DeckStartupInfo dsi = DeckBuilder.build(cards);
        FeatureTestContext context = new FeatureTestContext();
        context.setEngine(engine);
        context.setDsi(dsi);
        return context;
    }

    private static StaticRandomizer random;
    public static StaticRandomizer getRandom() {
        if (random == null) {
            random = new StaticRandomizer();
            Randomizer.registerRandomizer(random);
        }
        return random;
    }
}

Load test Randomizer lazily to avoid confliction in prod runtime.


package com.thinkaurelius.titan.diskstorage;

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

import java.util.List;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.thinkaurelius.titan.diskstorage.common.DistributedStoreManager;
import com.thinkaurelius.titan.diskstorage.common.DistributedStoreManager.Deployment;
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStore;
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyRange;
import com.thinkaurelius.titan.testcategory.OrderedKeyStoreTests;

public abstract class DistributedStoreManagerTest {

    protected DistributedStoreManager manager;
    protected KeyColumnValueStore store;

    @Test
    @Category({ OrderedKeyStoreTests.class })
    public void testGetDeployment() {
        assertEquals(Deployment.LOCAL, manager.getDeployment());
    }

    @Test
    @Category({ OrderedKeyStoreTests.class })
    public void testGetLocalKeyPartition() throws StorageException {
        List<KeyRange> local = store.getLocalKeyPartition();
        assertNotNull(local);
        assertEquals(1, local.size());
        assertNotNull(local.get(0).getStart());
        assertNotNull(local.get(0).getEnd());
        System.err.println("range: " + local.get(0).getStart() + ":" + local.get(0).getStart().length() + " " + local.get(0).getEnd() + ":" + local.get(0).getEnd().length());
    }

}

package com.thinkaurelius.titan.diskstorage;

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

import java.util.List;

import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.thinkaurelius.titan.diskstorage.common.DistributedStoreManager;
import com.thinkaurelius.titan.diskstorage.common.DistributedStoreManager.Deployment;
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyColumnValueStore;
import com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeyRange;
import com.thinkaurelius.titan.testcategory.OrderedKeyStoreTests;

public abstract class DistributedStoreManagerTest {

    protected DistributedStoreManager manager;
    protected KeyColumnValueStore store;

    @Test
    @Category({ OrderedKeyStoreTests.class })
    public void testGetDeployment() {
        assertEquals(Deployment.LOCAL, manager.getDeployment());
    }

    @Test
    @Category({ OrderedKeyStoreTests.class })
    public void testGetLocalKeyPartition() throws StorageException {
        List<KeyRange> local = store.getLocalKeyPartition();
        assertNotNull(local);
        assertEquals(1, local.size());
        assertNotNull(local.get(0).getStart());
        assertNotNull(local.get(0).getEnd());
    }
}

Remove a System.err.println from a test method


/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package info.zamojski.soft.towercollector.utils;

import android.content.Context;
import android.os.Build;
import android.view.View;
import android.widget.Toast;

import info.zamojski.soft.towercollector.CollectorService;
import info.zamojski.soft.towercollector.R;
import info.zamojski.soft.towercollector.UploaderService;
import info.zamojski.soft.towercollector.tasks.ExportFileAsyncTask;

public class NotificationHelperBase {

    protected static final String COLLECTOR_NOTIFICATION_CHANNEL_ID = "collector_notification_channel";
    protected static final String UPLOADER_NOTIFICATION_CHANNEL_ID = "collector_notification_channel";
    protected static final String OTHER_NOTIFICATION_CHANNEL_ID = "collector_notification_channel";

    protected boolean isUsingNotificationChannel() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
    }

    protected boolean isUsingNotificationPriority() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
    }
}

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package info.zamojski.soft.towercollector.utils;

import android.content.Context;
import android.os.Build;
import android.view.View;
import android.widget.Toast;

import info.zamojski.soft.towercollector.CollectorService;
import info.zamojski.soft.towercollector.R;
import info.zamojski.soft.towercollector.UploaderService;
import info.zamojski.soft.towercollector.tasks.ExportFileAsyncTask;

public class NotificationHelperBase {

    protected static final String COLLECTOR_NOTIFICATION_CHANNEL_ID = "collector_notification_channel";
    protected static final String UPLOADER_NOTIFICATION_CHANNEL_ID = "uploader_notification_channel";
    protected static final String OTHER_NOTIFICATION_CHANNEL_ID = "other_notification_channel";

    protected boolean isUsingNotificationChannel() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
    }

    protected boolean isUsingNotificationPriority() {
        return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
    }
}

Fix incorrect notification channel ids,


/*
 * Copyright (c) 2000-2016 TeamDev Ltd. All rights reserved.
 * Use is subject to Apache 2.0 license terms.
 */

package com.teamdev.jxmaps.examples;

public interface EditableTextControlPanel extends ControlPanel {
    void onTextEntered(String value);

    String getInitialText();
}

Remove excessive empty line after copyright header


package com.micky2506.udaldordecor.block;

import com.micky2506.udaldordecor.lib.Names;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;

public class ModBlocks
{
    public static BlockDisplayCase displayCase;

    public static void init()
    {
        displayCase = new BlockDisplayCase();

        GameRegistry.registerBlock(displayCase, ItemBlockDisplayCase.class, Names.displayCase);

        GameRegistry.addShapedRecipe(new ItemStack(displayCase, 1, 0), "ggg", "gig", "ggg", 'i', Blocks.glass_pane, 'g', Blocks.glass);
    }
}

package com.micky2506.udaldordecor.block;

import com.micky2506.udaldordecor.lib.Names;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

public class ModBlocks
{
    public static BlockDisplayCase displayCase;

    public static void init()
    {
        displayCase = new BlockDisplayCase();

        GameRegistry.registerBlock(displayCase, ItemBlockDisplayCase.class, Names.displayCase);

        GameRegistry.addShapedRecipe(new ItemStack(displayCase, 1, 0), "ggg", "gig", "ggg", 'i', Blocks.glass_pane, 'g', Blocks.glass);
        GameRegistry.addShapedRecipe(new ItemStack(displayCase, 1, 1), "gsg", "gig", "gsg", 'i', Blocks.glass_pane, 'g', Blocks.glass, 's', Items.string);
    }
}

Add recipe for tracking block.


package com.afrozaar.wordpress.wpapi.v2;

import com.afrozaar.wordpress.wpapi.v2.model.Post;
import com.afrozaar.wordpress.wpapi.v2.util.ClientFactory;

import org.assertj.core.api.Assertions;
import org.junit.Test;

import java.util.Properties;

public class ClientTest {

    @Test
    public void foo() {
        Assertions.assertThat("x").isEqualTo("x");
    }

    @Test
    public void posts() {
        Properties properties = new Properties();
        properties.put("baseUrl", "http://localhost/");

        Client client = ClientFactory.fromProperties(properties);

        final PagedResponse<Post> postPagedResponse = client.fetchPosts();

        // TODO

    }
}

package com.afrozaar.wordpress.wpapi.v2;

import com.afrozaar.wordpress.wpapi.v2.model.Post;
import com.afrozaar.wordpress.wpapi.v2.util.ClientFactory;

import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Properties;

public class ClientTest {

    Logger LOG = LoggerFactory.getLogger(ClientTest.class);

    @Test
    public void foo() {
        Assertions.assertThat("x").isEqualTo("x");
    }

    @Test
    public void posts() {

        Properties properties = new Properties();
        properties.put("baseUrl", "http://localhost/");
        properties.put("username", "username");
        properties.put("password", "password");

        LOG.debug("properties: {}", properties);

        Client client = ClientFactory.fromProperties(properties);

        final PagedResponse<Post> postPagedResponse = client.fetchPosts();

        final long count = postPagedResponse.list.stream().count();

        // TODO:

    }
}

Make call to wordpress installation (TODO: mock)


package com.annimon.stream.internal;

import java.io.Closeable;

public final class Compose {

    private Compose() { }

    public static Runnable runnables(final Runnable a, final Runnable b) {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    a.run();
                } catch (Throwable e1) {
                    try {
                        b.run();
                    } catch (Throwable ignore) { }
                    if (e1 instanceof RuntimeException) {
                        throw (RuntimeException) e1;
                    }
                    throw (Error) e1;
                }
                b.run();
            }
        };
    }

    public static Runnable closeables(final Closeable a, final Closeable b) {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    a.close();
                } catch (Throwable e1) {
                    try {
                        b.close();
                    } catch (Throwable ignore) { }
                    if (e1 instanceof RuntimeException) {
                        throw (RuntimeException) e1;
                    }
                    throw (Error) e1;
                }
                try {
                    b.close();
                } catch (Throwable e2) {
                    if (e2 instanceof RuntimeException) {
                        throw (RuntimeException) e2;
                    } else if (e2 instanceof Error) {
                        throw (Error) e2;
                    } else {
                        throw new RuntimeException(e2);
                    }
                }
            }
        };
    }
}

package com.annimon.stream.internal;

import java.io.Closeable;

public final class Compose {

    private Compose() { }

    public static Runnable runnables(final Runnable a, final Runnable b) {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    a.run();
                } catch (Throwable e1) {
                    try {
                        b.run();
                    } catch (Throwable ignore) { }
                    handleException(e1);
                    return;
                }
                b.run();
            }
        };
    }

    public static Runnable closeables(final Closeable a, final Closeable b) {
        return new Runnable() {
            @Override
            public void run() {
                try {
                    a.close();
                } catch (Throwable e1) {
                    try {
                        b.close();
                    } catch (Throwable ignore) { }
                    handleException(e1);
                    return;
                }
                try {
                    b.close();
                } catch (Throwable e2) {
                    handleException(e2);
                }
            }
        };
    }

    private static void handleException(Throwable e) {
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        } else if (e instanceof Error) {
            throw (Error) e;
        } else {
            throw new RuntimeException(e);
        }
    }
}

Fix possible ClassCastException in closeables composer


package com.github.aureliano.evtbridge.annotation.doc;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SchemaProperty {

	public abstract String property();
	public abstract String type();
	public abstract String description();
	public abstract String defaultValue() default "";
	public abstract Class<?> reference() default Class.class;
}

package com.github.aureliano.evtbridge.annotation.doc;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SchemaProperty {

	public abstract String property();
	public abstract String[] types();
	public abstract String description();
	public abstract String defaultValue() default "";
	public abstract Class<?> reference() default Class.class;
}

Change type from String to String[].


/*
 * Copyright (C) 2019 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.android.exoplayer2.ext.flac;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.testutil.DefaultRenderersFactoryAsserts;
import org.junit.Test;
import org.junit.runner.RunWith;

/** Unit test for {@link DefaultRenderersFactoryTest} with {@link LibflacAudioRenderer}. */
@RunWith(AndroidJUnit4.class)
public final class DefaultRenderersFactoryTest {

  @Test
  public void createRenderers_instantiatesFlacRenderer() {
    DefaultRenderersFactoryAsserts.assertExtensionRendererCreated(
        LibflacAudioRenderer.class, C.TRACK_TYPE_AUDIO);
  }
}

/*
 * Copyright (C) 2019 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.android.exoplayer2.ext.flac;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.testutil.DefaultRenderersFactoryAsserts;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.internal.DoNotInstrument;

/** Unit test for {@link DefaultRenderersFactoryTest} with {@link LibflacAudioRenderer}. */
@RunWith(AndroidJUnit4.class)
@DoNotInstrument
public final class DefaultRenderersFactoryTest {

  @Test
  public void createRenderers_instantiatesFlacRenderer() {
    DefaultRenderersFactoryAsserts.assertExtensionRendererCreated(
        LibflacAudioRenderer.class, C.TRACK_TYPE_AUDIO);
  }
}

Add @DoNotInstrument to Flac extension test


package com.realkinetic.app.gabby.repository.downstream.memory;

import com.realkinetic.app.gabby.config.BaseConfig;
import com.realkinetic.app.gabby.config.DefaultConfig;
import com.realkinetic.app.gabby.config.MemoryConfig;
import com.realkinetic.app.gabby.repository.BaseDownstream;
import com.realkinetic.app.gabby.repository.DownstreamSubscription;

import java.util.logging.Logger;

public class MemoryDownstreamTest extends BaseDownstream {
    private static final Logger LOG = Logger.getLogger(MemoryDownstreamTest.class.getName());

    @Override
    protected DownstreamSubscription getDownstream() {
        final BaseConfig config = (BaseConfig) DefaultConfig.load();
        config.setDownstreamTimeout(1);
        final MemoryConfig memoryConfig = new MemoryConfig();
        memoryConfig.setMaxAccesses(10);
        config.setMemoryConfig(memoryConfig);
        return new MemoryDownstream(config, mm -> true);
    }

    @Override
    protected void createTopic(String topic) {
        // just like redis, this simply doesn't matter
    }
}

package com.realkinetic.app.gabby.repository.downstream.memory;

import com.realkinetic.app.gabby.config.BaseConfig;
import com.realkinetic.app.gabby.config.DefaultConfig;
import com.realkinetic.app.gabby.config.MemoryConfig;
import com.realkinetic.app.gabby.repository.BaseDownstream;
import com.realkinetic.app.gabby.repository.DownstreamSubscription;
import org.junit.Assert;
import org.junit.Test;

import java.util.logging.Logger;

public class MemoryDownstreamTest extends BaseDownstream {
    private static final Logger LOG = Logger.getLogger(MemoryDownstreamTest.class.getName());

    @Override
    protected DownstreamSubscription getDownstream() {
        final BaseConfig config = (BaseConfig) DefaultConfig.load();
        config.setDownstreamTimeout(1);
        final MemoryConfig memoryConfig = new MemoryConfig();
        memoryConfig.setMaxAccesses(10);
        config.setMemoryConfig(memoryConfig);
        return new MemoryDownstream(config, mm -> true);
    }

    @Override
    protected void createTopic(String topic) {
        // just like redis, this simply doesn't matter
    }

    @Test
    public void testFail() {
        Assert.fail();
    }
}

Check that circle ci catches failures.


package com.github.sparkcaller.preprocessing;

import com.github.sparkcaller.BaseGATKProgram;
import com.github.sparkcaller.Utils;
import org.apache.spark.api.java.function.Function;
import scala.Tuple2;

import java.io.File;
import java.util.ArrayList;

/*
 * Minimize the amount of mismatching bases across all reads.
 *
 * See:
 * https://www.broadinstitute.org/gatk/gatkdocs/org_broadinstitute_gatk_tools_walkers_indels_RealignerTargetCreator.php
 *
 * For more information.
 *
 */
public class IndelTargetCreator extends BaseGATKProgram implements Function<File, Tuple2<File, File>> {
    public IndelTargetCreator(String pathToReference, String extraArgsString, String coresPerNode) {
        super("RealignerTargetCreator", extraArgsString);
        setReference(pathToReference);
        addArgument("-nt", coresPerNode); // The target creator is better optimized for multiple data threads.
    }

    public Tuple2<File, File> call(File file) throws Exception {
        setInputFile(file.getPath());

        final String outputIntervalsFilename = Utils.removeExtenstion(file.getPath(), "bam") + "-target.intervals";
        File outputIntervalsFile = new File(outputIntervalsFilename);
        setOutputFile(outputIntervalsFile.getPath());

        executeProgram();
        return new Tuple2<File, File>(file, outputIntervalsFile);
   }
}

package com.github.sparkcaller.preprocessing;

import com.github.sparkcaller.BaseGATKProgram;
import com.github.sparkcaller.Utils;
import org.apache.spark.api.java.function.Function;
import scala.Tuple2;

import java.io.File;
import java.util.ArrayList;

/*
 * Minimize the amount of mismatching bases across all reads.
 *
 * See:
 * https://www.broadinstitute.org/gatk/gatkdocs/org_broadinstitute_gatk_tools_walkers_indels_RealignerTargetCreator.php
 *
 * For more information.
 *
 */
public class IndelTargetCreator extends BaseGATKProgram {
    public IndelTargetCreator(String pathToReference, String extraArgsString, String coresPerNode) {
        super("RealignerTargetCreator", extraArgsString);
        setReference(pathToReference);
        addArgument("-nt", coresPerNode); // The target creator is better optimized for multiple data threads.
    }

    public File createTargets(File file) throws Exception {
        setInputFile(file.getPath());

        final String outputIntervalsFilename = Utils.removeExtenstion(file.getPath(), "bam") + "-target.intervals";
        File outputIntervalsFile = new File(outputIntervalsFilename);
        setOutputFile(outputIntervalsFile.getPath());

        executeProgram();
        return outputIntervalsFile;
   }
}

Make it easier to run the RealignerTargetCreator on a single file.


package io.symphonia.lambda.logging;

import static io.symphonia.lambda.logging.DefaultConsoleAppender.NO_REQUEST_ID;

public class MetricsConsoleAppender extends LambdaConsoleAppender {

    @SuppressWarnings("WeakerAccess")
    public static String DEFAULT_METRICS_PATTERN =
            "[%d{yyyy-MM-dd HH:mm:ss.SSS}] %X{AWSRequestId:-" + NO_REQUEST_ID +
                    "} METRIC %logger{5} %replace(%msg){'[,= ]+', ' '}%n";

    public MetricsConsoleAppender() {
        super(DEFAULT_METRICS_PATTERN, new MetricPassFilter());
    }

}

package io.symphonia.lambda.logging;

import static io.symphonia.lambda.logging.DefaultConsoleAppender.NO_REQUEST_ID;

public class MetricsConsoleAppender extends LambdaConsoleAppender {

    @SuppressWarnings("WeakerAccess")
    public static String DEFAULT_METRICS_PATTERN =
            "[%d{yyyy-MM-dd HH:mm:ss.SSS}] %X{AWSRequestId:-" + NO_REQUEST_ID +
                    "} METRIC %logger{5} %replace(%msg){'[,= ]+', ' '}\r";

    public MetricsConsoleAppender() {
        super(DEFAULT_METRICS_PATTERN, new MetricPassFilter());
    }

}

Change newline to carriage return in lambda-metrics pattern


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

/**
 * Core classes for the {@code gcloud-java} library.
 */
package com.google.cloud;

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

/**
 * Core classes for the {@code google-cloud} library.
 */
package com.google.cloud;

Rename gcloud-java to google-cloud in javadoc comments


package org.robolectric.shadows;

import android.content.res.Configuration;
import java.util.Locale;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;

import static org.robolectric.shadow.api.Shadow.directlyOn;

/**
 * Shadow for {@link android.content.res.Configuration}.
 */
@Implements(Configuration.class)
public class ShadowConfiguration {

}

package org.robolectric.shadows;

import android.content.res.Configuration;
import java.util.Locale;

import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.RealObject;

import static org.robolectric.shadow.api.Shadow.directlyOn;

/**
 * Shadow for {@link android.content.res.Configuration}.
 * @deprecated This will be removed in Robolectric 3.4 - {@link Configuration} is pure Java so there is no need for a
 * shadow to exist. The methods have been preserved but marked deprecated to prevent build breakages but in this
 * version implementation has been modified to simply call through to the Framework code which may in some cases cause
 * test failures due to the way the shadow diverged in behaviour from the Framework code. Some notes have been added
 * to help you migrate in these cases.
 *
 * Some notes to help you migrate:-
 *
 * <ol>
 * <li>{@link #setLocale} only exists in API 17+ so calling this on earlier APIs will fail with {@link NoSuchMethodException}
 * <li>{@link #setToDefaults()} overrides the frameworks natural defaults to set the flags for
 *     {@link Configuration#screenLayout} to include {@link Configuration#SCREENLAYOUT_LONG_NO} and
 *     {@link Configuration#SCREENLAYOUT_SIZE_NORMAL}
 * <li>{@link #overrideQualifiers} and {@link #getQualifiers()} have no effect and can be removed.
 * </ol>
 */
@Deprecated
@Implements(Configuration.class)
public class ShadowConfiguration {

  @RealObject
  private Configuration realConfiguration;

  @Deprecated
  @Implementation
  public void setTo(Configuration o) {
    directlyOn(realConfiguration, Configuration.class).setTo(o);
  }

  @Deprecated
  @Implementation
  public void setToDefaults() {
    directlyOn(realConfiguration, Configuration.class).setToDefaults();
  }

  @Deprecated
  @Implementation
  public void setLocale( Locale l ) {
    directlyOn(realConfiguration, Configuration.class).setLocale(l);
  }

  @Deprecated
  public void overrideQualifiers(String qualifiers) {
    // Never worked.
  }

  /**
   * @deprecated  Use {@link RuntimeEnvironment#getQualifiers()} although there should be no reason to obtain this
   * since it is typically set in tests through {@link Config#qualifiers()} so you should use a constant in these cases.
   */
  @Deprecated
  public String getQualifiers() {
    return RuntimeEnvironment.getQualifiers();
  }
}

Mark the common methods @Deprecated.


// Copyright 2008 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.enterprise.saml.client;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import java.io.IOException;

/**
 * The MockArtifactResolver interface models an artifact resolution service.  MockArtifactConsumer
 * communicates with an object of this type.
 */
public interface MockArtifactResolver {
  public MockHttpServletResponse resolve(MockHttpServletRequest request) throws IOException;
}

// Copyright 2008 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.enterprise.saml.client;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import java.io.IOException;

import javax.servlet.ServletException;

/**
 * The MockArtifactResolver interface models an artifact resolution service.  MockArtifactConsumer
 * communicates with an object of this type.
 */
public interface MockArtifactResolver {
  public MockHttpServletResponse resolve(MockHttpServletRequest request) throws ServletException, IOException;
}

Allow the resolver to signal servlet exceptions.


package org.musicbrainz.search.solrwriter;

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

public abstract class AbstractMBWriterRecordingTest extends AbstractMBWriterTest {
	@Override
	public ArrayList<String> getDoc() {
		return new ArrayList<>(Arrays.asList(new String[]{
				"mbid", uuid,
				"recording", "Roots and Beginnings",
				"name", "Roots and Beginnings",
				"arid", "9b58672a-e68e-4972-956e-a8985a165a1f",
				"artist", "Howard Shore",
				"artistname", "Howard Shore",
				"creditname", "Howard Shore",
				"video", "false"
		}));
	}
}

package org.musicbrainz.search.solrwriter;

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

public abstract class AbstractMBWriterRecordingTest extends AbstractMBWriterTest {
	@Override
	public ArrayList<String> getDoc() {
		return new ArrayList<>(Arrays.asList(new String[]{
				"mbid", uuid,
				"recording", "Roots and Beginnings",
				"arid", "9b58672a-e68e-4972-956e-a8985a165a1f",
				"artist", "Howard Shore",
				"artistname", "Howard Shore",
				"creditname", "Howard Shore",
				"video", "false"
		}));
	}
}

Remove redundant name field from Recording doc


#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )

package ${package}.model;

import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;
import org.hibernate.validator.NotNull;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
@Searchable
public class MyEntity {

    @Id
    @SearchableId
    private Long id;

    @NotNull
    @SearchableProperty
    private String myProp;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMyProp() {
        return myProp;
    }

    public void setMyProp(String myProp) {
        this.myProp = myProp;
    }
}

#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )

package ${package}.model;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class MyEntity {

    @Id
    private Long id;

    private String myProp;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMyProp() {
        return myProp;
    }

    public void setMyProp(String myProp) {
        this.myProp = myProp;
    }
}

Remove Compass and Hibernate dependencies


package sg.ncl.testbed_interface.repositories.jpa.entities;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.time.ZonedDateTime;

/**
 * @author Christopher Zhong
 */
@MappedSuperclass
@EntityListeners({AuditingEntityListener.class})
public class AbstractEntity {

//    @Column(name = "created_by")
//    @CreatedBy
//    private String createdBy;

    @Column(name = "created_date", nullable = false)
    @CreatedDate
    private ZonedDateTime createdDate;

//    @Column(name = "last_modified_by")
//    @LastModifiedBy
//    private String lastModifiedBy;

    @Column(name = "last_modified_date", nullable = false)
    @LastModifiedDate
    private ZonedDateTime lastModifiedDate;

    public ZonedDateTime getCreatedDate() {
        return createdDate;
    }

    public ZonedDateTime getLastModifiedDate() {
        return lastModifiedDate;
    }

}

package sg.ncl.testbed_interface.repositories.jpa.entities;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import java.time.ZonedDateTime;

/**
 * @author Christopher Zhong
 */
@MappedSuperclass
@EntityListeners({AuditingEntityListener.class})
public class AbstractEntity {

//    @Column(name = "created_by")
//    @CreatedBy
//    private String createdBy;

    @Column(name = "created_date", nullable = false)
    @CreatedDate
    private ZonedDateTime createdDate;

//    @Column(name = "last_modified_by")
//    @LastModifiedBy
//    private String lastModifiedBy;

    @Column(name = "last_modified_date", nullable = false)
    @LastModifiedDate
    private ZonedDateTime lastModifiedDate;

    @Version
    @Column(name = "version", nullable = false)
    private Long version = 0L;

    public ZonedDateTime getCreatedDate() {
        return createdDate;
    }

    protected void setCreatedDate(final ZonedDateTime createdDate) {
        this.createdDate = createdDate;
    }

    public ZonedDateTime getLastModifiedDate() {
        return lastModifiedDate;
    }

    protected void setLastModifiedDate(final ZonedDateTime lastModifiedDate) {
        this.lastModifiedDate = lastModifiedDate;
    }

    public Long getVersion() {
        return version;
    }

    protected void setVersion(final Long version) {
        this.version = version;
    }

}

Add versioning to JPA entities (DEV-15)


/*
 * Copyright 2011 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.api.artifacts.cache;

import org.gradle.api.Action;

/**
 * Represents a set of rules/actions that can be applied during dependency resolution.
 * Currently these are restricted to controlling caching, but these could possibly be extended in the future to include other manipulations.
 */
public interface ResolutionRules {
    /**
     * Apply a rule to control resolution of dependencies.
     * @param rule the rule to apply
     */
    void eachDependency(Action<? super DependencyResolutionControl> rule);

    /**
     * Apply a rule to control resolution of modules.
     * @param rule the rule to apply
     */
    void eachModule(Action<? super ModuleResolutionControl> rule);

    /**
     * Apply a rule to control resolution of artifacts.
     * @param rule the rule to apply
     */
    void eachArtifact(Action<? super ArtifactResolutionControl> rule);
}

/*
 * Copyright 2011 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.api.artifacts.cache;

import org.gradle.api.Action;
import org.gradle.api.Experimental;

/**
 * Represents a set of rules/actions that can be applied during dependency resolution.
 * Currently these are restricted to controlling caching, but these could possibly be extended in the future to include other manipulations.
 */
@Experimental
public interface ResolutionRules {
    /**
     * Apply a rule to control resolution of dependencies.
     * @param rule the rule to apply
     */
    void eachDependency(Action<? super DependencyResolutionControl> rule);

    /**
     * Apply a rule to control resolution of modules.
     * @param rule the rule to apply
     */
    void eachModule(Action<? super ModuleResolutionControl> rule);

    /**
     * Apply a rule to control resolution of artifacts.
     * @param rule the rule to apply
     */
    void eachArtifact(Action<? super ArtifactResolutionControl> rule);
}

Mark cache-control DSL entry point as @Experimental


package org.geotools.data.ogr.bridj;

import org.geotools.data.ogr.GeometryMapperTest;
public class BridjGeometryMapperTest extends GeometryMapperTest {

    public BridjGeometryMapperTest() {
        super(BridjOGRDataStoreFactory.class);
    }

    @Override
    protected void setUp() throws Exception {
        GdalInit.init();
    }

}

package org.geotools.data.ogr.bridj;

import org.geotools.data.ogr.GeometryMapperTest;
public class BridjGeometryMapperTest extends GeometryMapperTest {

    public BridjGeometryMapperTest() {
        super(BridjOGRDataStoreFactory.class);
    }

    @Override
    protected void setUp() throws Exception {
        GdalInit.init();
        super.setUp();
    }

}

Fix Bridj unit test. The overridden setup methods needs to call super.


/*
 * 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 io.prestosql.plugin.iceberg;

import io.prestosql.spi.connector.Connector;
import io.prestosql.spi.connector.ConnectorContext;
import io.prestosql.spi.connector.ConnectorFactory;

import java.util.Map;
import java.util.Optional;

import static io.prestosql.plugin.iceberg.InternalIcebergConnectorFactory.createConnector;

public class IcebergConnectorFactory
        implements ConnectorFactory
{
    @Override
    public String getName()
    {
        return "iceberg";
    }

    @Override
    public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
    {
        return createConnector(catalogName, config, context, Optional.empty());
    }
}

/*
 * 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 io.prestosql.plugin.iceberg;

import io.prestosql.spi.connector.Connector;
import io.prestosql.spi.connector.ConnectorContext;
import io.prestosql.spi.connector.ConnectorFactory;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Optional;

import static com.google.common.base.Throwables.throwIfUnchecked;

public class IcebergConnectorFactory
        implements ConnectorFactory
{
    @Override
    public String getName()
    {
        return "iceberg";
    }

    @Override
    public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
    {
        ClassLoader classLoader = context.duplicatePluginClassLoader();
        try {
            return (Connector) classLoader.loadClass(InternalIcebergConnectorFactory.class.getName())
                    .getMethod("createConnector", String.class, Map.class, ConnectorContext.class, Optional.class)
                    .invoke(null, catalogName, config, context, Optional.empty());
        }
        catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            throwIfUnchecked(targetException);
            throw new RuntimeException(targetException);
        }
        catch (ReflectiveOperationException e) {
            throw new RuntimeException(e);
        }
    }
}

Use class loader isolation for Iceberg connector instances


package com.github.kohanyirobert.mongoroid;

import com.github.kohanyirobert.ebson.BsonDocuments;

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

public final class MongoCollectionSimpleSingleIndexTest
    extends AbstractMongoConnectionSimpleSingleTest {

  private MongoDatabase database;
  private MongoCollection collection;

  public MongoCollectionSimpleSingleIndexTest() {}

  @Override
  @Before
  public void setUp() throws MongoException {
    super.setUp();
    database = connection.database("test");
    collection = database.collection("test");
    collection.insert(MongoInserts.builder()
        .documents(BsonDocuments.of("a", "a"))
        .documents(BsonDocuments.of("a", "b"))
        .documents(BsonDocuments.of("a", "c"))
        .build());
  }

  @Test
  public void indexSimpleField() throws MongoException {
    collection.index(MongoIndexes.builder()
        .name("a")
        .selector(BsonDocuments.of("a", Integer.valueOf(1)))
        .build());

    Assert.assertEquals(1, database.collection("system.indexes")
        .count(MongoCounts.builder()
            .selector(BsonDocuments.builder()
                .put("key.a", Integer.valueOf(1))
                .put("ns", database.name() + "." + collection.name())
                .build())
            .build()));
  }
}

package com.github.kohanyirobert.mongoroid;

import com.github.kohanyirobert.ebson.BsonDocuments;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public final class MongoCollectionSimpleSingleIndexTest
    extends AbstractMongoConnectionSimpleSingleTest {

  private MongoDatabase database;
  private MongoCollection collection;

  public MongoCollectionSimpleSingleIndexTest() {}

  @Override
  @Before
  public void setUp() throws MongoException {
    super.setUp();
    database = connection.database("test");
    collection = database.collection("test");
    collection.insert(MongoInserts.builder()
        .documents(BsonDocuments.of("a", "a"))
        .documents(BsonDocuments.of("a", "b"))
        .documents(BsonDocuments.of("a", "c"))
        .build());
  }

  @Override
  @After
  public void tearDown() throws MongoException {
    database.command(BsonDocuments.of("dropIndexes", "test", "index", "*"));
  }

  @Test
  public void indexSimpleField() throws MongoException {
    collection.index(MongoIndexes.builder()
        .name("a")
        .selector(BsonDocuments.of("a", Integer.valueOf(1)))
        .build());

    Assert.assertEquals(1, database.collection("system.indexes")
        .count(MongoCounts.builder()
            .selector(BsonDocuments.builder()
                .put("key.a", Integer.valueOf(1))
                .put("ns", database.name() + "." + collection.name())
                .build())
            .build()));
  }
}

Add tear down method to the index tests.


package com.spring.example.concurrency.collections;

import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;

public class SetCollection {

    /**
     * ConcurrentSkipListSet store elements like natural order collection
     *
     * @param args command line arguments
     */
    public static void main(String[] args) {
        Set<Integer> set = new ConcurrentSkipListSet<>();
        //Init set in one thread
        for (int i = 0; i < 10; i++) {
            if (i % 2 == 0)
                set.add(i + 500);
            else
                set.add(i);
        }
        System.out.println(set);
        new Thread(() -> {
           for (Integer element : set) {
               System.out.println("Set : " + set);
               System.out.println("Set element: " + element);
               System.out.println("Set size: " + set.size());

           }
        }).start();
        new Thread(() -> {
            for (int i = 0; i < 200; i++) {
                if (i % 2 == 0)
                    set.add(i + 500);
                else
                    set.add(i);
            }
        }).start();
    }
}

package com.spring.example.concurrency.collections;

import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;

public class SetCollection {

    /**
     * ConcurrentSkipListSet store elements like natural order collection
     *
     * @param args command line arguments
     */
    public static void main(String[] args) {
        Set<Integer> set = new ConcurrentSkipListSet<>();
        //Init set in one thread
        for (int i = 0; i < 10; i++) {
            if (i % 2 == 0)
                set.add(i + 500);
            else
                set.add(i);
        }
        System.out.println(set);
        new Thread(() -> {
           for (Integer element : set) {
               System.out.println("Set : " + set);
               System.out.println("Set element: " + element);
               System.out.println("Set size: " + set.size());

           }
        }).start();
        new Thread(() -> {
            for (int i = 0; i < 200; i++) {
                if (i % 2 == 0)
                    set.add(i + 500);
                else
                    set.add(i);
            }
        }).start();
    }

    //Set in natural order
    public static void skipSet() {
        Set<Integer> set = new ConcurrentSkipListSet<>();
        new Thread(() -> {
            for (int i = 0; i < 200; i++) {
                if (i % 2 == 0)
                    set.add(i);
                else
                    set.add(i + 500);
            }
            System.out.println(set);
        }).start();
    }
}

Add ConcurrentSkipListSet set with naturel order of elements