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;

OAK-3898: Add filter capabilities to the segment graph run mode
Bump export version

git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1725678 13f79535-47bb-0310-9956-ffa450edef68


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).

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.

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

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

Some user hit the issue that after pants finishes, scala plugin compiler builder also started to build and cause error. Since all comiplation can/should be handled by pants, we should completely block scala plugin from compiling our code.

Testing Done:
https://travis-ci.org/wisechengyi/intellij-pants-plugin/builds/110483748

Reviewed at https://rbcommons.com/s/twitter/r/3483/


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.

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

PiperOrigin-RevId: 273929000


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

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

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"

Revert "check user exists by email"

This reverts commit 677654e72d5c40db1f6b4217776bf93bfc76b5f4.


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,

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.

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[].

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

PiperOrigin-RevId: 370739641


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.

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;
   }
}

[Genomics]: Make it easier to run the RealignerTargetCreator on a single file.

RealignerTargetCreator is not scatter-gatherable, so we thus have to merge the
SAM files before obtaining the targets.

See:
http://gatkforums.broadinstitute.org/gatk/discussion/1975/how-can-i-use-parallelism-to-make-gatk-tools-run-faster

for more information,


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.

Mark the common methods @Deprecated.

This avoids build breakages and allows users to upgrade Robolectric
without breakges as they migrate. Implementation has been changed to
call through by default. In some cases this will result in test failures
but this is highly unlikely. In such cases Javadoc has been added to
illustrate how the deprecated ShadowConfiguration had diverged from the
framework code.


// 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)

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.

Indexes created by tests will be deleted after each run.


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


package com.elmakers.mine.bukkit.api.spell;

/**
 * Every Spell will return a SpellResult when cast. This result
 * will determine the messaging and effects used, as well as whether
 * or not the Spell cast consumes its CastingCost costs.
 *
 * A Spell that fails to cast will not consume costs or register for cooldown.
 */
public enum SpellResult {
	CAST,
	AREA,
	FIZZLE,
	BACKFIRE,
	FAIL,
	CANCEL,
	INSUFFICIENT_RESOURCES,
	INSUFFICIENT_PERMISSION,
	COOLDOWN,
	NO_TARGET,
	RESTRICTED,
	TARGET_SELECTED,
	PLAYER_REQUIRED,
	WORLD_REQUIRED,
	INVALID_WORLD,
	COST_FREE;

	/**
	 * Determine if this result is a success or not.
	 *
	 * @return True if this cast was a success.
	 */
	public boolean isSuccess() {
		return this == CAST || this == AREA || this == FIZZLE || this == BACKFIRE;
	}
}

package com.elmakers.mine.bukkit.api.spell;

/**
 * Every Spell will return a SpellResult when cast. This result
 * will determine the messaging and effects used, as well as whether
 * or not the Spell cast consumes its CastingCost costs.
 *
 * A Spell that fails to cast will not consume costs or register for cooldown.
 */
public enum SpellResult {
	CAST,
	AREA,
	FIZZLE,
	BACKFIRE,
	FAIL,
	CANCEL,
	INSUFFICIENT_RESOURCES,
	INSUFFICIENT_PERMISSION,
	COOLDOWN,
	NO_TARGET,
	RESTRICTED,
	TARGET_SELECTED,
    ENTITY_REQUIRED,
    LIVING_ENTITY_REQUIRED,
    PLAYER_REQUIRED,
    LOCATION_REQUIRED,
    WORLD_REQUIRED,
	INVALID_WORLD,
	COST_FREE;

	/**
	 * Determine if this result is a success or not.
	 *
	 * @return True if this cast was a success.
	 */
	public boolean isSuccess() {
		return this == CAST || this == AREA || this == FIZZLE || this == BACKFIRE;
	}
}

Add some new spell result types

Add some new spell result types


package me.rafaskb.ticketmaster.commands;

import org.bukkit.command.CommandSender;

import me.rafaskb.ticketmaster.utils.Lang;
import me.rafaskb.ticketmaster.utils.LangConfig;
import me.rafaskb.ticketmaster.utils.Perm;

public class CommandReload extends Command {

	public CommandReload() {
		super(Perm.RELOAD);
	}

	@Override
	protected void run(CommandSender sender, String[] args) {
		LangConfig.reloadConfig();
		Lang.sendMessage(sender, Lang.RELOAD_MESSAGE);
	}

}

package me.rafaskb.ticketmaster.commands;

import me.rafaskb.ticketmaster.utils.ConfigLoader;
import org.bukkit.command.CommandSender;

import me.rafaskb.ticketmaster.utils.Lang;
import me.rafaskb.ticketmaster.utils.LangConfig;
import me.rafaskb.ticketmaster.utils.Perm;

public class CommandReload extends Command {

	public CommandReload() {
		super(Perm.RELOAD);
	}

	@Override
	protected void run(CommandSender sender, String[] args) {
		LangConfig.reloadConfig();
		ConfigLoader.reloadConfig();
		Lang.sendMessage(sender, Lang.RELOAD_MESSAGE);
	}

}

Fix config not reloading by reload command


/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;

public enum ExternalStatus {
  INITIATED(1),
  SUBMITTED(2),
  AUTHORIZED(3),
  APPROVED(4),
  RELEASED(5),
  SKIPPED(-1);

  private int value;

  ExternalStatus(int value) {
    this.value = value;
  }

  @JsonIgnore
  public boolean isPreAuthorize() {
    return value == 1 || value == 2;
  }

  @JsonIgnore
  public boolean isPostSubmitted() {
    return value >= 2;
  }

}

/*
 * This program is part of the OpenLMIS logistics management information system platform software.
 * Copyright © 2017 VillageReach
 *
 * This program is free software: you can redistribute it and/or modify it under the terms
 * of the GNU Affero General Public License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program 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 Affero General Public License for more details. You should have received a copy of
 * the GNU Affero General Public License along with this program. If not, see
 * http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org.
 */

package org.openlmis.fulfillment.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;

public enum ExternalStatus {
  INITIATED(1),
  SUBMITTED(2),
  AUTHORIZED(3),
  IN_APPROVAL(4),
  APPROVED(5),
  RELEASED(6),
  SKIPPED(-1);

  private int value;

  ExternalStatus(int value) {
    this.value = value;
  }

  @JsonIgnore
  public boolean isPreAuthorize() {
    return value == 1 || value == 2;
  }

  @JsonIgnore
  public boolean isPostSubmitted() {
    return value >= 2;
  }

}

Add IN_APPROVAL to list of statuses

Add IN_APPROVAL to list of statuses

To match requisition statuses.


package pt.ist.rc.paragraph.loader.direct;

import pt.ist.rc.paragraph.model.Graph;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.function.Function;

public class DirectLoader<VV, EV> {
    private final Reader r;
    private final Function<String, VV> loadVertexDataFunction;
    private final Function<String, EV> loadEdgeDataFunction;

    public DirectLoader(Reader r, Function<String, VV> loadVertexDataFunction, Function<String, EV> loadEdgeDataFunction) {
        this.r = r;
        this.loadVertexDataFunction = loadVertexDataFunction;
        this.loadEdgeDataFunction = loadEdgeDataFunction;
    }

    public DirectLoader(Reader r) {
        this(r, x -> null, x -> null);
    }

    public Graph<VV, EV> load() throws IOException {
        Graph.BuilderEdges<VV, EV> partialGraph = new Graph.BuilderEdges<>();

        try(BufferedReader br = new BufferedReader(r)) {
            for(String line = br.readLine(); line != null; line = br.readLine()) { // TODO: Check what happens when reader is empty
                if (line.startsWith("#")) continue;

                final String[] idxs = line.split(" ");

                int fromIdx = Integer.parseInt(idxs[0]);
                int toIdx = Integer.parseInt(idxs[1]);

                partialGraph.addEdge(fromIdx, toIdx);
            }
        }

        return partialGraph.build();
    }
}

package pt.ist.rc.paragraph.loader.direct;

import pt.ist.rc.paragraph.model.Graph;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.function.Function;

public class DirectLoader<VV, EV> {
    private final Reader r;
    private final Function<String, VV> loadVertexDataFunction;
    private final Function<String, EV> loadEdgeDataFunction;

    public DirectLoader(Reader r, Function<String, VV> loadVertexDataFunction, Function<String, EV> loadEdgeDataFunction) {
        this.r = r;
        this.loadVertexDataFunction = loadVertexDataFunction;
        this.loadEdgeDataFunction = loadEdgeDataFunction;
    }

    public DirectLoader(Reader r) {
        this(r, x -> null, x -> null);
    }

    public Graph<VV, EV> load() throws IOException {
        Graph.BuilderEdges<VV, EV> partialGraph = new Graph.BuilderEdges<>();

        try(BufferedReader br = new BufferedReader(r)) {
            for(String line = br.readLine(); line != null; line = br.readLine()) { // TODO: Check what happens when reader is empty
                if (line.startsWith("#")) continue;

                final String[] idxs = line.split("\\s");

                int fromIdx = Integer.parseInt(idxs[0]);
                int toIdx = Integer.parseInt(idxs[1]);

                partialGraph.addEdge(fromIdx, toIdx);
            }
        }

        return partialGraph.build();
    }
}

Fix Direct parser's token separator

Fix Direct parser's token separator

The idea is to support tabs as a separator, besides spaces.