package name.snavrotskiy.ant.listener;

import com.google.common.base.Preconditions;
import org.jetbrains.annotations.NotNull;

import java.net.URL;

/**
 * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
 * <p>
 * Notification parameters
 */
class NotificationParams {
    /**
     * Tray icon.
     */
    private final URL icon;
    /**
     * Notification title.
     */
    private final String title;
    /**
     * Notification message.
     */
    private final String message;

    /**
     * Default constructor. All parameters have to be non-null
     *
     * @param trayIcon            tray icon
     * @param notificationTitle   notification title
     * @param notificationMessage notification message
     */
    NotificationParams(@NotNull final URL trayIcon, @NotNull final String notificationTitle, @NotNull final String notificationMessage) {
        Preconditions.checkNotNull(trayIcon);
        Preconditions.checkNotNull(notificationTitle);
        Preconditions.checkNotNull(notificationMessage);

        icon = trayIcon;
        title = notificationTitle;
        message = notificationMessage;
    }

    /**
     * Get uri for tray icon.
     *
     * @return uri
     */
    URL getIcon() {
        return icon;
    }

    /**
     * Get notification title.
     *
     * @return title
     */
    String getTitle() {
        return title;
    }

    /**
     * Get notification message.
     *
     * @return message
     */
    String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "NotificationParams{"
                + "icon=" + icon
                + ", title='" + title + '\''
                + ", message='" + message + '\''
                + '}';
    }
}

package name.snavrotskiy.ant.listener;

import org.jetbrains.annotations.NotNull;

import java.net.URL;

/**
 * This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
 * <p>
 * Notification parameters
 */
class NotificationParams {
    /**
     * Tray icon.
     */
    private final URL icon;
    /**
     * Notification title.
     */
    private final String title;
    /**
     * Notification message.
     */
    private final String message;

    /**
     * Default constructor. All parameters have to be non-null
     *
     * @param trayIcon            tray icon
     * @param notificationTitle   notification title
     * @param notificationMessage notification message
     */
    NotificationParams(@NotNull final URL trayIcon, @NotNull final String notificationTitle, @NotNull final String notificationMessage) {
        icon = trayIcon;
        title = notificationTitle;
        message = notificationMessage;
    }

    /**
     * Get uri for tray icon.
     *
     * @return uri
     */
    URL getIcon() {
        return icon;
    }

    /**
     * Get notification title.
     *
     * @return title
     */
    String getTitle() {
        return title;
    }

    /**
     * Get notification message.
     *
     * @return message
     */
    String getMessage() {
        return message;
    }
}

Remove null checks for notification params


package net.md_5.bungee.command;

import java.util.Collection;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;

/**
 * Command to list all players connected to the proxy.
 */
public class CommandList extends Command
{

    public CommandList()
    {
        super( "glist", "bungeecord.command.list" );
    }

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        StringBuilder users = new StringBuilder();
        Collection<ProxiedPlayer> connections = ProxyServer.getInstance().getPlayers();

        if ( connections.isEmpty() )
        {
            sender.sendMessage( ChatColor.BLUE + "Currently no players online." );
            return;
        }

        for ( ProxiedPlayer player : connections )
        {
            users.append( player.getDisplayName() );
            users.append( ", " );
            users.append( ChatColor.RESET );
        }

        users.setLength( users.length() - 2 );
        sender.sendMessage( ChatColor.BLUE + "Currently online across all servers (" + connections.size() + "): " + ChatColor.RESET + users );
    }
}

package net.md_5.bungee.command;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;

/**
 * Command to list all players connected to the proxy.
 */
public class CommandList extends Command
{

    public CommandList()
    {
        super( "glist", "bungeecord.command.list" );
    }

    @Override
    public void execute(CommandSender sender, String[] args)
    {
        for ( ServerInfo server : ProxyServer.getInstance().getServers().values() )
        {
            Collection<ProxiedPlayer> serverPlayers = server.getPlayers();

            StringBuilder message = new StringBuilder();
            message.append( "[" );
            message.append( server.getName() );
            message.append( "] (" );
            message.append( serverPlayers.size() );
            message.append( "): " );

            List<String> players = new ArrayList<>();
            for ( ProxiedPlayer player : serverPlayers )
            {
                players.add( player.getDisplayName() );
            }

            if ( !players.isEmpty() )
            {
                for ( String player : players )
                {
                    message.append( player ).append( ChatColor.RESET ).append( ", " );
                }
            }

            sender.sendMessage( message.substring( 0, message.length() - 2 ) );
        }

        sender.sendMessage( "Total players online: " + ProxyServer.getInstance().getPlayers().size() );
    }
}

Rewrite list command for per server breakdown, and alphabetizing.


package com.springapp.batch;

import com.springapp.batch.bo.Person;
import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CompareEntryTest {

    public static final String BILL_DOB = "1970-01-08T12:30:49+05:30";
    public static final String PAUL_DOB = "1970-01-09T15:30:49+05:30";

    @Test
    public void testJob() throws Exception {
        Person bill = mock(Person.class);
        Person paul = mock(Person.class);

        when(bill.getDateOfBirth()).thenReturn(DateTime.parse(BILL_DOB));
        when(paul.getDateOfBirth()).thenReturn(DateTime.parse(PAUL_DOB));

        Assert.assertEquals(1, bill.compareTo(paul));
    }

}

package com.springapp.batch;

import com.springapp.batch.bo.Person;
import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class CompareEntryTest {

    public static final String BILL_DOB = "1970-01-08T12:30:49+05:30";
    public static final String PAUL_DOB = "1970-01-09T15:30:49+05:30";

    /**
     * This test implements Task 3 of the assignment
     * If this fails we don't get the job
     *
     * @throws Exception
     */
    @Test
    public void testAssignmentTask() throws Exception {
        Person bill = mock(Person.class);
        Person paul = mock(Person.class);

        when(bill.getDateOfBirth()).thenReturn(DateTime.parse(BILL_DOB));
        when(paul.getDateOfBirth()).thenReturn(DateTime.parse(PAUL_DOB));

        Assert.assertEquals(1, bill.compareTo(paul));
    }

}

Add an explanation what this test does

Add an explanation what this test does


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

import com.voxelplugineering.voxelsniper.GunsmithMain;

/**
 * The main class for utility functions.
 */
public class PlatformMain extends GunsmithMain
{

    /**
     * The main method.
     *
     * @param args The program arguments
     */
    public static void main(String[] args)
    {
        GunsmithMain.main(args);
    }

}

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

import com.voxelplugineering.voxelsniper.GunsmithMain;

/**
 * The main class for utility functions.
 */
public class PlatformMain
{

    /**
     * The main method.
     *
     * @param args The program arguments
     */
    public static void main(String[] args)
    {
        GunsmithMain.main(args);
    }

}

Fix platform main needlessly extending gunsmith main


package com.chillingvan.canvasgl.glview.texture.gles;

import android.os.Build;

/**
 * Created by Chilling on 2017/1/2.
 */

public class EglHelperFactory {

    public static IEglHelper create(GLThread.EGLConfigChooser configChooser, GLThread.EGLContextFactory eglContextFactory
            , GLThread.EGLWindowSurfaceFactory eglWindowSurfaceFactory) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
            return new EglHelperAPI17(configChooser, eglContextFactory, eglWindowSurfaceFactory);
        } else {
            return new EglHelper(configChooser, eglContextFactory, eglWindowSurfaceFactory);
        }
    }

}

package com.chillingvan.canvasgl.glview.texture.gles;

import android.os.Build;

/**
 * Created by Chilling on 2017/1/2.
 */

public class EglHelperFactory {

    public static IEglHelper create(GLThread.EGLConfigChooser configChooser, GLThread.EGLContextFactory eglContextFactory
            , GLThread.EGLWindowSurfaceFactory eglWindowSurfaceFactory) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
            return new EglHelperAPI17(configChooser, eglContextFactory, eglWindowSurfaceFactory);
        } else {
            return new EglHelper(configChooser, eglContextFactory, eglWindowSurfaceFactory);
        }
    }

}

Use old Egl api to compatible 4.4

Use old Egl api to compatible 4.4


package com.evollu.react.fa;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class FIRAnalyticsPackage implements ReactPackage {

    public FIRAnalyticsPackage() {
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new FIRAnalyticsModule(reactContext));
        return modules;
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Arrays.<ViewManager>asList();
    }
}

package com.evollu.react.fa;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class FIRAnalyticsPackage implements ReactPackage {

    public FIRAnalyticsPackage() {
    }

    @Override
    public List<NativeModule> createNativeModules(
            ReactApplicationContext reactContext) {
        List<NativeModule> modules = new ArrayList<>();

        modules.add(new FIRAnalyticsModule(reactContext));
        return modules;
    }

    // Deprecated RN 0.47
    public List<Class<? extends JavaScriptModule>> createJSModules() {
        return Collections.emptyList();
    }

    @Override
    public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
        return Arrays.<ViewManager>asList();
    }
}

Revert "remove function for RN 0.47"

Revert "remove function for RN 0.47"

This reverts commit cf19c41c9c6ae79c13e482d11fdba017aa735925.


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

package org.apache.hadoop.fs.swift.auth;

/**
 * This class is used for correct hierarchy mapping of
 * Keystone authentication model and java code
 * THIS FILE IS MAPPED BY JACKSON TO AND FROM JSON.
 * DO NOT RENAME OR MODIFY FIELDS AND THEIR ACCESSORS.
 */
public class AuthenticationWrapperV3 {

  /**
   * authentication response field
   */
  private AuthenticationResponseV3 token;

  /**
   * @return authentication response
   */
  public AuthenticationResponseV3 getToken() {
    return token;
  }

  /**
   * @param access sets authentication response
   */
  public void setToken(AuthenticationResponseV3 token) {
    this.token = token;
  }
}

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

package org.apache.hadoop.fs.swift.auth;

/**
 * This class is used for correct hierarchy mapping of
 * Keystone authentication model and java code
 * THIS FILE IS MAPPED BY JACKSON TO AND FROM JSON.
 * DO NOT RENAME OR MODIFY FIELDS AND THEIR ACCESSORS.
 */
public class AuthenticationWrapperV3 {

  /**
   * authentication response field
   */
  private AuthenticationResponseV3 token;

  /**
   * @return authentication response
   */
  public AuthenticationResponseV3 getToken() {
    return token;
  }

  /**
   * @param token sets authentication response
   */
  public void setToken(AuthenticationResponseV3 token) {
    this.token = token;
  }
}

Modify a description of the parameters to function.

Change-Id: Ic6d9354df8ec180da91fcf88df15f2e054a9be11


/* This file is part of SableCC ( http://sablecc.org ).
 *
 * See the NOTICE file distributed with this work for copyright information.
 *
 * 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.sablecc.sablecc.lrautomaton;

import java.util.*;

public abstract class Action {

    private final Map<Integer, Set<Item>> distanceToItemSetMap;

    Action(
            Map<Integer, Set<Item>> distanceToItemSetMap) {

        if (distanceToItemSetMap != null) {
            this.distanceToItemSetMap = distanceToItemSetMap;
        }
        else {
            this.distanceToItemSetMap = new LinkedHashMap<Integer, Set<Item>>();
        }
    }
}

/* This file is part of SableCC ( http://sablecc.org ).
 *
 * See the NOTICE file distributed with this work for copyright information.
 *
 * 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.sablecc.sablecc.lrautomaton;

import java.util.*;

public abstract class Action {

    private final Map<Integer, Set<Item>> distanceToItemSetMap;

    Action(
            Map<Integer, Set<Item>> distanceToItemSetMap) {

        this.distanceToItemSetMap = distanceToItemSetMap;
    }
}

Use null as indicator for unconditional action.

Signed-off-by: Etienne M. Gagnon <bf06ec0eb40152cd863534753d026b021022c851@j-meg.com>


package ch.pantas.billsplitter.services;

import android.content.SharedPreferences;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;

@Singleton
public class SharedPreferenceService {

    public static final String USER_NAME = "USER_NAME";
    public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";

    @Inject
    private SharedPreferences preferences;

    public void storeUserName(String userName) {
        checkNotNull(userName);
        checkArgument(!userName.isEmpty());

        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(USER_NAME, userName);
        editor.apply();
    }

    public String getUserName() {
        return preferences.getString(USER_NAME, null);
    }

    public void storeActiveEventId(String eventId) {
        checkNotNull(eventId);
        checkArgument(!eventId.isEmpty());

        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(ACTIVE_EVENT_ID, eventId);
        editor.apply();
    }

    public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}

package ch.pantas.billsplitter.services;

import android.content.SharedPreferences;

import com.google.inject.Inject;
import com.google.inject.Singleton;

import static com.google.inject.internal.util.$Preconditions.checkArgument;
import static com.google.inject.internal.util.$Preconditions.checkNotNull;

@Singleton
public class SharedPreferenceService {

    public static final String USER_NAME = "USER_NAME";
    public static final String ACTIVE_EVENT_ID = "ACTIVE_EVENT_ID";

    @Inject
    private SharedPreferences preferences;

    public void storeUserName(String userName) {
        checkNotNull(userName);
        checkArgument(!userName.isEmpty());

        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(USER_NAME, userName);
        editor.apply();
    }

    public String getUserName() {
        return preferences.getString(USER_NAME, null);
    }

    public void storeActiveEventId(String eventId) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(ACTIVE_EVENT_ID, eventId);
        editor.apply();
    }

    public String getActiveEventId() { return preferences.getString(ACTIVE_EVENT_ID, null); }
}

FIXED: Allow to save null as default-event (no event)


package com.ticketmanor.ui.jsf;

import static org.junit.Assert.*;

import java.time.LocalDateTime;

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

public class LocalDateTimeJsfConverterTest {

	LocalDateTimeJsfConverter target;

	final String stringDate = "June 1, 2015 7:30 PM";
	final LocalDateTime localDateTime = LocalDateTime.of(2015, 06, 01, 19, 30, 56, 0);

	@Before
	public void setUp() throws Exception {
		target = new LocalDateTimeJsfConverter();
	}

	@Test
	public void testGetAsObject() {
		final Object asObject = target.getAsObject(null, null, stringDate);
		System.out.println(asObject);
	}

	@Test
	public void testGetAsString() {
		final String asString = target.getAsString(null, null, localDateTime);
		System.out.println(asString);
		assertEquals(stringDate, asString);
	}

}

package com.ticketmanor.ui.jsf;

import static org.junit.Assert.*;

import java.time.LocalDateTime;

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

public class LocalDateTimeJsfConverterTest {

	LocalDateTimeJsfConverter target;

	final String stringDate = "June 1, 2015 7:30 PM";
	final LocalDateTime localDateTime = LocalDateTime.of(2015, 06, 01, 19, 30, 56, 0);

	@Before
	public void setUp() throws Exception {
		target = new LocalDateTimeJsfConverter();
	}

	@Test
	public void testGetAsObject() {
		LocalDateTime asObject = (LocalDateTime) target.getAsObject(null, null, stringDate);
		System.out.println("Converted to LocalDateTime: " + asObject);
		assertEquals(2015, asObject.getYear());
		assertEquals(19, asObject.getHour());
	}

	@Test
	public void testGetAsString() {
		final String asString = target.getAsString(null, null, localDateTime);
		System.out.println("Converted to String" + asString);
		assertEquals(stringDate, asString);
	}
}

Add asserts to test method.

Add asserts to test method.


package com.maxmind.geoip2.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * This class provides the GeoIP2 Connection-Type model.
 */
public class ConnectionTypeResponse extends AbstractResponse {

    /**
     * The enumerated values that connection-type may take.
     */
    public enum ConnectionType {
        DIALUP("Dialup"), CABLE_DSL("Cable/DSL"), CORPORATE("Corporate"), CELLULAR(
                "Cellular");

        private final String name;

        private ConnectionType(String name) {
            this.name = name;
        }

        /*
         * (non-Javadoc)
         *
         * @see java.lang.Enum#toString()
         */
        @JsonValue
        @Override
        public String toString() {
            return this.name;
        }
    }

    private final ConnectionType connectionType;
    private final String ipAddress;

    ConnectionTypeResponse() {
        this(null, null);
    }

    public ConnectionTypeResponse(
            @JsonProperty("connection_type") ConnectionType connectionType,
            @JsonProperty("ip_address") String ipAddress
    ) {
        this.connectionType = connectionType;
        this.ipAddress = ipAddress;
    }

    /**
     * @return The connection type of the IP address.
     */
    @JsonProperty("connection_type")
    public ConnectionType getConnectionType() {
        return this.connectionType;
    }

    /**
     * @return The IP address that the data in the model is for.
     */
    @JsonProperty("ip_address")
    public String getIpAddress() {
        return this.ipAddress;
    }
}

package com.maxmind.geoip2.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * This class provides the GeoIP2 Connection-Type model.
 */
public class ConnectionTypeResponse extends AbstractResponse {

    /**
     * The enumerated values that connection-type may take.
     */
    public enum ConnectionType {
        DIALUP("Dialup"), CABLE_DSL("Cable/DSL"), CORPORATE("Corporate"), CELLULAR(
                "Cellular");

        private final String name;

        ConnectionType(String name) {
            this.name = name;
        }

        /*
         * (non-Javadoc)
         *
         * @see java.lang.Enum#toString()
         */
        @JsonValue
        @Override
        public String toString() {
            return this.name;
        }
    }

    private final ConnectionType connectionType;
    private final String ipAddress;

    ConnectionTypeResponse() {
        this(null, null);
    }

    public ConnectionTypeResponse(
            @JsonProperty("connection_type") ConnectionType connectionType,
            @JsonProperty("ip_address") String ipAddress
    ) {
        this.connectionType = connectionType;
        this.ipAddress = ipAddress;
    }

    /**
     * @return The connection type of the IP address.
     */
    @JsonProperty("connection_type")
    public ConnectionType getConnectionType() {
        return this.connectionType;
    }

    /**
     * @return The IP address that the data in the model is for.
     */
    @JsonProperty("ip_address")
    public String getIpAddress() {
        return this.ipAddress;
    }
}

Fix - removed private access modifier from Enum constructor

It is already private by spec.


package uk.co.jemos.podam.test.dto.pdm45;

import java.util.List;
import java.util.Map;

/**
 * Pojo with map of generic attributes.
 *
 * @author daivanov
 *
 */
public class GenericMapPojo<F, S> {

	private Map<String, GenericPojo<F, S>> genericPojos;

	private Map<String, List> genericRawLists;

	/**
	 * Map getter
	 * @return the genericPojo
	 */
	public Map<String, GenericPojo<F, S>> getGenericPojos() {
		return genericPojos;
	}

	/**
	 * Map setter
	 * @param genericPojos the genericPojo to set
	 */
	public void setGenericPojos(Map<String, GenericPojo<F, S>> genericPojos) {
		this.genericPojos = genericPojos;
	}

	/**
	 * Map getter
	 * @return the genericRawLists
	 */
	public Map<String, List> getGenericRawLists() {
		return genericRawLists;
	}

	/**
	 * Map setter
	 * @param genericRawLists the genericRawLists to set
	 */
	public void setGenericRawLists(Map<String, List> genericRawLists) {
		this.genericRawLists = genericRawLists;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "GenericAttributePojo [genericPojo=" + genericPojos + "]";
	}
}

package uk.co.jemos.podam.test.dto.pdm45;

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

/**
 * Pojo with map of generic attributes.
 *
 * @author daivanov
 *
 */
public class GenericMapPojo<F, S> {

	private Map<String, GenericPojo<F, S>> genericPojos;

	private Map<String, List> genericRawLists = new HashMap<String, List>();

	/**
	 * Map getter
	 * @return the genericPojo
	 */
	public Map<String, GenericPojo<F, S>> getGenericPojos() {
		return genericPojos;
	}

	/**
	 * Map setter
	 * @param genericPojos the genericPojo to set
	 */
	public void setGenericPojos(Map<String, GenericPojo<F, S>> genericPojos) {
		this.genericPojos = genericPojos;
	}

	/**
	 * Map getter
	 * @return the genericRawLists
	 */
	public Map<String, List> getGenericRawLists() {
		return genericRawLists;
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "GenericAttributePojo [genericPojo=" + genericPojos + "]";
	}
}

Test Map<String,List> as read only attribute


package DependencyRandomNumber;

import com.continuuity.api.data.*;
import com.continuuity.api.flow.flowlet.*;
import com.continuuity.api.flow.flowlet.builders.*;

public class EvenOddCounter extends AbstractComputeFlowlet {

  @Override
  public void configure(StreamsConfigurator configurator) {
    TupleSchema in = new TupleSchemaBuilder().
        add("randomNumber", Long.class).
        create();
    configurator.getDefaultTupleInputStream().setSchema(in);
  }

  @Override
  public void process(Tuple tuple, TupleContext tupleContext,
      OutputCollector outputCollector) {
    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() +
          ": Received tuple " + tuple);

    // count the number of odd or even numbers
    long randomNumber = tuple.get("randomNumber");
    boolean isEven = (randomNumber % 2) == 0;

    // generate an increment operation
    Increment increment;
    if (isEven) increment = new Increment("even".getBytes(), 1);
    else increment = new Increment("odd".getBytes(), 1);

    // emit the increment operation
    outputCollector.emit(increment);
  }
}

package DependencyRandomNumber;

import com.continuuity.api.data.*;
import com.continuuity.api.flow.flowlet.*;
import com.continuuity.api.flow.flowlet.builders.*;

public class EvenOddCounter extends AbstractComputeFlowlet {

  @Override
  public void configure(StreamsConfigurator configurator) {
    TupleSchema in = new TupleSchemaBuilder().
        add("randomNumber", Long.class).
        create();
    configurator.getDefaultTupleInputStream().setSchema(in);
  }

  @Override
  public void process(Tuple tuple, TupleContext tupleContext,
      OutputCollector outputCollector) {
    if (Common.debug)
      System.out.println(this.getClass().getSimpleName() +
          ": Received tuple " + tuple);

    // count the number of odd or even numbers
    long randomNumber = ((Long)tuple.get("randomNumber")).longValue();
    boolean isEven = (randomNumber % 2) == 0;

    // generate an increment operation
    Increment increment;
    if (isEven) increment = new Increment("even".getBytes(), 1);
    else increment = new Increment("odd".getBytes(), 1);

    // emit the increment operation
    outputCollector.emit(increment);
  }
}

Fix small bug in EvenOdd counter flowlet


/*
 * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2015, Gluu
 */

package org.xdi.oxauth.model.fido.u2f;

/**
 * Static FIDO U2F server variables
 *
 * @author Yuriy Movchan Date: 05/14/2015
 */
public class U2fConstants {

	public static final String U2F_PROTOCOL_VERSION = "U2F_V2";

	public static final String U2F_ENROLLMENT_CODE_ATTRIBUTE = "oxU2fEnrollmentCode";

}

/*
 * oxAuth is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
 *
 * Copyright (c) 2015, Gluu
 */

package org.xdi.oxauth.model.fido.u2f;

/**
 * Static FIDO U2F server variables
 *
 * @author Yuriy Movchan Date: 05/14/2015
 */
public class U2fConstants {

	public static final String U2F_PROTOCOL_VERSION = "U2F_V2";

	public static final String U2F_ENROLLMENT_CODE_ATTRIBUTE = "oxEnrollmentCode";

}

Use more generic name for enrollment attribute


package org.pdxfinder.services;

import org.pdxfinder.repositories.TreatmentSummaryRepository;
import org.springframework.stereotype.Service;

/*
 * Created by csaba on 29/03/2018.
 */
@Service
public class DrugService {

    private TreatmentSummaryRepository treatmentSummaryRepository;

    public DrugService(TreatmentSummaryRepository treatmentSummaryRepository) {
        this.treatmentSummaryRepository = treatmentSummaryRepository;
    }

    public int getDosingStudiesNumberByDataSource(String dataSource){

        return treatmentSummaryRepository.findStudyNumberByDataSource(dataSource);
    }

    public String getPlatformUrlByDataSource(String dataSource){

        return treatmentSummaryRepository.findPlatformUrlByDataSource(dataSource);
    }
}

package org.pdxfinder.services;

import org.pdxfinder.repositories.ResponseRepository;
import org.pdxfinder.repositories.TreatmentProtocolRepository;
import org.pdxfinder.repositories.TreatmentSummaryRepository;
import org.springframework.stereotype.Service;

import java.util.List;

/*
 * Created by csaba on 29/03/2018.
 */
@Service
public class DrugService {

    private TreatmentSummaryRepository treatmentSummaryRepository;
    private TreatmentProtocolRepository treatmentProtocolRepository;
    private ResponseRepository responseRepository;

    public DrugService(TreatmentSummaryRepository treatmentSummaryRepository,
                       TreatmentProtocolRepository treatmentProtocolRepository,
                       ResponseRepository responseRepository) {

        this.treatmentSummaryRepository = treatmentSummaryRepository;
        this.treatmentProtocolRepository = treatmentProtocolRepository;
        this.responseRepository = responseRepository;
    }

    public int getDosingStudiesNumberByDataSource(String dataSource){

        return treatmentSummaryRepository.findStudyNumberByDataSource(dataSource);
    }

    public String getPlatformUrlByDataSource(String dataSource){

        return treatmentSummaryRepository.findPlatformUrlByDataSource(dataSource);
    }

    public List<String> getDrugNames(){

        return treatmentProtocolRepository.findDrugNames();
    }

    public List<String> getResponseOptions(){

        return responseRepository.findAllResponses();
    }

}

Add drug names and responses to service

Add drug names and responses to service


package valandur.webapi.json.serializer.plugin;

import valandur.webapi.api.cache.plugin.ICachedPluginDependency;
import valandur.webapi.api.json.WebAPIBaseSerializer;
import valandur.webapi.cache.plugin.CachedPluginContainer;

import java.io.IOException;

public class CachedPluginContainerSerializer extends WebAPIBaseSerializer<CachedPluginContainer> {

    @Override
    public void serialize(CachedPluginContainer value) throws IOException {
        writeStartObject();

        writeField("id", value.getId());
        writeField("name", value.getName());
        writeField("version", value.getVersion());

        if (shouldWriteDetails()) {
            writeField("class", value.getClass());
            writeField("description", value.getDescription());
            writeField("url", value.getUrl());
            writeField("authors", value.getAuthors());
            writeArrayFieldStart("dependencies");
            for (ICachedPluginDependency dependency : value.getDependencies()) {
                writeValue(dependency);
            }
            writeEndArray();
        }

        writeEndObject();
    }
}

package valandur.webapi.json.serializer.plugin;

import valandur.webapi.api.cache.plugin.ICachedPluginDependency;
import valandur.webapi.api.json.WebAPIBaseSerializer;
import valandur.webapi.cache.plugin.CachedPluginContainer;

import java.io.IOException;

public class CachedPluginContainerSerializer extends WebAPIBaseSerializer<CachedPluginContainer> {

    @Override
    public void serialize(CachedPluginContainer value) throws IOException {
        writeStartObject();

        writeField("id", value.getId());
        writeField("name", value.getName());
        writeField("version", value.getVersion());

        if (shouldWriteDetails()) {
            writeField("description", value.getDescription());
            writeField("url", value.getUrl());
            writeField("authors", value.getAuthors());
            writeArrayFieldStart("dependencies");
            for (ICachedPluginDependency dependency : value.getDependencies()) {
                writeValue(dependency);
            }
            writeEndArray();
        }

        writeEndObject();
    }
}

fix(json): Remove class field from PluginContainer json serializer


/**
 Copyright 2017 John Kester (Jack Kester)

 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.github.slidekb.api;

/**
 * @author JackSec
 */
public interface SlideBarPlugin {

    /**
     * returns the priority for the plugin
     * not currently used for anything yet
     *
     * @return
     */
    public int getPriority();

    /**
     * name displayed in master configuration window/ main application.
     *
     * @return
     */
    public String getLabelName();

    /**
     * runs while exe current window or hotkey is being pressed
     */
    public void run();

    /**
     * runs on first .exe match or hotkeypress. used to set up run();
     */
    public void runFirst();

    /**
     * sets the SlideBar
     *
     * @param Slider
     */
    public void setSlider(Slider slider, int position);

    public int numberOfSlidersRequired();
}

/**
 Copyright 2017 John Kester (Jack Kester)

 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.github.slidekb.api;

/**
 * @author JackSec
 */
public interface SlideBarPlugin {

    /**
     * returns the priority for the plugin
     * not currently used for anything yet
     *
     * @return
     */
    public int getPriority();

    /**
     * name displayed in configuration window and main application.
     *
     * @return
     */
    public String getLabelName();

    /**
     * Ran once when the plugin is loaded. Put code to initialize the plugin in this.
     */
    public void setup();

    /**
     * Runs the main functions of this plugin
     */
    public void run();

    /**
     * Runs on process or hotkey change. used to set up run()
     */
    public void runFirst();

    /**
     * Injects the Slider at the set index
     *
     * @param Slider
     */
    public void setSlider(Slider slider, int index);

    /**
     * The number of sliders this plugin needs
     *
     * @return The number of sliders this plugin needs
     */
    public int numberOfSlidersRequired();
}

Add setup method and change some javadocs


package com.faforever.api.db;

import com.faforever.api.config.ApplicationProfile;
import com.faforever.api.config.FafApiProperties;
import org.springframework.context.annotation.Profile;
import org.springframework.core.PriorityOrdered;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.PostConstruct;
import java.util.Objects;

@Component
@Profile("!" + ApplicationProfile.INTEGRATION_TEST)
public class SchemaVersionVerifier implements PriorityOrdered {

  private final SchemaVersionRepository schemaVersionRepository;
  private final FafApiProperties properties;

  public SchemaVersionVerifier(SchemaVersionRepository schemaVersionRepository, FafApiProperties properties) {
    this.schemaVersionRepository = schemaVersionRepository;
    this.properties = properties;
  }

  @PostConstruct
  public void postConstruct() {
    String requiredVersion = properties.getDatabase().getSchemaVersion();
    String actualVersion = schemaVersionRepository.findMaxVersion()
      .orElseThrow(() -> new IllegalStateException("No database version is available"));

    Assert.state(Objects.equals(requiredVersion, actualVersion),
      String.format("Database version is '%s' but this software requires '%s'", actualVersion, requiredVersion));
  }

  @Override
  public int getOrder() {
    return HIGHEST_PRECEDENCE;
  }
}

package com.faforever.api.db;

import com.faforever.api.config.ApplicationProfile;
import com.faforever.api.config.FafApiProperties;
import org.springframework.context.annotation.Profile;
import org.springframework.core.PriorityOrdered;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

import javax.annotation.PostConstruct;
import java.util.Objects;

@Component
@Profile("!" + ApplicationProfile.INTEGRATION_TEST)
public class SchemaVersionVerifier implements PriorityOrdered {

  private final SchemaVersionRepository schemaVersionRepository;
  private final FafApiProperties properties;

  public SchemaVersionVerifier(SchemaVersionRepository schemaVersionRepository, FafApiProperties properties) {
    this.schemaVersionRepository = schemaVersionRepository;
    this.properties = properties;
  }

  @PostConstruct
  public void postConstruct() {
    String requiredVersion = properties.getDatabase().getSchemaVersion();
    String actualVersion = schemaVersionRepository.findMaxVersion()
      .orElseThrow(() -> new IllegalStateException("No database version is available"));

    Assert.state(Objects.equals(requiredVersion, actualVersion),
      String.format("Database version is '%s' but this software requires '%s'. If you are sure that this version is " +
          "compatible, you can override the expected version by setting the environment variable DATABASE_SCHEMA_VERSION.",
        actualVersion, requiredVersion));
  }

  @Override
  public int getOrder() {
    return HIGHEST_PRECEDENCE;
  }
}

Improve schema version error message

Improve schema version error message


package xyz.upperlevel.uppercore.arena.command;

import xyz.upperlevel.uppercore.arena.Arena;
import xyz.upperlevel.uppercore.arena.ArenaManager;
import xyz.upperlevel.uppercore.command.functional.parameter.ParameterHandler;
import xyz.upperlevel.uppercore.command.functional.parameter.ParameterParseException;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Queue;
import java.util.stream.Collectors;

public final class ArenaParameterHandler {
    private ArenaParameterHandler() {
    }

    public static void register() {
        ParameterHandler.register(
                Collections.singletonList(Arena.class),
                args -> {
                    Arena arena = ArenaManager.get().get(args.take());
                    if (arena == null) {
                        throw args.areWrong();
                    }
                    return arena;
                },
                args -> {
                    if (args.remaining() > 1)
                        return Collections.emptyList();
                    return ArenaManager.get().getArenas()
                            .stream()
                            .filter(arena -> arena.getId().startsWith(args.take()))
                            .map(Arena::getId)
                            .collect(Collectors.toList());
                });
    }
}

package xyz.upperlevel.uppercore.arena.command;

import xyz.upperlevel.uppercore.arena.Arena;
import xyz.upperlevel.uppercore.arena.ArenaManager;
import xyz.upperlevel.uppercore.command.functional.parameter.ParameterHandler;

import java.util.Collections;
import java.util.stream.Collectors;

public final class ArenaParameterHandler {
    private ArenaParameterHandler() {
    }

    public static void register() {
        ParameterHandler.register(
                Collections.singletonList(Arena.class),
                args -> {
                    Arena arena = ArenaManager.get().get(args.take());
                    if (arena == null) {
                        throw args.areWrong();
                    }
                    return arena;
                },
                args -> {
                    if (args.remaining() > 1)
                        return Collections.emptyList();
                    String arenaName = args.take();
                    return ArenaManager.get().getArenas()
                            .stream()
                            .filter(arena -> arena.getId().startsWith(arenaName))
                            .map(Arena::getId)
                            .collect(Collectors.toList());
                });
    }
}

Fix tab-complete when having many arenas


package org.astro;

public class WorldTests {
  static {
    if (!World.PACKAGE_PRIVATE_FIELD.equals("World")) throw new AssertionError(")-:");
    new test.base.Tester();
  }
}

package org.astro;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.Test;
import test.base.PrependModuleName;

@DisplayNameGeneration(PrependModuleName.class)
class WorldTests {
  @Test
  void test() {
    assertEquals("World", World.PACKAGE_PRIVATE_FIELD);
    assertNotNull(new test.base.Tester().toString());
  }
}

Transform into JUnit Jupiter test

Transform into JUnit Jupiter test


/*
 * Copyright 2002-2012 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
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.aop.framework.adapter;

import java.io.Serializable;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;

import org.springframework.aop.Advisor;
import org.springframework.aop.ThrowsAdvice;

/**
 * Adapter to enable {@link org.springframework.aop.MethodBeforeAdvice}
 * to be used in the Spring AOP framework.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
@SuppressWarnings("serial")
class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable {

	@Override
	public boolean supportsAdvice(Advice advice) {
		return (advice instanceof ThrowsAdvice);
	}

	@Override
	public MethodInterceptor getInterceptor(Advisor advisor) {
		return new ThrowsAdviceInterceptor(advisor.getAdvice());
	}

}

/*
 * Copyright 2002-2012 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
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.aop.framework.adapter;

import java.io.Serializable;

import org.aopalliance.aop.Advice;
import org.aopalliance.intercept.MethodInterceptor;

import org.springframework.aop.Advisor;
import org.springframework.aop.ThrowsAdvice;

/**
 * Adapter to enable {@link org.springframework.aop.ThrowsAdvice}
 * to be used in the Spring AOP framework.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
@SuppressWarnings("serial")
class ThrowsAdviceAdapter implements AdvisorAdapter, Serializable {

	@Override
	public boolean supportsAdvice(Advice advice) {
		return (advice instanceof ThrowsAdvice);
	}

	@Override
	public MethodInterceptor getInterceptor(Advisor advisor) {
		return new ThrowsAdviceInterceptor(advisor.getAdvice());
	}

}

Fix javadoc reference to ThrowsAdvice

Fix javadoc reference to ThrowsAdvice

See gh-27804


package org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 - 2014 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

public enum ColorType {
    PRIMARY("primary"), INFO("info"), SUCCESS("primary"), WARNING("warning"), DANGER("danger"), DEFAULT("default");

    private final String type;

    private ColorType(final String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
}

package org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants;

/*
 * #%L
 * GwtBootstrap3
 * %%
 * Copyright (C) 2013 - 2014 GwtBootstrap3
 * %%
 * 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.
 * #L%
 */

public enum ColorType {
    PRIMARY("primary"), INFO("info"), SUCCESS("success"), WARNING("warning"), DANGER("danger"), DEFAULT("default");

    private final String type;

    private ColorType(final String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }
}

Fix incorrect colour value in SUCCESS constant


package net.tjololo.openshift.havoc.connector.kubernetes;

/**
 * Created by veg on 19.12.2016.
 */
public class KubernetesDiscoveryTest {
    private KubernetesDiscovery kubernetesDiscovery;

}

package net.tjololo.openshift.havoc.connector.kubernetes;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.web.client.RestTemplate;

import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by veg on 19.12.2016.
 */
@RunWith(MockitoJUnitRunner.class)
public class KubernetesDiscoveryTest {
    private KubernetesDiscovery kubernetesDiscovery;
    @Mock
    private RestTemplate restTemplate;
    private static final String TOKEN="22Token22";

    @Before
    public void setUp() {
        kubernetesDiscovery = new KubernetesDiscovery(restTemplate, TOKEN);
    }

    @Test
    public void check_that_kubernetesDiscovery_not_null() throws Exception {
        assertThat(kubernetesDiscovery, not(nullValue()));
    }
}

Improve code quality. Implementet simple test


package forager.events;

import java.io.IOException;

import galileo.event.Event;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public int taskId;
    public String[] command;

    public TaskSpec(int taskId, String[] command) {
        this.taskId = taskId;
        this.command = command;
    }

    public String toString() {
        String str = "[" + taskId + "] ";
        for (String s : command) {
            str += s + " ";
        }
        return str;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readInt();
        int numArgs = in.readInt();
        command = new String[numArgs];
        for (int i = 0; i < numArgs; ++i) {
            command[i] = in.readString();
        }
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeInt(taskId);
        out.writeInt(command.length);
        for (String s : command) {
            out.writeString(s);
        }
    }
}

package forager.events;

import java.io.IOException;

import galileo.event.Event;
import galileo.serialization.SerializationInputStream;
import galileo.serialization.SerializationOutputStream;

public class TaskSpec implements Event {

    public int taskId;
    public String[] command;

    public TaskSpec(int taskId, String[] command) {
    private List<NetworkDestination> assignments = new ArrayList<>();
        this.taskId = taskId;
        this.command = command;
    }

    public void addAssignment(NetworkDestination host) {
        assignments.add(host);
    }

    public void removeAssignment(NetworkDestination host) {
        assignments.remove(host);
    }

    /**
     * Determine whether the Task associated with this TaskSpec has been
     * assigned to any resources yet.
     *
     * @return true if the Task has been assigned, false otherwise.
     */
    public boolean isAssigned() {
        return assignments.isEmpty() == false;
    }

    public String toString() {
        String str = "[" + taskId + "] ";
        for (String s : command) {
            str += s + " ";
        }
        return str;
    }

    @Deserialize
    public TaskSpec(SerializationInputStream in)
    throws IOException {
        taskId = in.readInt();
        int numArgs = in.readInt();
        command = new String[numArgs];
        for (int i = 0; i < numArgs; ++i) {
            command[i] = in.readString();
        }
    }

    @Override
    public void serialize(SerializationOutputStream out)
    throws IOException {
        out.writeInt(taskId);
        out.writeInt(command.length);
        for (String s : command) {
            out.writeString(s);
        }
    }
}

Add concept of task assignment

Add concept of task assignment


package au.org.ands.vocabs.toolkit.restlet;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/** Testing restlet. */
@Path("testing2")
public class TestRestlet2 {

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final String getMessage() {
        return "Hello World! Again!";
        }

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.APPLICATION_JSON)
    @GET
    public final String getMessageJson() {
        return "{\"hello\":\"Hello JSON!\"}";
        }

}

package au.org.ands.vocabs.toolkit.restlet;

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

/** Testing restlet. */
@Path("testing2")
public class TestRestlet2 {

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final String getMessage() {
        return "Hello World! Again!";
        }

    /** getMessage.
     * @return the message. */
    @Produces(MediaType.APPLICATION_JSON)
    @GET
    public final String getMessageJson() {
        return "{\"hello\":\"Hello JSON!\"}";
        }

    /** getException.
     * This shows how to return a status code 503 "service unavailable"
     * and also some content.
     * @return the message. */
    @Path("except")
    @Produces(MediaType.TEXT_PLAIN)
    @GET
    public final Response getExcept() {
        return Response.status(Status.SERVICE_UNAVAILABLE).
                entity("Hi there").build();
        }

}

Test generating a 503 status

Test generating a 503 status


package wumpus;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;

import wumpus.Environment.*;

/**
 * The iteration of plays that the player can take until reaches its end.
 */
public class Runner implements Iterable<Player>, Iterator<Player> {
    private static final int DEFAULT_MAX_ITERATIONS = 200;

    private final World world;
    private int iterations = 0;

    /**
     * The runner constructor.
     * @param world The world instance.
     */
    public Runner(World world) {
        this.world = world;
    }

    /**
     * Returns the iterator that can be user in a loop.
     * @return Itself
     */
    public Iterator<Player> iterator() {
        return this;
    }

    /**
     * Check if the game has ended.
     * @return
     */
    public boolean hasNext() {
        Player player = world.getPlayer();
        return iterations < DEFAULT_MAX_ITERATIONS &&
                player.isAlive() && player.getResult() == Result.WIN;
    }

    /**
     * Get player instance to calculate the next iteration.
     * @return The current player instance
     */
    public Player next() {
        if (!hasNext()) throw new NoSuchElementException();
        iterations++;
        return world.getPlayer();
    }

    /**
     * Operation not supported, throws an error.
     */
    public void remove() {
        throw new UnsupportedOperationException();
    }

    /**
     * Get how many iterations have been made so far.
     * @return The amount of iterations
     */
    public int getDepth() {
        return iterations;
    }
}

package wumpus;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;

import wumpus.Environment.*;

/**
 * The iteration of plays that the player can take until reaches its end.
 */
public class Runner implements Iterable<Player>, Iterator<Player> {
    private static final int DEFAULT_MAX_ITERATIONS = 200;

    private final World world;
    private int iterations = 0;

    /**
     * The runner constructor.
     * @param world The world instance.
     */
    public Runner(World world) {
        this.world = world;
    }

    /**
     * Returns the iterator that can be user in a loop.
     * @return Itself
     */
    public Iterator<Player> iterator() {
        return this;
    }

    /**
     * Check if the game has ended.
     * @return
     */
    public boolean hasNext() {
        Player player = world.getPlayer();
        return iterations < DEFAULT_MAX_ITERATIONS &&
                player.isAlive() && player.getResult() != Result.WIN;
    }

    /**
     * Get player instance to calculate the next iteration.
     * @return The current player instance
     */
    public Player next() {
        if (!hasNext()) throw new NoSuchElementException();
        iterations++;
        return world.getPlayer();
    }

    /**
     * Operation not supported, throws an error.
     */
    public void remove() {
        throw new UnsupportedOperationException();
    }

    /**
     * Get how many iterations have been made so far.
     * @return The amount of iterations
     */
    public int getDepth() {
        return iterations;
    }
}

Fix hasNext method to only stop when play not have winned


package models;
import static org.junit.Assert.*;

import java.util.Calendar;

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

public class PersonModelTest {
	private Calendar now = Calendar.getInstance();
	private int currentYear = now.get(Calendar.YEAR);
	private Person bart;
	private int bartAge;

	@Before
	public void setUp() throws Exception {
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
		bartAge = (currentYear - bart.getBirthYear());
	}

	@Test
	public void getAgeReturnItem() {
		assertEquals(bartAge, bart.getAge());
	}

	@Test
	public void toStringReturnItem() {
		assertEquals("firstName: Bart, lastName: Simpsons, age: "+bartAge,
						bart.toString());
	}

}

package models;
import static org.junit.Assert.*;

import java.util.Calendar;

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

public class PersonModelTest {
	private Calendar now = Calendar.getInstance();
	private int currentYear = now.get(Calendar.YEAR);
	private Person bart;
	private int bartAge;

	@Before
	public void setUp() throws Exception {
		bart = new Person(101,"Bart","Simpsons",1987,"Springfield","USA");
		bartAge = (currentYear - bart.getBirthYear());
	}

	@Test
	public void getAgeReturnItem() {
		int expectedAge = bartAge;
		assertEquals(expectedAge, bart.getAge());
	}

	@Test
	public void toStringReturnItem() {
		String expectedToString = "firstName: Bart, lastName: Simpsons, age: " + bartAge;
		assertEquals(expectedToString, bart.toString());
	}

}

Add variables to express intent

Refactor: Add variables to express intent


package fr.mantal.wcdl;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main
{
	public static void main(String[] args)
	{
		Downloader.fromConfig(getPath(args[0])).download();
	}

	private static String getPath(String arg0)
	{
		if (arg0.isEmpty())
			arg0 = System.getProperty("user.dir");

		if (Files.isDirectory(Paths.get(arg0)))
			return Paths.get(arg0, ".config.wcdl").toString();
		return arg0;
	}
}

package fr.mantal.wcdl;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main
{
	public static void main(String[] args)
	{
		Downloader.fromConfig(getPath(args)).download();
	}

	private static String getPath(String[] args)
	{
		String arg0 = args.length > 1 ? args[0] : System.getProperty("user.dir");

		if (Files.isDirectory(Paths.get(arg0)))
			return Paths.get(arg0, ".config.wcdl").toString();
		return arg0;
	}
}

Fix crash when launched without arguments


package net.shadowfacts.zcraft.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.shadowfacts.zcraft.item.ZItems;

public class BlockOre extends Block {

	public BlockOre(int par1) {
		super(par1, Material.rock);
	}

	public int idDropped(int par1, Random par2Random, int par3) {

		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return ZItems.greenZinchoriumGem.itemID;
		} else {
			return this.blockID;
		}

	}

	public int quantityDropped(Random par1Random) {
		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return 3;
		} else {
			return 1;
		}
	}

}

package net.shadowfacts.zcraft.block;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.world.World;
import net.shadowfacts.zcraft.item.ZItems;

public class BlockOre extends Block {

	public BlockOre(int par1) {
		super(par1, Material.rock);
	}

	@Override
	public int idDropped(int par1, Random par2Random, int par3) {

		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return ZItems.greenZinchoriumGem.itemID;
		} else {
			return this.blockID;
		}

	}

	@Override
	public int quantityDropped(Random par1Random) {
		if (this.blockID == ZBlocks.greenZinchoriumGemOre.blockID) {
			return 3;
		} else {
			return 1;
		}
	}

	@Override
	public void dropXpOnBlockBreak(World world, int par2, int par3, int par4, int par5) {
		if (!world.isRemote) {
			int i1 = EntityXPOrb.getXPSplit(par5);
			par5 -= i1;
			world.spawnEntityInWorld(new EntityXPOrb(world, (double)par2 + 0.5d, (double)par3 + 0.5d, (double)par4 + 0.5d, 20));
		}
	}

}

Add experience drop to ores

Add experience drop to ores


package org.fountanio.juancode.out;

import java.awt.BorderLayout;
import java.awt.GridLayout;

import javax.swing.*;
import javax.swing.border.Border;
import java.awt.event.*;

public class IPWindow extends JFrame {
	private static final long serialVersionUID = 1L;

	private JButton gotoip = new JButton("Go");
	private JButton gotoipf = new JButton("Go");
	private Border topborder = BorderFactory.createTitledBorder("Connect");
	private Border bottomborder = BorderFactory.createTitledBorder("Friends");
	private JTextField ipinput = new JTextField();
	private JList<String> friendlist = new JList();

	public IPWindow() {
		super("Speed Civilization");
		setSize(400, 340);
		setLayout(new BorderLayout());
		ipinput.setBorder(topborder);
		gotoip.setBorder(topborder);
		gotoipf.setBorder(bottomborder);
		friendlist.setBorder(bottomborder);
		// actions

	}

}

package org.fountanio.juancode.out;

import java.awt.BorderLayout;

import javax.swing.*;
import javax.swing.border.Border;

import org.fountanio.juancode.eng.Engine;
import org.lwjgl.openal.AL;
import org.lwjgl.opengl.Display;

import java.awt.event.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;

public class IPWindow extends JFrame {
	private static final long serialVersionUID = 1L;

	private JButton gotoip = new JButton("Go");
	private JButton gotoipf = new JButton("Go");
	private Border topborder = BorderFactory.createTitledBorder("Connect");
	private Border bottomborder = BorderFactory.createTitledBorder("Friends");
	private JTextField ipinput = new JTextField();
	private JList<String> friendlist = new JList();

	public IPWindow() {
		super("Speed Civilization");
		setSize(400, 340);
		setLayout(new BorderLayout());
		ipinput.setBorder(topborder);
		gotoip.setBorder(topborder);
		gotoipf.setBorder(bottomborder);
		friendlist.setBorder(bottomborder);
		// actions

	}

	void refreshList() {
		try {
			File file = new File(Engine.getAppDataDir() + "\\fountanio\\speedcivilization\\friends.fls");
			Reader r = new FileReader(file);
			BufferedReader reader = new BufferedReader(r);
		} catch (FileNotFoundException e) {
			Main.getConsole().errorln("Data directory NOT found!\nPerhaps you may want to restart the game?");
		}
	}
}

Set up a few items

Set up a few items


package com.kickstarter.libs;

import com.kickstarter.viewmodels.DiscoveryViewModel;
import com.kickstarter.services.WebClient;

public class NoopBuildCheck implements BuildCheck {
  @Override
  public void bind(final DiscoveryViewModel viewModel, final WebClientType client) {
    // No-op, distribution through Play Store
  }
}

package com.kickstarter.libs;

import android.support.annotation.NonNull;

import com.kickstarter.services.WebClientType;
import com.kickstarter.viewmodels.DiscoveryViewModel;

public class NoopBuildCheck implements BuildCheck {
  @Override
  public void bind(final @NonNull DiscoveryViewModel viewModel, final @NonNull WebClientType client) {
    // No-op, distribution through Play Store
  }
}

Fix import for external builds

Fix import for external builds


/**
 * 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.
 */
/**
 * A simple in-memory implementation of the Commons RDF API.
 *

 * This package contains a simple (if not naive) implementation of the Commons RDF API
 * using in-memory POJO objects.
 *

 * Note that although this module fully implements the commons-rdf API,
 * it should *not*  be considered a reference implementation.
 * It is not thread-safe nor scalable, but may be useful for testing
 * and simple usage (e.g. output from an independent RDF parser).
 *

 * To use this implementation, create an instance of {@link SimpleRDFTermFactory}
 * and use methods like {@link SimpleRDFTermFactory#createGraph} and
 * {@link SimpleRDFTermFactory#createIRI(String)}.
 *
 */
package org.apache.commons.rdf.simple;

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

/**
 * A simple in-memory implementation of the Commons RDF API.
 *

 * This package contains a simple (if not naive) implementation of the Commons RDF API
 * using in-memory POJO objects.
 *

 * Note that although this module fully implements the commons-rdf API,
 * it should *not*  be considered a reference implementation.
 * It is not thread-safe nor scalable, but may be useful for testing
 * and simple usage (e.g. output from an independent RDF parser).
 *

 * To use this implementation, create an instance of {@link SimpleRDFTermFactory}
 * and use methods like {@link SimpleRDFTermFactory#createGraph} and
 * {@link SimpleRDFTermFactory#createIRI(String)}.
 *
 */

Move javadoc after package to avoid warnings


package seedu.address.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Date App\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/scheduler.xml\n" +
                "Scheduler name : MyScheduler";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.address.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Scheduler App\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/scheduler.xml\n" +
                "Scheduler name : MyScheduler";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

Fix a failure in test

Fix a failure in test


package seedu.manager.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.manager.commons.core.Config;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Task Ninja\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/taskmanager.xml\n" +
                "TaskManager name : MyTaskManager";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

package seedu.manager.commons.core;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import seedu.manager.commons.core.Config;

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

public class ConfigTest {
    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @Test
    public void toString_defaultObject_stringReturned() {
        String defaultConfigAsString = "App title : Task Ninja\n" +
                "Current log level : INFO\n" +
                "Preference file Location : preferences.json\n" +
                "Local data file location : data/taskmanager.xml\n" +
                "TaskManager name : Task Ninja";

        assertEquals(defaultConfigAsString, new Config().toString());
    }

    @Test
    public void equalsMethod(){
        Config defaultConfig = new Config();
        assertFalse(defaultConfig.equals(null));
        assertTrue(defaultConfig.equals(defaultConfig));
    }

}

Fix failing test due to change in taskmanager name


package vooga.request.forwarder;

/**
 * An exception capturing when an invalid address has been used
 */
public class InvalidAddressException extends Exception {

    private static final long serialVersionUID = 7207103882222096620L;

    private String myAddress;
    private String myReason;

    /**
     * Create a new invalid address exception
     *
     * @param address The invalid address
     * @param reason The reason the address is invalid
     */
    public InvalidAddressException(String address, String reason){
        super(address + " is invalid: " + reason);
        myAddress = address;
        myReason = reason;
    }

    /**
     * Get the invalid address
     *
     * @return The invalid address
     */
    public String address(){
        return myAddress;
    }

    /**
     * Get the reason the address is invalid
     *
     * @return The reason the address is invalid
     */
    public String reason(){
        return myReason;
    }
}

Remove spacing between static and non static variables


package ee.tuleva.onboarding.mandate;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@Getter
@Entity
@Table(name = "fund_transfer_exchange")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString(exclude = {"mandate"})
public class FundTransferExchange {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonView(MandateView.Default.class)
    private Long id;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "mandate_id", nullable = false)
    private Mandate mandate;

    @NotBlank
    @JsonView(MandateView.Default.class)
    private String sourceFundIsin;
    @NotNull
    @Min(0)
    @Max(1)
    @JsonView(MandateView.Default.class)
    private BigDecimal amount;
    @NotNull
    @JsonView(MandateView.Default.class)
    private String targetFundIsin;

}

package ee.tuleva.onboarding.mandate;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.*;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@Getter
@Entity
@Table(name = "fund_transfer_exchange")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ToString(exclude = {"mandate"})
public class FundTransferExchange {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @JsonView(MandateView.Default.class)
    private Long id;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "mandate_id", nullable = false)
    private Mandate mandate;

    @NotBlank
    @JsonView(MandateView.Default.class)
    private String sourceFundIsin;
    @NotNull
    @Min(0)
    @JsonView(MandateView.Default.class)
    private BigDecimal amount;
    @NotNull
    @JsonView(MandateView.Default.class)
    private String targetFundIsin;

}

Fix 3rd pillar validation constraint

Fix 3rd pillar validation constraint


package com.github.tdesjardins.ol3.demo.client.example;

/**
 * Provided example types.
 *
 * @author Tino Desjardins
 *
 */
public enum OL3ExampleType {

    AnimationExample(new AnimationExample()),
    ArcGISExample(new ArcGISExample()),
    GeoJSONExample(new GeoJSONExample()),
    GraticuleExample(new GraticuleExample()),
    ImageExample(new StaticImageExample()),
    MapEventsExample(new MapEventsExample()),
    MapGuideExample(new MapGuideExample()),
    MarkerExample(new MarkerExample()),
    MeasureExample(new MeasureExample()),
    OsmExample(new OsmExample()),
    OverlayExample(new OverlayExample()),
    SelectFeatureExample(new SelectFeaturesExample()),
    TileExample(new TileExample()),
    TileWmsExample(new TileWmsExample()),
    WmsExample(new WmsExample()),
    WmtsExample(new WmtsExample()),
    XyzExample(new XyzExample());

    private transient Example example;

    OL3ExampleType(Example example) {
        this.example = example;
    }

    public Example getExample() {
        return this.example;
    }

}

package com.github.tdesjardins.ol3.demo.client.example;

/**
 * Provided example types.
 *
 * @author Tino Desjardins
 *
 */
public enum OL3ExampleType {

    AnimationExample(new AnimationExample()),
    ArcGISExample(new ArcGISExample()),
    GeoJSONExample(new GeoJSONExample()),
    GraticuleExample(new GraticuleExample()),
    ImageExample(new StaticImageExample()),
    MapBoxExample(new MapboxExample()),
    MapEventsExample(new MapEventsExample()),
    MapGuideExample(new MapGuideExample()),
    MarkerExample(new MarkerExample()),
    MeasureExample(new MeasureExample()),
    OsmExample(new OsmExample()),
    OverlayExample(new OverlayExample()),
    SelectFeatureExample(new SelectFeaturesExample()),
    TileExample(new TileExample()),
    TileWmsExample(new TileWmsExample()),
    WmsExample(new WmsExample()),
    WmtsExample(new WmtsExample()),
    XyzExample(new XyzExample());

    private transient Example example;

    OL3ExampleType(Example example) {
        this.example = example;
    }

    public Example getExample() {
        return this.example;
    }

}

Add an example for Mapbox.

Add an example for Mapbox.


package com.simperium.client;

import com.simperium.util.AuthUtil;

import org.json.JSONException;
import org.json.JSONObject;

public class AuthResponseHandler {

    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener){
        mUser = user;
        mListener = listener;
    }

    public void onResponse(JSONObject response){

        try {
            mUser.setUserId(response.getString(AuthUtil.USERID_KEY));
            mUser.setAccessToken(response.getString(AuthUtil.ACCESS_TOKEN_KEY));
        } catch(JSONException error){
            mListener.onFailure(mUser, AuthException.defaultException());
            return;
        }

        mUser.setStatus(User.Status.AUTHORIZED);
        mListener.onSuccess(mUser, mUser.getUserId(), mUser.getAccessToken());
    }

    public void onError(AuthException error){
        mListener.onFailure(mUser, error);
    }

}

package com.simperium.client;

import com.simperium.util.AuthUtil;

import org.json.JSONObject;

public class AuthResponseHandler {
    private AuthResponseListener mListener;
    private User mUser;

    public AuthResponseHandler(User user, AuthResponseListener listener) {
        mUser = user;
        mListener = listener;
    }

    public void onResponse(JSONObject response){
        if (!response.optString(AuthUtil.USERID_KEY).isEmpty() && !response.optString(AuthUtil.ACCESS_TOKEN_KEY).isEmpty()) {
            mListener.onSuccess(mUser, response.optString(AuthUtil.USERID_KEY), response.optString(AuthUtil.ACCESS_TOKEN_KEY));
        } else {
            mListener.onFailure(mUser, AuthException.defaultException());
        }
    }

    public void onError(AuthException error) {
        mListener.onFailure(mUser, error);
    }
}

Remove setting user id and access token from response method in auth response handler


package icepick.annotation;

import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

class IcicleField {

    public final String name;
    public final String typeCast;
    public final String command;

    IcicleField(String name, String typeCast, String command) {
        this.name = name;
        this.command = command;
        this.typeCast = typeCast;
    }

    static class Factory {

        private final Types typeUtils;
        private final IcicleConversionMap conversionMap;

        Factory(Elements elementUtils, Types typeUtils) {
            this.typeUtils = typeUtils;
            this.conversionMap = new IcicleConversionMap(elementUtils, typeUtils);
        }

        public IcicleField from(Element element) {
            TypeMirror typeMirror = element.asType();
            String command = convert(typeMirror);
            String typeCast = IcicleConversionMap.TYPE_CAST_COMMANDS.contains(command) ? "(" + typeMirror.toString() + ")" : "";
            String name = element.getSimpleName().toString();
            return new IcicleField(name, typeCast, command);
        }

        public String convert(TypeMirror typeMirror) {
            for (TypeMirror other : conversionMap.keySet()) {
                if (typeUtils.isAssignable(typeMirror, other)) {
                    return conversionMap.get(other);
                }
            }
            throw new AssertionError("Cannot insert a " + typeMirror + " into a Bundle");
        }
    }
}

package icepick.annotation;

import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

class IcicleField {

    public final String name;
    public final String typeCast;
    public final String command;

    IcicleField(String name, String typeCast, String command) {
        this.name = name;
        this.command = command;
        this.typeCast = typeCast;
    }

    static class Factory {

        private final Types typeUtils;
        private final IcicleConversionMap conversionMap;

        Factory(Elements elementUtils, Types typeUtils) {
            this.typeUtils = typeUtils;
            this.conversionMap = new IcicleConversionMap(elementUtils, typeUtils);
        }

        public IcicleField from(Element element) {
            TypeMirror typeMirror = element.asType();
            String command = convert(typeMirror);
            String typeCast = IcicleConversionMap.TYPE_CAST_COMMANDS.contains(command) ? "(" + typeMirror.toString() + ")" : "";
            String name = element.getSimpleName().toString();
            return new IcicleField(name, typeCast, command);
        }

        private String convert(TypeMirror typeMirror) {
            for (TypeMirror other : conversionMap.keySet()) {
                if (typeUtils.isAssignable(typeMirror, other)) {
                    return conversionMap.get(other);
                }
            }
            throw new UnableToSerializeException(typeMirror);
        }
    }

    public static class UnableToSerializeException extends RuntimeException {
        UnableToSerializeException(TypeMirror fieldType) {
            super("Don't know how to put a " + fieldType + " into a Bundle");
        }
    }
}

Add a proper exception type for failed conversion


/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import com.codenvy.dto.shared.DTO;

@DTO
public interface ColumnDTO extends DatabaseMetadataEntityDTO {

    ColumnDTO withName(String name);

    ColumnDTO withColumnDataType(String datatypeName);

    String getColumnDataType();

    void setColumnDataType(String columnDataTypeName);
}

/*
 * CODENVY CONFIDENTIAL
 * __________________
 *
 * [2013] - [2014] Codenvy, S.A.
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Codenvy S.A. and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Codenvy S.A.
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Codenvy S.A..
 */
package com.codenvy.ide.ext.datasource.shared;

import com.codenvy.dto.shared.DTO;

@DTO
public interface ColumnDTO extends DatabaseMetadataEntityDTO {

    ColumnDTO withName(String name);

    ColumnDTO withColumnDataType(String datatypeName);

    String getColumnDataType();

    void setColumnDataType(String columnDataTypeName);

    ColumnDTO withDefaultValue(String defaultValue);

    void setDefaultValue(String defaultValue);

    String getDefalulValue();

    ColumnDTO withDataSize(int size);

    void setDataSize(int size);

    int getDataSize();

    ColumnDTO withDecimalDigits(int digits);

    void setDecimalDigits(int digits);

    int getDecimalDigits();

    ColumnDTO withNullable(boolean nullable);

    void setNullable(boolean nullable);

    boolean getNullable();
}

Add properties to column DTO

Add properties to column DTO


package io.mypojo.framework;

import io.mypojo.felix.framework.ServiceRegistry;
import io.mypojo.felix.framework.util.EventDispatcher;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;

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

@SuppressWarnings("PackageAccessibility")
public class PojoSRInternals {
    public BundleContext m_context;
    public final Map<String, Bundle> m_symbolicNameToBundle = new HashMap<>();
    public final ServiceRegistry m_reg = new ServiceRegistry(
            new ServiceRegistry.ServiceRegistryCallbacks() {
                public void serviceChanged(ServiceEvent event,
                                           Dictionary oldProps) {
                    m_dispatcher.fireServiceEvent(event, oldProps, null);
                }
            });
    public final EventDispatcher m_dispatcher = new EventDispatcher(m_reg);
    public final Map<Long, Bundle> m_bundles = new HashMap<Long, Bundle>();
    public final Map bundleConfig = new HashMap();
}

package io.mypojo.framework;

import io.mypojo.felix.framework.ServiceRegistry;
import io.mypojo.felix.framework.util.EventDispatcher;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceEvent;

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

@SuppressWarnings("PackageAccessibility")
public class PojoSRInternals {
    public BundleContext m_context;
    public final Map<String, Bundle> m_symbolicNameToBundle = new HashMap<>();
    public final ServiceRegistry m_reg = new ServiceRegistry(
            new ServiceRegistry.ServiceRegistryCallbacks() {
                public void serviceChanged(ServiceEvent event,
                                           Dictionary oldProps) {
                    m_dispatcher.fireServiceEvent(event, oldProps, null);
                }
            });
    public final EventDispatcher m_dispatcher = new EventDispatcher(m_reg);
    public final Map<Long, Bundle> m_bundles = new HashMap<>();
    public final Map bundleConfig = new HashMap();
}

Fix generics as a result of Java 7 upgrade


// Copyright 2011 The Apache Software Foundation
//
// 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.apache.tapestry5.internal.services.security;

import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.security.WhitelistAnalyzer;

/**
 * Standard analyzer that places requests from the "localhost", "127.0.0.1", or "0:0:0:0:0:0:0:1%0" onto the white list.
 *
 * @since 5.3
 */
public class LocalhostOnly implements WhitelistAnalyzer
{
    public boolean isRequestOnWhitelist(Request request)
    {
        String remoteHost = request.getRemoteHost();

        return remoteHost.equals("localhost") || remoteHost.equals("127.0.0.1") || remoteHost.equals("0:0:0:0:0:0:0:1%0");
    }
}

// Copyright 2011, 2012 The Apache Software Foundation
//
// 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.apache.tapestry5.internal.services.security;

import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.security.WhitelistAnalyzer;

/**
 * Standard analyzer that places requests from the "localhost", "127.0.0.1", "0:0:0:0:0:0:0:1%0", or :"0:0:0:0:0:0:0:1" onto the white list.
 *
 * @since 5.3
 */
public class LocalhostOnly implements WhitelistAnalyzer
{
    public boolean isRequestOnWhitelist(Request request)
    {
        String remoteHost = request.getRemoteHost();

        return remoteHost.equals("localhost") || remoteHost.equals("127.0.0.1") || remoteHost.equals("0:0:0:0:0:0:0:1%0") || remoteHost.equals("0:0:0:0:0:0:0:1");
    }
}

TAP5-1836: Add 0:0:0:0:0:0:0:1 as another recognized value for remoteHost meaning local

git-svn-id: d9b8539636d91aff9cd33ed5cd52a0cf73394897@1293000 13f79535-47bb-0310-9956-ffa450edef68


package org.fakekoji.jobmanager;

import org.fakekoji.jobmanager.model.JobUpdateResults;

import java.util.Objects;

public class ManagementResult {

    public final Object config;
    public final JobUpdateResults jobUpdateResults;

    public ManagementResult(Object config, JobUpdateResults jobUpdateResults) {
        this.config = config;
        this.jobUpdateResults = jobUpdateResults;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ManagementResult)) return false;
        ManagementResult that = (ManagementResult) o;
        return Objects.equals(config, that.config) &&
                Objects.equals(jobUpdateResults, that.jobUpdateResults);
    }

    @Override
    public int hashCode() {
        return Objects.hash(config, jobUpdateResults);
    }

    @Override
    public String toString() {
        return "ManagementResult{" +
                "config=" + config +
                ", jobupdateResults=" + jobUpdateResults +
                '}';
    }
}

package org.fakekoji.jobmanager;

import org.fakekoji.jobmanager.model.JobUpdateResults;

import java.util.Objects;

public class ManagementResult <C> {

    public final C config;
    public final JobUpdateResults jobUpdateResults;

    public ManagementResult(C config, JobUpdateResults jobUpdateResults) {
        this.config = config;
        this.jobUpdateResults = jobUpdateResults;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ManagementResult)) return false;
        ManagementResult that = (ManagementResult) o;
        return Objects.equals(config, that.config) &&
                Objects.equals(jobUpdateResults, that.jobUpdateResults);
    }

    @Override
    public int hashCode() {
        return Objects.hash(config, jobUpdateResults);
    }

    @Override
    public String toString() {
        return "ManagementResult{" +
                "config=" + config +
                ", jobupdateResults=" + jobUpdateResults +
                '}';
    }
}

Add generic Config type in Management Result


/*
 * ******************************************************************************
 *  Copyright 2011-2015 CovertJaguar
 *
 *  This work (the API) is licensed under the "MIT" License, see LICENSE.md for details.
 * ***************************************************************************
 */
@API(apiVersion="2.0.0", owner="RailcraftAPI|core", provides="RailcraftAPI|electricity")
package mods.railcraft.api.electricity;
import net.minecraftforge.fml.common.API;

/*
 * ******************************************************************************
 *  Copyright 2011-2015 CovertJaguar
 *
 *  This work (the API) is licensed under the "MIT" License, see LICENSE.md for details.
 * ***************************************************************************
 */
@API(apiVersion="3.0.0", owner="RailcraftAPI|core", provides="RailcraftAPI|electricity")
package mods.railcraft.api.electricity;
import net.minecraftforge.fml.common.API;

Bump the version for the electricity package.


package com.faforever.client.play;

import com.google.api.client.util.Key;

import java.util.Date;

public class PlayerAchievement {

  @Key("state")
  private AchievementState state;
  @Key("achievement_id")
  private String achievementId;
  @Key("current_steps")
  private int currentSteps;
  @Key("create_time")
  private long createTime;
  @Key("update_time")
  private long updateTime;

  public AchievementState getState() {
    return state;
  }

  public void setState(AchievementState state) {
    this.state = state;
  }

  public String getAchievementId() {
    return achievementId;
  }

  public void setAchievementId(String achievementId) {
    this.achievementId = achievementId;
  }

  public int getCurrentSteps() {
    return currentSteps;
  }

  public void setCurrentSteps(int currentSteps) {
    this.currentSteps = currentSteps;
  }

  public Date getCreateTime() {
    return new Date(createTime * 1000);
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime.getTime() / 1000;
  }

  public Date getUpdateTime() {
    return new Date(updateTime * 1000);
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime.getTime() / 1000;
  }
}

package com.faforever.client.play;

import com.google.api.client.util.Key;

import java.util.Date;

public class PlayerAchievement {

  @Key("state")
  private AchievementState state;
  @Key("achievement_id")
  private String achievementId;
  @Key("current_steps")
  private Integer currentSteps;
  @Key("create_time")
  private long createTime;
  @Key("update_time")
  private long updateTime;

  public AchievementState getState() {
    return state;
  }

  public void setState(AchievementState state) {
    this.state = state;
  }

  public String getAchievementId() {
    return achievementId;
  }

  public void setAchievementId(String achievementId) {
    this.achievementId = achievementId;
  }

  public int getCurrentSteps() {
    return currentSteps;
  }

  public void setCurrentSteps(int currentSteps) {
    this.currentSteps = currentSteps;
  }

  public Date getCreateTime() {
    return new Date(createTime * 1000);
  }

  public void setCreateTime(Date createTime) {
    this.createTime = createTime.getTime() / 1000;
  }

  public Date getUpdateTime() {
    return new Date(updateTime * 1000);
  }

  public void setUpdateTime(Date updateTime) {
    this.updateTime = updateTime.getTime() / 1000;
  }
}

Allow NULL values for current_steps

Allow NULL values for current_steps