package org.ligoj.app.plugin.prov.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import org.ligoj.app.api.NodeScoped;
import org.ligoj.app.model.Node;
import org.ligoj.bootstrap.core.model.AbstractDescribedEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.Getter;
import lombok.Setter;

/**
 * An instance price configuration
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_PROV_INSTACE_PRICE_TYPE", uniqueConstraints = @UniqueConstraint(columnNames = { "name", "node" }))
public class ProvInstancePriceType extends AbstractDescribedEntity<Integer> implements NodeScoped {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 4795855466011388616L;

	/**
	 * Billing period in minutes. Any started period is due.
	 */
	@NotNull
	private Integer period;

	/**
	 * The related node (VM provider) of this instance.
	 */
	@NotNull
	@ManyToOne(fetch=FetchType.LAZY)
	@JsonIgnore
	private Node node;

}

package org.ligoj.app.plugin.prov.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import org.ligoj.app.api.NodeScoped;
import org.ligoj.app.model.Node;
import org.ligoj.bootstrap.core.model.AbstractDescribedEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import lombok.Getter;
import lombok.Setter;

/**
 * An instance price configuration
 */
@Getter
@Setter
@Entity
@Table(name = "LIGOJ_PROV_INSTANCE_PRICE_TYPE", uniqueConstraints = @UniqueConstraint(columnNames = { "name", "node" }))
public class ProvInstancePriceType extends AbstractDescribedEntity<Integer> implements NodeScoped {

	/**
	 * SID
	 */
	private static final long serialVersionUID = 4795855466011388616L;

	/**
	 * Billing period in minutes. Any started period is due.
	 */
	@NotNull
	private Integer period;

	/**
	 * The related node (VM provider) of this instance.
	 */
	@NotNull
	@ManyToOne(fetch=FetchType.LAZY)
	@JsonIgnore
	private Node node;

}

Fix typo in table name


package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter;

public class ZConverter extends AbstractSingleValueConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    public Object fromString(String str) {
        return new Z("z");
    }

}

package com.thoughtworks.acceptance.someobjects;

import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;

public class ZConverter extends AbstractBasicConverter {

    public boolean canConvert(Class type) {
        return type.equals(Z.class);
    }

    protected Object fromString(String str) {
        return new Z("z");
    }

}

Revert to 1.1.1 converter ... it is part of compatibility test.


package com.tehmou.rxbookapp.data.base.route;

import android.net.Uri;

/**
 * Created by ttuo on 04/05/15.
 */
public interface DatabaseRoute {
    public String getPath();
    public String getTableName();
    public String getDefaultSortOrder();
    public String getWhere(Uri uri);
    public String getMimeType();
}

package com.tehmou.rxbookapp.data.base.route;

import android.net.Uri;

/**
 * Created by ttuo on 04/05/15.
 */
public interface DatabaseRoute {
    String getPath();
    String getTableName();
    String getDefaultSortOrder();
    String getWhere(Uri uri);
    String getMimeType();
}

Remove public from interface methods


package wicket.contrib.woogle.dao.hibernate;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import wicket.contrib.woogle.dao.SearchDAO;
import wicket.contrib.woogle.domain.Search;

public class SearchDAOHibernate extends HibernateDaoSupport implements
		SearchDAO {

	public void save(Search search) {
		// Only persist if no other searches found with the same
		// search string and session id.
		DetachedCriteria c = DetachedCriteria.forClass(Search.class);
		c.add(Restrictions.eq("search", search.getSearch()));
		c.add(Restrictions.eq("sessionId", search.getSessionId()));

		List result = getHibernateTemplate().findByCriteria(c);

		if (result.size() == 0) {
			getHibernateTemplate().save(search);
		}
	}

	@SuppressWarnings("unchecked")
	public List<Search> listTopSearches() {
		String hql = "SELECT s FROM Search s GROUP BY s.search ORDER BY COUNT(s.search) DESC LIMIT 10";

		return getHibernateTemplate().find(hql);
	}

}

package wicket.contrib.woogle.dao.hibernate;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import wicket.contrib.woogle.dao.SearchDAO;
import wicket.contrib.woogle.domain.Search;

public class SearchDAOHibernate extends HibernateDaoSupport implements
		SearchDAO {

	public void save(Search search) {
		// Only persist if no other searches found with the same
		// search string and session id.
		DetachedCriteria c = DetachedCriteria.forClass(Search.class);
		c.add(Restrictions.eq("search", search.getSearch()));
		c.add(Restrictions.eq("sessionId", search.getSessionId()));

		List result = getHibernateTemplate().findByCriteria(c);

		if (result.size() == 0) {
			getHibernateTemplate().save(search);
		}
	}

	@SuppressWarnings("unchecked")
	public List<Search> listTopSearches() {
		String hql = "SELECT s FROM Search s GROUP BY s.search ORDER BY COUNT(s.search) DESC";

		getHibernateTemplate().setMaxResults(10);

		return getHibernateTemplate().find(hql);
	}

}

Correct limit for the top searches


package com.shaneutt.calculator;

import org.junit.Test;

import static org.junit.Assert.*;

public class ShanesCalculatorTest {

    @Test
    public void testOnCreate() throws Exception {

    }

    @Test
    public void testOnCreateOptionsMenu() throws Exception {

    }

    @Test
    public void testOnOptionsItemSelected() throws Exception {

    }
}

package com.shaneutt.calculator;

import org.junit.Test;

import static org.junit.Assert.*;

public class ShanesCalculatorTest {

    @Test
    public void testOnCreate() throws Exception {

    }

    @Test
    public void testOnCreateOptionsMenu() throws Exception {

    }

    @Test
    public void testOnOptionsItemSelected() throws Exception {

    }

    @Test
    public void testReconcileStack() throws Exception {

    }

    @Test
    public void testUpdateDisplay() throws Exception {

    }
}

Add skele for other function tests


package org.zalando.nakadi.domain;

public enum CompatibilityMode {
    FORWARD, COMPATIBLE, NONE;
}

package org.zalando.nakadi.domain;

public enum CompatibilityMode {
    FORWARD, COMPATIBLE, NONE,
    BACKWARD, BACKWARD_TRANSITIVE,
    FORWARD_TRANSITIVE, COMPATIBLE_TRANSITIVE
}

Add new Avro compatibility modes


package alien4cloud.paas.cloudify3.location;

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

import org.springframework.stereotype.Component;

import com.google.common.collect.Sets;

import alien4cloud.model.deployment.matching.MatchingConfiguration;
import alien4cloud.model.orchestrators.locations.LocationResourceTemplate;
import alien4cloud.orchestrators.plugin.ILocationResourceAccessor;

@Component
public class ByonLocationConfigurator extends AbstractLocationConfigurator {
    @Override
    protected String[] getLocationArchivePaths() {
        return new String[] { "provider/byon/configuration" };
    }

    @Override
    public List<String> getResourcesTypes() {
        return getAllResourcesTypes();
    }

    @Override
    public List<LocationResourceTemplate> instances(ILocationResourceAccessor resourceAccessor) throws UnsupportedOperationException {
        throw new UnsupportedOperationException("Auto-config is not supported for this location.");
    }

    @Override
    public Set<String> getManagedLocationTypes() {
        return Sets.newHashSet("byon");
    }

    @Override
    public Map<String, MatchingConfiguration> getMatchingConfigurations() {
        return getMatchingConfigurations("provider/openstack/matching/config.yml");
    }
}

package alien4cloud.paas.cloudify3.location;

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

import org.springframework.stereotype.Component;

import com.google.common.collect.Sets;

import alien4cloud.model.deployment.matching.MatchingConfiguration;
import alien4cloud.model.orchestrators.locations.LocationResourceTemplate;
import alien4cloud.orchestrators.plugin.ILocationResourceAccessor;

@Component
public class ByonLocationConfigurator extends AbstractLocationConfigurator {
    @Override
    protected String[] getLocationArchivePaths() {
        return new String[] { "provider/byon/configuration" };
    }

    @Override
    public List<String> getResourcesTypes() {
        return getAllResourcesTypes();
    }

    @Override
    public List<LocationResourceTemplate> instances(ILocationResourceAccessor resourceAccessor) {
        return null;
    }

    @Override
    public Set<String> getManagedLocationTypes() {
        return Sets.newHashSet("byon");
    }

    @Override
    public Map<String, MatchingConfiguration> getMatchingConfigurations() {
        return getMatchingConfigurations("provider/openstack/matching/config.yml");
    }
}

Revert "ALIEN-2265: throw an exception when a user try an auto-config on location who don't support this operation"


package de.danoeh.antennapod.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import de.danoeh.antennapod.core.preferences.UserPreferences;

/**
 * Lets the user start the OPML-import process.
 */
public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {

    private static final String TAG = "OpmlImportFromIntentAct";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTheme(UserPreferences.getTheme());
        super.onCreate(savedInstanceState);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        Uri uri = getIntent().getData();
        if (uri != null && uri.toString().startsWith("/")) {
            uri = Uri.parse("file://" + uri.toString());
        } else {
            uri = Uri.parse(getIntent().getStringExtra(Intent.EXTRA_TEXT));
        }
        importUri(uri);
    }

    @Override
    protected boolean finishWhenCanceled() {
        return true;
    }

}

package de.danoeh.antennapod.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import de.danoeh.antennapod.core.preferences.UserPreferences;

/**
 * Lets the user start the OPML-import process.
 */
public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity {

    private static final String TAG = "OpmlImportFromIntentAct";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setTheme(UserPreferences.getTheme());
        super.onCreate(savedInstanceState);

        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        Uri uri = getIntent().getData();
        if (uri != null && uri.toString().startsWith("/")) {
            uri = Uri.parse("file://" + uri.toString());
        } else {
            String extraText = getIntent().getStringExtra(Intent.EXTRA_TEXT);
            if(extraText != null) {
                uri = Uri.parse(extraText);
            }
        }
        importUri(uri);
    }

    @Override
    protected boolean finishWhenCanceled() {
        return true;
    }

}

Check extra text for null


/*
 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
 *
 * 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.gbif.ws.client.filter;

import org.gbif.api.model.common.User;
import org.gbif.api.model.common.UserPrincipal;

import java.security.Principal;
import java.util.function.Supplier;

import com.google.common.base.Strings;

/**
 * A Principal provider providing the same principal every time. The principal to be provided can be
 * changed at any time.
 *
 * <p>Useful for testing ws-resources.
 */
public class SimplePrincipalProvider implements Supplier<Principal> {

  private UserPrincipal current;

  public void setPrincipal(String username) {
    if (Strings.isNullOrEmpty(username)) {
      current = null;
    } else {
      User user = new User();
      user.setUserName(username);
      current = new UserPrincipal(user);
    }
  }

  @Override
  public Principal get() {
    return current;
  }
}

/*
 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
 *
 * 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.gbif.ws.client.filter;

import org.gbif.api.model.common.GbifUser;
import org.gbif.api.model.common.GbifUserPrincipal;

import java.security.Principal;
import java.util.function.Supplier;

import com.google.common.base.Strings;

/**
 * A Principal provider providing the same principal every time. The principal to be provided can be
 * changed at any time.
 *
 * <p>Useful for testing ws-resources.
 */
public class SimplePrincipalProvider implements Supplier<Principal> {

  private GbifUserPrincipal current;

  public void setPrincipal(String username) {
    if (Strings.isNullOrEmpty(username)) {
      current = null;
    } else {
      GbifUser user = new GbifUser();
      user.setUserName(username);
      current = new GbifUserPrincipal(user);
    }
  }

  @Override
  public Principal get() {
    return current;
  }
}

Replace deprecated auth class with alternatives


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

public class SqlBaseTableOrView implements ITableView
{
   private String mTableOrViewName;

   public void setBaseTable(String tableOrViewName)
   {
      mTableOrViewName = tableOrViewName;
   }

   /**
    * Returns the value specified by rr:tableName property.
    */
   public String getBaseTable()
   {
      return mTableOrViewName;
   }

   @Override
   public String getSqlQuery()
   {
      return String.format("SELECT * FROM \"%s\"", mTableOrViewName);
   }
}

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

public class SqlBaseTableOrView implements ITableView
{
   private String mTableOrViewName;

   public void setBaseTable(String tableOrViewName)
   {
      mTableOrViewName = tableOrViewName;
   }

   /**
    * Returns the value specified by rr:tableName property.
    */
   public String getBaseTable()
   {
      return mTableOrViewName;
   }

   @Override
   public String getSqlQuery()
   {
      return String.format("SELECT * FROM %s", mTableOrViewName);
   }
}

Remove double quote characters when producing default SQL query.


/*
 * Copyright (C) 2018 the original author or authors.
 *
 * This file is part of jBB Application Project.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 */

package org.jbb.system.impl;

import org.jbb.lib.cache.CacheConfig;
import org.jbb.lib.commons.CommonsConfig;
import org.jbb.lib.db.DbConfig;
import org.jbb.lib.eventbus.EventBusConfig;
import org.jbb.lib.logging.LoggingConfig;
import org.jbb.lib.mvc.MvcConfig;
import org.jbb.lib.properties.PropertiesConfig;
import org.jbb.lib.test.MockCommonsConfig;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {CommonsConfig.class, SystemConfig.class, MvcConfig.class, LoggingConfig.class,
        EventBusConfig.class, PropertiesConfig.class, DbConfig.class, CacheConfig.class, MockCommonsConfig.class})
public abstract class BaseIT {

}

/*
 * Copyright (C) 2018 the original author or authors.
 *
 * This file is part of jBB Application Project.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 */

package org.jbb.system.impl;

import org.jbb.lib.cache.CacheConfig;
import org.jbb.lib.commons.CommonsConfig;
import org.jbb.lib.db.DbConfig;
import org.jbb.lib.eventbus.EventBusConfig;
import org.jbb.lib.health.HealthCheckConfig;
import org.jbb.lib.logging.LoggingConfig;
import org.jbb.lib.mvc.MvcConfig;
import org.jbb.lib.properties.PropertiesConfig;
import org.jbb.lib.test.MockCommonsConfig;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = {CommonsConfig.class, SystemConfig.class, MvcConfig.class, LoggingConfig.class,
    EventBusConfig.class, PropertiesConfig.class, DbConfig.class, CacheConfig.class,
    HealthCheckConfig.class, MockCommonsConfig.class})
public abstract class BaseIT {

}

Fix system module integration tests


package org.datavaultplatform.broker.services;

import org.datavaultplatform.common.metadata.*;

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

/* Mock interface for an external metadata service such as a CRIS system */

public class ExternalMetadataService {

    List<Dataset> datasets = new ArrayList<>();

    public List<Dataset> getDatasets() { return datasets; }
    public Dataset getDataset(String id) { Dataset d = new Dataset(); d.setID(id); return d; }
}

package org.datavaultplatform.broker.services;

import org.datavaultplatform.common.metadata.*;

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

/* Mock interface for an external metadata service such as a CRIS system */

public class ExternalMetadataService {

    List<Dataset> datasets = new ArrayList<>();

    public ExternalMetadataService() {
        generateMockData();
    }

    private void generateMockData() {
        for (int i = 0; i < 10; i++) {
            Dataset d = new Dataset();
            d.setID("DATASET" + i);
            d.setName("Sample dataset " + i);
            datasets.add(d);
        }
    }

    public List<Dataset> getDatasets() { return datasets; }

    public Dataset getDataset(String id) {
        for (Dataset d : datasets) {
            if (d.getID().equals(id)) {
                return d;
            }
        }
        return null;
    }
}

Add mock data for metadata API


package gov.samhsa.c2s.c2suiapi.service;

import gov.samhsa.c2s.c2suiapi.infrastructure.TryPolicyClient;
import org.springframework.stereotype.Service;

import java.util.Locale;

@Service
public class TryPolicyServiceImpl implements TryPolicyService {
    private final TryPolicyClient tryPolicyClient;

    public TryPolicyServiceImpl(TryPolicyClient tryPolicyClient) {
        this.tryPolicyClient = tryPolicyClient;
    }

    @Override
    public Object getSegmentDocXHTML(String documentId, String consentId, String patientId, String purposeOfUse, Locale locale) {
          return tryPolicyClient.tryPolicyByConsentIdXHTML(documentId, consentId, patientId, purposeOfUse, locale);
    }
}

package gov.samhsa.c2s.c2suiapi.service;

import gov.samhsa.c2s.c2suiapi.infrastructure.TryPolicyClient;
import gov.samhsa.c2s.c2suiapi.service.exception.TryPolicyException;
import org.springframework.stereotype.Service;

import java.util.Locale;

@Service
public class TryPolicyServiceImpl implements TryPolicyService {
    private final TryPolicyClient tryPolicyClient;

    public TryPolicyServiceImpl(TryPolicyClient tryPolicyClient) {
        this.tryPolicyClient = tryPolicyClient;
    }

    @Override
    public Object getSegmentDocXHTML(String documentId, String consentId, String patientId, String purposeOfUse, Locale locale) {
        Object tryPolicyResponse;
        try{
            tryPolicyResponse = tryPolicyClient.tryPolicyByConsentIdXHTML(documentId, consentId, patientId, purposeOfUse, locale);
        }catch (Exception e){
            //Todo: Refactor this block to watch for specific error status codes and throw custom exception
            throw new TryPolicyException(e.getMessage());
        }
        return tryPolicyResponse;
    }
}

Split into declaration and assignment


/*
 * Copyright 2015 John "LuaMilkshake" Marion
 *
 * 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 net.pktr.smartbackup;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLServerStartingEvent;

@Mod(modid = SmartBackup.MOD_ID,
    name = SmartBackup.MOD_NAME,
    version = SmartBackup.VERSION,
    acceptableRemoteVersions = "*")
public class SmartBackup {
	public static final String MOD_ID = "smartbackup";
	public static final String MOD_NAME = "SmartBackup";
	public static final String VERSION = "$VERSION$";
	public static final String SOURCE_REVISION = "$SOURCE_REVISION$";
	public static final String BUILD_TIMESTAMP = "$BUILD_TIMESTAMP$";

	@EventHandler
	public void serverStartingEvent(FMLServerStartingEvent event) {
		event.registerServerCommand(new BackupCommand());
	}
}

/*
 * Copyright 2015 John "LuaMilkshake" Marion
 *
 * 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 net.pktr.smartbackup;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLServerStartingEvent;

@Mod(modid = SmartBackup.MOD_ID,
    name = SmartBackup.MOD_NAME,
    version = SmartBackup.VERSION,
    acceptableRemoteVersions = "*")
public class SmartBackup {
	public static final String MOD_ID = "smartbackup";
	public static final String MOD_NAME = "SmartBackup";

	// These are filled in by the build process.
	public static final String VERSION = "$VERSION$";
	public static final String SOURCE_REVISION = "$SOURCE_REVISION$";
	public static final String BUILD_TIMESTAMP = "$BUILD_TIMESTAMP$";

	@EventHandler
	public void serverStartingEvent(FMLServerStartingEvent event) {
		event.registerServerCommand(new BackupCommand());
	}
}

Add note about build-generated members


package fi.jyu.ln.luontonurkka.tools;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by jarno on 10/22/16.
 */

public class SettingsManager {

    private SharedPreferences sp;

    public SettingsManager(Activity activity) {
        sp = activity.getPreferences(Context.MODE_PRIVATE);
    }

    public void setBool(String preference, boolean bool) {
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean(preference, bool);
        editor.commit();
    }

    public boolean getBool(String preference) {
        return sp.getBoolean(preference, false);
    }

}

package fi.jyu.ln.luontonurkka.tools;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by Jarno 22.10.16
 */

public class SettingsManager {

    private SharedPreferences sp;

    public SettingsManager(Activity activity) {
        PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
        sp = activity.getPreferences(Context.MODE_PRIVATE);
    }

    public void setBool(String preference, boolean bool) {
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean(preference, bool);
        editor.commit();
    }

    public boolean getBool(String preference) {
        return sp.getBoolean(preference, false);
    }

}

Save preferences to application context


/****************************************************************************
 * Copyright (c) 2004 Composent, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Composent, Inc. - initial API and implementation
 *****************************************************************************/

package org.eclipse.ecf.tests.provider.jms.mqtt;

public interface Mqtt {

	public static final String CLIENT_CONTAINER_NAME = "ecf.jms.mqtt.client";
	public static final String SERVER_CONTAINER_NAME = "ecf.jms.mqtt.manager";
	public static final String TARGET_NAME = System.getProperty("org.eclipse.ecf.tests.provider.jms.mqtt", "tcp://m2m.eclipse.org:1883/exampleTopic");
	public static final String NAMESPACE_NAME = "ecf.namespace.jmsid";

}

/****************************************************************************
 * Copyright (c) 2004 Composent, Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Composent, Inc. - initial API and implementation
 *****************************************************************************/

package org.eclipse.ecf.tests.provider.jms.mqtt;

public interface Mqtt {

	public static final String CLIENT_CONTAINER_NAME = "ecf.jms.mqtt.client";
	public static final String SERVER_CONTAINER_NAME = "ecf.jms.mqtt.manager";
	public static final String TARGET_NAME = System.getProperty("org.eclipse.ecf.tests.provider.jms.mqtt", "tcp://iot.eclipse.org:1883/exampleTopic");
	public static final String NAMESPACE_NAME = "ecf.namespace.jmsid";

}

Fix for change in MQTT broker domain name from m2m.eclipse.org to iot.eclipse.org


package com.moac.android.soundmap.api;

import android.util.Log;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.google.gson.Gson;

public class ApiClient {

    private static final String TAG = ApiClient.class.getSimpleName();

    private final String hostDomain;
    private final String hostScheme;
    private final String clientId;

    private Gson gson;
    private RequestQueue requestQueue;

    public ApiClient(RequestQueue requestQueue, Gson gson, String hostScheme, String hostDomain, String clientId) {
        this.requestQueue = requestQueue;
        this.gson = gson;
        this.hostScheme = hostScheme;
        this.hostDomain = hostDomain;
        this.clientId = clientId;
    }

    public <T> void execute(ApiRequest<T> request, Response.Listener<T> okListener, Response.ErrorListener errorListener) {

        // Add required header
        if (!request.getQueryMap().containsKey(ApiConst.CLIENT_ID_PARAM)) {
            request.withQuery(ApiConst.CLIENT_ID_PARAM, clientId);
        }

        final String url = String.format("%s://%s%s", hostScheme, hostDomain, request.toUrl());
        Log.i(TAG, "### execute() ### - url: " + url);
        GsonRequest apiRequest = new GsonRequest<>(gson, url, request.getTargetType(), okListener, errorListener);
        requestQueue.add(apiRequest);
    }
}

package com.moac.android.soundmap.api;

import android.util.Log;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.google.gson.Gson;

public class ApiClient {

    private static final String TAG = ApiClient.class.getSimpleName();

    private final String hostDomain;
    private final String hostScheme;
    private final String clientId;

    private Gson gson;
    private RequestQueue requestQueue;

    public ApiClient(RequestQueue requestQueue, Gson gson, String hostScheme, String hostDomain, String clientId) {
        this.requestQueue = requestQueue;
        this.gson = gson;
        this.hostScheme = hostScheme;
        this.hostDomain = hostDomain;
        this.clientId = clientId;
    }

    public <T> void execute(ApiRequest<T> request, Response.Listener<T> okListener, Response.ErrorListener errorListener) {

        // Add required header
        if (!request.getQueryMap().containsKey(ApiConst.CLIENT_ID_PARAM)) {
            request.withQuery(ApiConst.CLIENT_ID_PARAM, clientId);
        }

        final String url = String.format("%s://%s%s", hostScheme, hostDomain, request.toUrl());
        Log.i(TAG, "### execute() ### - url: " + url);
        GsonRequest<T> apiRequest = new GsonRequest<>(gson, url, request.getTargetType(), okListener, errorListener);
        requestQueue.add(apiRequest);
    }
}

Fix unsafe operation generics warning


package com.simplenote.android;

public class Constants {
	/** Name of stored preferences */
	public static final String PREFS_NAME = "SimpleNotePrefs";
	/** Logging tag prefix */
	public static final String TAG = "SimpleNote:";
	// Message Codes
	public static final int MESSAGE_UPDATE_NOTE = 12398;
	// Activity for result request Codes
	public static final int REQUEST_LOGIN = 32568;
	// API Base URL
	public static final String API_BASE_URL   = "https://simple-note.appspot.com/api";
	public static final String API_LOGIN_URL  = API_BASE_URL + "/login";					// POST
	public static final String API_NOTES_URL  = API_BASE_URL + "/index";					// GET
	public static final String API_NOTE_URL   = API_BASE_URL + "/note";						// GET
	public static final String API_UPDATE_URL = API_BASE_URL + "/note";						// POST
	public static final String API_DELETE_URL = API_BASE_URL + "/delete";					// GET
	public static final String API_SEARCH_URL = API_BASE_URL + "/search";					// GET
}

package com.simplenote.android;

public class Constants {
	/** Name of stored preferences */
	public static final String PREFS_NAME = "SimpleNotePrefs";
	/** Logging tag prefix */
	public static final String TAG = "SimpleNote:";
	// Message Codes
	public static final int MESSAGE_UPDATE_NOTE = 12398;
	// Activity for result request Codes
	public static final int REQUEST_LOGIN = 32568;
	public static final int REQUEST_EDIT = 9138171;
	// API Base URL
	public static final String API_BASE_URL   = "https://simple-note.appspot.com/api";
	public static final String API_LOGIN_URL  = API_BASE_URL + "/login";					// POST
	public static final String API_NOTES_URL  = API_BASE_URL + "/index";					// GET
	public static final String API_NOTE_URL   = API_BASE_URL + "/note";						// GET
	public static final String API_UPDATE_URL = API_BASE_URL + "/note";						// POST
	public static final String API_DELETE_URL = API_BASE_URL + "/delete";					// GET
	public static final String API_SEARCH_URL = API_BASE_URL + "/search";					// GET
}

Add constant for an edit note request


package thed;

import java.util.Random;

/**
 * ThreadLocal for java.util.Random instances.
 *
 * @author Derek Mulvihill - Sep 2, 2013
 */
public class DRandom {
    private static ThreadLocal<Random> random = new ThreadLocal<Random>() {
        protected Random initialValue() {
            return new Random();
        }
    };

    public static Random get() {
        return random.get();
    }
}

package thed;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * ThreadLocal for java.util.Random instances.
 *
 * @author Derek Mulvihill - Sep 2, 2013
 */
public class DRandom {
    public static Random get() {
        ThreadLocalRandom.current();
    }
}

Use ThreadLocalRandom instead of ThreadLocal<Random>


package io.cloudslang.lang.runtime.configuration;

/*******************************************************************************
* (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
*******************************************************************************/

import org.python.util.PythonInterpreter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

@Configuration
@ComponentScan("io.cloudslang.lang.runtime")
public class SlangRuntimeSpringConfig {

    @Bean
    public PythonInterpreter interpreter(){
        return new PythonInterpreter();
    }

    @Bean
    public ScriptEngine scriptEngine(){
        return  new ScriptEngineManager().getEngineByName("python");
    }

}

package io.cloudslang.lang.runtime.configuration;

/*******************************************************************************
* (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License v2.0 which accompany this distribution.
*
* The Apache License is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
*******************************************************************************/

import org.python.core.Options;
import org.python.util.PythonInterpreter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

@Configuration
@ComponentScan("io.cloudslang.lang.runtime")
public class SlangRuntimeSpringConfig {

    static {
        Options.importSite = false;
    }

    @Bean
    public PythonInterpreter interpreter(){
        return new PythonInterpreter();
    }

    @Bean
    public ScriptEngine scriptEngine(){
        return  new ScriptEngineManager().getEngineByName("python");
    }

}

Use Jython dont import site flag


package cpw.mods.fml.common.network.handshake;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.AttributeKey;

public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
    private static final AttributeKey<IHandshakeState<?>> STATE = new AttributeKey<IHandshakeState<?>>("fml:handshake-state");
    private final AttributeKey<S> fmlHandshakeState;
    private S initialState;

    @SuppressWarnings("unchecked")
    public HandshakeMessageHandler(Class<S> stateType)
    {
        fmlHandshakeState = (AttributeKey<S>) STATE;
        initialState = Enum.valueOf(stateType, "START");
    }
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception
    {
        S state = ctx.attr(fmlHandshakeState).get();
        S newState = state.accept(ctx, msg);
        ctx.attr(fmlHandshakeState).set(newState);
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception
    {
        ctx.attr(fmlHandshakeState).set(initialState);
    }
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
    {
        S state = ctx.attr(fmlHandshakeState).get();
        S newState = state.accept(ctx, null);
        ctx.attr(fmlHandshakeState).set(newState);
    }
}

package cpw.mods.fml.common.network.handshake;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.util.AttributeKey;

public class HandshakeMessageHandler<S extends Enum<S> & IHandshakeState<S>> extends SimpleChannelInboundHandler<FMLHandshakeMessage> {
    private static final AttributeKey<IHandshakeState<?>> STATE = new AttributeKey<IHandshakeState<?>>("fml:handshake-state");
    private final AttributeKey<S> fmlHandshakeState;
    private S initialState;

    @SuppressWarnings("unchecked")
    public HandshakeMessageHandler(Class<S> stateType)
    {
        fmlHandshakeState = (AttributeKey<S>) ((Object)STATE);
        initialState = Enum.valueOf(stateType, "START");
    }
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, FMLHandshakeMessage msg) throws Exception
    {
        S state = ctx.attr(fmlHandshakeState).get();
        S newState = state.accept(ctx, msg);
        ctx.attr(fmlHandshakeState).set(newState);
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception
    {
        ctx.attr(fmlHandshakeState).set(initialState);
    }
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
    {
        S state = ctx.attr(fmlHandshakeState).get();
        S newState = state.accept(ctx, null);
        ctx.attr(fmlHandshakeState).set(newState);
    }
}

Fix stupid possible compiler error.


package org.reldb.dbrowser.ui.version;

public class Version {

	public static double getVersionNumber() {
		return 3.001;
	}

	public static String getVersion() {
		return String.format("Version %.3f", getVersionNumber());
	}

	public static String getCopyright() {
		return "Copyright 2004 - 2016 Dave Voorhis";
	}

	public static String getURL() {
		return "https://reldb.org";
	}

	public static String getPreferencesRepositoryName() {
		return "rel.reldb.org";
	}

	public static String getReportLogURL() {
	    return "https://reldb.org/feedback/";
	}

	public static String getUpdateURL() {
		return "https://reldb.org/updates/";
	}

}

package org.reldb.dbrowser.ui.version;

public class Version {

	public static double getVersionNumber() {
		return 3.001;
	}

	public static String getVersion() {
		return String.format("Version %.3f", getVersionNumber());
	}

	public static String getCopyright() {
		return "Copyright 2004 - 2016 Dave Voorhis";
	}

	public static String getURL() {
		return "https://reldb.org";
	}

	public static String getPreferencesRepositoryName() {
		return "rel.reldb.org";
	}

	public static String getReportLogURL() {
	    return "http://reldb.org/feedback/";
	}

	public static String getUpdateURL() {
		return "http://reldb.org/updates/";
	}

}

Change back to http from https on updates due to brittle dependencies.


package com.prateekj.snooper.infra;

import android.databinding.BindingAdapter;
import android.support.v7.widget.RecyclerView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class CustomBindings {

  @BindingAdapter("app:adapter")
  public static void setAdapter(RecyclerView recyclerView, RecyclerView.Adapter adapter) {
    recyclerView.setAdapter(adapter);
  }

  @BindingAdapter("app:listAdapter")
  public static void setListAdapter(ListView listView, BaseAdapter adapter) {
    listView.setAdapter(adapter);
  }

  @BindingAdapter("app:itemDecoration")
  public static void setItemDecoration(RecyclerView recyclerView, RecyclerView.ItemDecoration itemDecoration) {
    recyclerView.addItemDecoration(itemDecoration);
  }

  @BindingAdapter({"textColor"})
  public static void setTextColor(TextView view, int color) {
    if (color != 0) {
      view.setTextColor(view.getResources().getColor(color));
    }
  }

}

package com.prateekj.snooper.infra;

import android.databinding.BindingAdapter;
import android.support.v7.widget.RecyclerView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class CustomBindings {

  @BindingAdapter("adapter")
  public static void setAdapter(RecyclerView recyclerView, RecyclerView.Adapter adapter) {
    recyclerView.setAdapter(adapter);
  }

  @BindingAdapter("listAdapter")
  public static void setListAdapter(ListView listView, BaseAdapter adapter) {
    listView.setAdapter(adapter);
  }

  @BindingAdapter("itemDecoration")
  public static void setItemDecoration(RecyclerView recyclerView, RecyclerView.ItemDecoration itemDecoration) {
    recyclerView.addItemDecoration(itemDecoration);
  }

  @BindingAdapter({"textColor"})
  public static void setTextColor(TextView view, int color) {
    if (color != 0) {
      view.setTextColor(view.getResources().getColor(color));
    }
  }

}

Revert "Revert "removing data binding warnings""


package patterns;

public class Singleton {
  public static void main(String[] args) {
    Elvis theKing = Elvis.INSTANCE;
    theKing.hasLeftTheBuilding();

    AnotherElvis anotherKing = AnotherElvis.getInstance();
    anotherKing.hasLeftTheBuilding();

    EnumElvis enumElvis = EnumElvis.INSTANCE;
    enumElvis.hasLeftTheBuilding();
  }
}

// With public static method.
class Elvis {
  public static final Elvis INSTANCE = new Elvis();
  private Elvis() {}

  public void hasLeftTheBuilding() {
    System.out.println("Elvis:Long live the king!");
  }
}

// With static factory.
class AnotherElvis {
  private static final AnotherElvis INSTANCE = new AnotherElvis();
  private AnotherElvis() {}

  public static AnotherElvis getInstance() { return INSTANCE; }

  public void hasLeftTheBuilding() {
    System.out.println("AnotherElvis: Long live the king!");
  }

}

// With Enum.
enum EnumElvis {
  INSTANCE;

  public void hasLeftTheBuilding() {
    System.out.println("EnumElvis:Long live the king!");
  }
}

//

Test to see if changes are published to Github contribution graph.


package com.eowise.recyclerview.stickyheaders;

import android.support.v7.widget.RecyclerView;

/**
 * Created by aurel on 16/10/14.
 */
public class StickyHeadersBuilder {

    private RecyclerView recyclerView;
    private RecyclerView.Adapter adapter;
    private StickyHeadersAdapter headersAdapter;
    private HeaderPosition headerPosition;

    public StickyHeadersBuilder() {
    }

    public StickyHeadersBuilder setRecyclerView(RecyclerView recyclerView) {
        this.recyclerView = recyclerView;
        return this;
    }

    public StickyHeadersBuilder setStickyHeadersAdapter(StickyHeadersAdapter adapter) {
        return setStickyHeadersAdapter(adapter, HeaderPosition.TOP);
    }

    public StickyHeadersBuilder setStickyHeadersAdapter(StickyHeadersAdapter adapter, HeaderPosition headerPosition) {
        this.headersAdapter = adapter;
        this.headerPosition = headerPosition;
        return this;
    }

    public StickyHeadersBuilder setAdapter(RecyclerView.Adapter adapter) {
        this.adapter = adapter;
        return this;
    }

    public StickyHeadersItemDecoration build() {

        // TODO: Throw if adapter doesn't have stables ids

        StickyHeadersItemDecoration decoration =  new StickyHeadersItemDecoration(headersAdapter, recyclerView, headerPosition);

        decoration.registerAdapterDataObserver(adapter);

        return decoration;
    }
}

package com.eowise.recyclerview.stickyheaders;

import android.support.v7.widget.RecyclerView;

/**
 * Created by aurel on 16/10/14.
 */
public class StickyHeadersBuilder {

    private RecyclerView recyclerView;
    private RecyclerView.Adapter adapter;
    private StickyHeadersAdapter headersAdapter;
    private HeaderPosition headerPosition;

    public StickyHeadersBuilder() {
    }

    public StickyHeadersBuilder setRecyclerView(RecyclerView recyclerView) {
        this.recyclerView = recyclerView;
        return this;
    }

    public StickyHeadersBuilder setStickyHeadersAdapter(StickyHeadersAdapter adapter) {
        return setStickyHeadersAdapter(adapter, HeaderPosition.TOP);
    }

    public StickyHeadersBuilder setStickyHeadersAdapter(StickyHeadersAdapter adapter, HeaderPosition headerPosition) {
        this.headersAdapter = adapter;
        this.headerPosition = headerPosition;
        return this;
    }

    public StickyHeadersBuilder setAdapter(RecyclerView.Adapter adapter) {
        if (!adapter.hasStableIds()) {
            throw new IllegalArgumentException("Adapter must have stable ids");
        }
        this.adapter = adapter;
        return this;
    }

    public StickyHeadersItemDecoration build() {

        StickyHeadersItemDecoration decoration =  new StickyHeadersItemDecoration(headersAdapter, recyclerView, headerPosition);

        decoration.registerAdapterDataObserver(adapter);

        return decoration;
    }
}

Add validation for adapter stable ids in builder


package uk.gov.register.presentation;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class RegisterDetail {
    private final static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("d MMM uuuu");

    private final String domain;
    private final int totalRecords;
    private final int totalEntries;
    private final int totalItems;
    private final LocalDateTime lastUpdated;
    private final EntryView entryView;

    public RegisterDetail(
            String domain,
            int totalRecords,
            int totalEntries,
            int totalItems,
            LocalDateTime lastUpdated,
            EntryView entryView) {
        this.domain = domain;
        this.totalRecords = totalRecords;
        this.totalEntries = totalEntries;
        this.totalItems = totalItems;
        this.lastUpdated = lastUpdated;
        this.entryView = entryView;
    }

    @JsonProperty("domain")
    public String getDomain() {
        return domain;
    }

    @JsonProperty("last-updated")
    public String getLastUpdatedTime(){
        return DATE_TIME_FORMATTER.format(lastUpdated);
    }

    @JsonProperty("record")
    public EntryView getEntry() {
        return entryView;
    }

    @JsonProperty("total-entries")
    public int getTotalEntries() {
        return totalEntries;
    }

    @JsonProperty("total-items")
    public int getTotalItems() {
        return totalItems;
    }

    @JsonProperty("total-records")
    public int getTotalRecords(){
        return totalRecords;
    }
}

package uk.gov.register.presentation;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.time.LocalDateTime;

public class RegisterDetail {

    private final String domain;
    private final int totalRecords;
    private final int totalEntries;
    private final int totalItems;
    private final LocalDateTime lastUpdated;
    private final EntryView entryView;

    public RegisterDetail(
            String domain,
            int totalRecords,
            int totalEntries,
            int totalItems,
            LocalDateTime lastUpdated,
            EntryView entryView) {
        this.domain = domain;
        this.totalRecords = totalRecords;
        this.totalEntries = totalEntries;
        this.totalItems = totalItems;
        this.lastUpdated = lastUpdated;
        this.entryView = entryView;
    }

    @JsonProperty("domain")
    public String getDomain() {
        return domain;
    }

    @JsonProperty("last-updated")
    public String getLastUpdatedTime(){
        return lastUpdated.toString();
    }

    @JsonProperty("record")
    public EntryView getEntry() {
        return entryView;
    }

    @JsonProperty("total-entries")
    public int getTotalEntries() {
        return totalEntries;
    }

    @JsonProperty("total-items")
    public int getTotalItems() {
        return totalItems;
    }

    @JsonProperty("total-records")
    public int getTotalRecords(){
        return totalRecords;
    }
}

Change the string format for last-updated property of a register.


package org.realityforge.arez.integration;

import org.realityforge.arez.Arez;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class EqualsAndHashCodeTest
{
  @Test
  public void equalsAndHashBasedOnId()
  {
    final PersonModel person1 = PersonModel.create( ValueUtil.randomString(), ValueUtil.randomString() );
    final PersonModel person2 = PersonModel.create( ValueUtil.randomString(), ValueUtil.randomString() );
    final PersonModel person3 =
      Arez.context().safeAction( () -> PersonModel.create( person1.getFirstName(), person1.getLastName() ) );

    assertEquals( person1.hashCode(), person1.hashCode() );
    assertNotEquals( person1.hashCode(), person2.hashCode() );
    assertNotEquals( person1.hashCode(), person3.hashCode() );

    //noinspection EqualsWithItself
    assertTrue( person1.equals( person1 ) );
    assertFalse( person1.equals( person2 ) );
    assertFalse( person1.equals( person3 ) );
  }
}

package org.realityforge.arez.integration;

import javax.annotation.Nonnull;
import org.realityforge.arez.Arez;
import org.realityforge.arez.annotations.ArezComponent;
import org.realityforge.arez.annotations.Observable;
import org.realityforge.guiceyloops.shared.ValueUtil;
import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class EqualsAndHashCodeTest
{

  @SuppressWarnings( "WeakerAccess" )
  @ArezComponent
  public static class PersonModel
  {
    @Nonnull
    private String _firstName;

    @Nonnull
    public static PersonModel create( @Nonnull final String firstName )
    {
      return new EqualsAndHashCodeTest$Arez_PersonModel( firstName );
    }

    PersonModel( @Nonnull final String firstName )
    {
      _firstName = firstName;
    }

    @Observable
    @Nonnull
    public String getFirstName()
    {
      return _firstName;
    }

    public void setFirstName( @Nonnull final String firstName )
    {
      _firstName = firstName;
    }
  }

  @Test
  public void equalsAndHashBasedOnId()
  {
    final PersonModel person1 = PersonModel.create( ValueUtil.randomString() );
    final PersonModel person2 = PersonModel.create( ValueUtil.randomString() );
    final PersonModel person3 =
      Arez.context().safeAction( () -> PersonModel.create( person1.getFirstName() ) );

    assertEquals( person1.hashCode(), person1.hashCode() );
    assertNotEquals( person1.hashCode(), person2.hashCode() );
    assertNotEquals( person1.hashCode(), person3.hashCode() );

    //noinspection EqualsWithItself
    assertTrue( person1.equals( person1 ) );
    assertFalse( person1.equals( person2 ) );
    assertFalse( person1.equals( person3 ) );
  }
}

Use an isolated model so it does not interfere with other integration tests


package com.vaadin.tests.components.textarea;

import java.util.LinkedHashMap;

import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest;
import com.vaadin.ui.TextArea;

public class TextAreaTest extends AbstractTextFieldTest<TextArea> {

    private Command<TextArea, Boolean> wordwrapCommand = new Command<TextArea, Boolean>() {
        public void execute(TextArea c, Boolean value, Object data) {
            c.setWordwrap(value);
        }
    };

    private Command<TextArea, Integer> rowsCommand = new Command<TextArea, Integer>() {
        public void execute(TextArea c, Integer value, Object data) {
            c.setRows(value);
        }
    };

    @Override
    protected Class<TextArea> getTestClass() {
        return TextArea.class;
    }

    @Override
    protected void createActions() {
        super.createActions();
        createWordwrapAction(CATEGORY_STATE);
        createRowsAction(CATEGORY_STATE);
    }

    private void createRowsAction(String category) {
        LinkedHashMap<String, Integer> options = createIntegerOptions(20);
        createSelectAction("Rows", category, options, "0", rowsCommand);
    }

    private void createWordwrapAction(String category) {
        createBooleanAction("Wordwrap", category, false, wordwrapCommand);
    }

}

package com.vaadin.tests.components.textarea;

import java.util.LinkedHashMap;

import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest;
import com.vaadin.ui.TextArea;

public class TextAreaTest extends AbstractTextFieldTest<TextArea> {

    private Command<TextArea, Boolean> wordwrapCommand = new Command<TextArea, Boolean>() {
        public void execute(TextArea c, Boolean value, Object data) {
            c.setWordwrap(value);
        }
    };

    private Command<TextArea, Integer> rowsCommand = new Command<TextArea, Integer>() {
        public void execute(TextArea c, Integer value, Object data) {
            c.setRows(value);
        }
    };

    @Override
    protected Class<TextArea> getTestClass() {
        return TextArea.class;
    }

    @Override
    protected void createActions() {
        super.createActions();
        createWordwrapAction(CATEGORY_FEATURES);
        createRowsAction(CATEGORY_FEATURES);
    }

    private void createRowsAction(String category) {
        LinkedHashMap<String, Integer> options = createIntegerOptions(20);
        createSelectAction("Rows", category, options, "3", rowsCommand);
    }

    private void createWordwrapAction(String category) {
        createBooleanAction("Wordwrap", category, false, wordwrapCommand);
    }

}

Use 3 rows by default in test


package lib.morkim.mfw.usecase;

import lib.morkim.mfw.app.AppContext;

public abstract class SyncUseCase extends BaseUseCase implements UseCaseStateListener {

	public SyncUseCase(AppContext appContext) {
		super(appContext);
	}

	@Override
	public void execute(UseCaseRequest request) {

		setRequest(request);

		onPrepare();
		onExecute();
		onSaveModel();
	}

	@Override
	public void execute() {
		execute(null);
	}

	@Override
	public void executeSync() {
		this.execute();
	}

	@Override
	public void executeSync(UseCaseRequest request) {
		execute(request);
	}

	@Override
	protected void reportProgress() {

	}

	@Override
	public void onUseCaseComplete(UseCaseResult response) {

	}

	@Override
	protected void onSaveModel() {}
}

package lib.morkim.mfw.usecase;

import lib.morkim.mfw.app.AppContext;

public abstract class SyncUseCase extends BaseUseCase implements UseCaseStateListener {

	public SyncUseCase(AppContext appContext) {
		super(appContext);
	}

	@Override
	public void execute(UseCaseRequest request) {

		setRequest(request);

		onPrepare();
		onExecute();
		onReportProgress();
		onSaveModel();
	}

	@Override
	public void execute() {
		execute(null);
	}

	@Override
	public void executeSync() {
		this.execute();
	}

	@Override
	public void executeSync(UseCaseRequest request) {
		execute(request);
	}

	@Override
	protected void reportProgress() {

	}

	@Override
	public void onUseCaseComplete(UseCaseResult response) {

	}

	@Override
	protected void onSaveModel() {}
}

Call on progress update in sync use case


package org.luxons.sevenwonders.game.cards;

import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.effects.Effect;

public class Card {

    private final String name;

    private final Color color;

    private final Requirements requirements;

    private final Effect effect;

    public Card(String name, Color color, Requirements requirements, Effect effect) {
        this.name = name;
        this.color = color;
        this.requirements = requirements;
        this.effect = effect;
    }

    public String getName() {
        return name;
    }

    public Color getColor() {
        return color;
    }

    public Requirements getRequirements() {
        return requirements;
    }

    public Effect getEffect() {
        return effect;
    }

    public void play(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) {
        board.addCard(this);
        requirements.pay(board);
        effect.apply(board, leftNeighbourBoard, rightNeighbourBoard);
    }

    @Override
    public String toString() {
        return "Card{" + "name='" + name + '\'' + ", color=" + color + ", requirements=" + requirements + ", effect="
                + effect + '}';
    }
}

package org.luxons.sevenwonders.game.cards;

import java.util.List;

import org.luxons.sevenwonders.game.boards.Board;
import org.luxons.sevenwonders.game.effects.Effect;

public class Card {

    private final String name;

    private final Color color;

    private final Requirements requirements;

    private final List<Effect> effects;

    public Card(String name, Color color, Requirements requirements, List<Effect> effects) {
        this.name = name;
        this.color = color;
        this.requirements = requirements;
        this.effects = effects;
    }

    public String getName() {
        return name;
    }

    public Color getColor() {
        return color;
    }

    public Requirements getRequirements() {
        return requirements;
    }

    public List<Effect> getEffects() {
        return effects;
    }

    public void play(Board board, Board leftNeighbourBoard, Board rightNeighbourBoard) {
        board.addCard(this);
        requirements.pay(board);
        effects.forEach(e -> e.apply(board, leftNeighbourBoard, rightNeighbourBoard));
    }

    @Override
    public String toString() {
        return "Card{" + "name='" + name + '\'' + ", color=" + color + ", requirements=" + requirements + ", effects="
                + effects + '}';
    }
}

Add multiple effects support for cards


package sagan.renderer.github;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(HttpStatus.NOT_FOUND)
public class GithubResourceNotFoundException extends RuntimeException {

	private final String resourceName;

	public GithubResourceNotFoundException(String orgName, String repositoryName, Throwable cause) {
		super("Could not find github repository [" + orgName + "/" + repositoryName + "]", cause);
		this.resourceName= "Repository [" + orgName + "/" + repositoryName + "]";
	}

	public GithubResourceNotFoundException(String orgName, Throwable cause) {
		super("Could not fing github organization [" + orgName + "]", cause);
		this.resourceName = "Organization [" + orgName + "]";
	}

	public String getResourceName() {
		return this.resourceName;
	}
}

package sagan.renderer.github;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(HttpStatus.NOT_FOUND)
public class GithubResourceNotFoundException extends RuntimeException {

	private final String resourceName;

	public GithubResourceNotFoundException(String orgName, String repositoryName, Throwable cause) {
		super("Could not find github repository [" + orgName + "/" + repositoryName + "]", cause);
		this.resourceName= "Repository [" + orgName + "/" + repositoryName + "]";
	}

	public GithubResourceNotFoundException(String orgName, Throwable cause) {
		super("Could not find github organization [" + orgName + "]", cause);
		this.resourceName = "Organization [" + orgName + "]";
	}

	public String getResourceName() {
		return this.resourceName;
	}
}

Fix typo "fing" -> "find"


package com.icaynia.pracler.lockscreen;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;

/**
 * Created by icaynia on 31/03/2017.
 */

public class LockScreenService extends Service
{
    public BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) {
                Intent i = new Intent(context, LockScreenActivity.class);
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(i);
            }
        }
    };

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
        registerReceiver(receiver, filter);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unregisterReceiver(receiver);
    }

}

package com.icaynia.pracler.lockscreen;

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;

import com.icaynia.pracler.Global;

/**
 * Created by icaynia on 31/03/2017.
 */

public class LockScreenService extends Service
{
    private Global global;
    public BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction()))
            {
                // 음악이 실행 중일때만 사용합니다.
                if (global.musicService.isPlaying())
                {
                    Intent i = new Intent(context, LockScreenActivity.class);
                    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    context.startActivity(i);
                }
            }
        }
    };

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        global = (Global) getApplication();
        IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_OFF);
        registerReceiver(receiver, filter);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unregisterReceiver(receiver);
    }

}

Fix bugs lock screen service start lock screen activity intent when it's not playing


package org.owntracks.android.support;

import android.content.Context;
import android.location.Address;

import org.owntracks.android.injection.qualifier.AppContext;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import timber.log.Timber;

public class GeocoderGoogle implements Geocoder {
    private static android.location.Geocoder geocoder;

    @Override
    public String reverse(double latitude, double longitude) {
        if(!android.location.Geocoder.isPresent()) {
            Timber.e("geocoder is not present");
            return null;
        }

        List<Address> addresses;
        try {
            addresses = geocoder.getFromLocation(latitude, longitude, 1);
            if ((addresses != null) && (addresses.size() > 0)) {
                StringBuilder g = new StringBuilder();
                Address a = addresses.get(0);
                if (a.getAddressLine(0) != null)
                    g.append(a.getAddressLine(0));
                return g.toString();
            } else {
                return "not available";
            }
        } catch (IOException e) {
            return null;
        }
    }

    GeocoderGoogle(@AppContext Context context){
        geocoder = new android.location.Geocoder(context, Locale.getDefault());
    }
}

package org.owntracks.android.support;

import android.content.Context;
import android.location.Address;

import org.owntracks.android.injection.qualifier.AppContext;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import timber.log.Timber;

public class GeocoderGoogle implements Geocoder {
    private static android.location.Geocoder geocoder;

    @Override
    public String reverse(double latitude, double longitude) {
        if(!android.location.Geocoder.isPresent()) {
            Timber.e("geocoder is not present");
            return null;
        }

        List<Address> addresses;
        try {
            addresses = geocoder.getFromLocation(latitude, longitude, 1);
            if ((addresses != null) && (addresses.size() > 0)) {
                StringBuilder g = new StringBuilder();
                Address a = addresses.get(0);
                if (a.getAddressLine(0) != null)
                    g.append(a.getAddressLine(0));
                return g.toString();
            } else {
                return "not available";
            }
        } catch (Exception e) {
            return null;
        }
    }

    GeocoderGoogle(@AppContext Context context){
        geocoder = new android.location.Geocoder(context, Locale.getDefault());
    }
}

Fix crash when requesting geocoder for invalid lat/lon coordinates


package com.squareup.picasso;

import java.io.File;
import org.junit.runners.model.InitializationError;
import org.robolectric.AndroidManifest;
import org.robolectric.RobolectricTestRunner;

public class PicassoTestRunner extends RobolectricTestRunner {
  public PicassoTestRunner(Class<?> testClass) throws InitializationError {
    super(testClass);
  }

  @Override protected AndroidManifest createAppManifest(File baseDir) {
    return null;
  }
}

package com.squareup.picasso;

import org.junit.runners.model.InitializationError;
import org.robolectric.AndroidManifest;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.res.FsFile;

public class PicassoTestRunner extends RobolectricTestRunner {
  public PicassoTestRunner(Class<?> testClass) throws InitializationError {
    super(testClass);
  }

  @Override protected AndroidManifest createAppManifest(FsFile manifestFile) {
    return null;
  }
}

Fix robolectric test runner override.


package mil.nga.giat.geowave.analytic.javaspark.sparksql.operations;

import com.beust.jcommander.Parameter;

public class SparkSqlOptions
{
	@Parameter(names = {
		"-o",
		"--out"
	}, description = "The output datastore name")
	private String outputStoreName = null;

	@Parameter(names = {
		"--outtype"
	}, description = "The output type name")
	private String outputTypeName = null;

	@Parameter(names = {
		"-s",
		"--show"
	}, description = "Number of result rows to display")
	private int showResults = 0;

	public SparkSqlOptions() {}

	public String getOutputStoreName() {
		return outputStoreName;
	}

	public void setOutputStoreName(
			String outputStoreName ) {
		this.outputStoreName = outputStoreName;
	}

	public int getShowResults() {
		return showResults;
	}

	public void setShowResults(
			int showResults ) {
		this.showResults = showResults;
	}

	public String getOutputTypeName() {
		return outputTypeName;
	}

	public void setOutputTypeName(
			String outputTypeName ) {
		this.outputTypeName = outputTypeName;
	}
}

package mil.nga.giat.geowave.analytic.javaspark.sparksql.operations;

import com.beust.jcommander.Parameter;

public class SparkSqlOptions
{
	@Parameter(names = {
		"-o",
		"--out"
	}, description = "The output datastore name")
	private String outputStoreName = null;

	@Parameter(names = {
		"--outtype"
	}, description = "The output type name")
	private String outputTypeName = null;

	@Parameter(names = {
		"-s",
		"--show"
	}, description = "Number of result rows to display")
	private int showResults = 20;

	public SparkSqlOptions() {}

	public String getOutputStoreName() {
		return outputStoreName;
	}

	public void setOutputStoreName(
			String outputStoreName ) {
		this.outputStoreName = outputStoreName;
	}

	public int getShowResults() {
		return showResults;
	}

	public void setShowResults(
			int showResults ) {
		this.showResults = showResults;
	}

	public String getOutputTypeName() {
		return outputTypeName;
	}

	public void setOutputTypeName(
			String outputTypeName ) {
		this.outputTypeName = outputTypeName;
	}
}

Set show count option to 20 default


package io.github.likcoras.asuka;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.pircbotx.User;
import org.pircbotx.UserLevel;
import com.google.common.base.Optional;
import io.github.likcoras.asuka.exception.ConfigException;

public class AuthManager {

	private String ownerId;
	private Map<String, UserLevel> levels;

	public AuthManager(BotConfig config) throws ConfigException {
		levels = new ConcurrentHashMap<String, UserLevel>();
		ownerId = config.getString("ownerId");
		levels.put(ownerId, UserLevel.OWNER);
	}

	public void setLevel(User user, UserLevel level) {
		String id = BotUtil.getId(user);
		if (!id.equals(ownerId))
			levels.put(id, level);
	}

	public void removeLevel(User user) {
		String id = BotUtil.getId(user);
		if (!id.equals(ownerId))
			levels.remove(id);
	}

	public Optional<UserLevel> getLevel(User user) {
		return Optional.fromNullable(levels.get(BotUtil.getId(user)));
	}

	public boolean checkAccess(User user, UserLevel required) {
		Optional<UserLevel> userLevel = getLevel(user);
		if (!userLevel.isPresent())
			return false;
		return required.compareTo(userLevel.get()) <= 0;
	}

}

package io.github.likcoras.asuka;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.pircbotx.User;
import org.pircbotx.UserLevel;
import com.google.common.base.Optional;
import io.github.likcoras.asuka.exception.ConfigException;

public class AuthManager {

	private String ownerId;
	private Map<String, UserLevel> levels;

	public AuthManager(BotConfig config) throws ConfigException {
		levels = new ConcurrentHashMap<String, UserLevel>();
		ownerId = config.getString("ownerId");
		levels.put(ownerId, UserLevel.OWNER);
	}

	public void setLevel(User user, UserLevel level) {
		setLevel(BotUtil.getId(user), level);
	}

	public void setLevel(String user, UserLevel level) {
		if (!user.equals(ownerId))
			levels.put(user, level);
	}

	public void removeLevel(User user) {
		removeLevel(BotUtil.getId(user));
	}

	public void removeLevel(String user) {
		if (!user.equals(ownerId))
			levels.remove(user);
	}

	public Optional<UserLevel> getLevel(User user) {
		return Optional.fromNullable(levels.get(BotUtil.getId(user)));
	}

	public boolean checkAccess(User user, UserLevel required) {
		Optional<UserLevel> userLevel = getLevel(user);
		if (!userLevel.isPresent())
			return false;
		return required.compareTo(userLevel.get()) <= 0;
	}

}

Allow editing user levels by providing string id


package com.griddynamics.jagger.dbapi.fetcher;

import com.griddynamics.jagger.dbapi.util.ColorCodeGenerator;
import com.griddynamics.jagger.dbapi.dto.*;

import java.util.*;

public abstract class SummaryDbMetricDataFetcher extends DbMetricDataFetcher<MetricDto> {

    protected PlotDatasetDto generatePlotDatasetDto(MetricDto metricDto) {
        //So plot draws as {(0, val0),(1, val1), (2, val2), ... (n, valn)}
        List<PointDto> list = new ArrayList<PointDto>();

        List<MetricValueDto> metricList = new ArrayList<MetricValueDto>();
        for(MetricValueDto value :metricDto.getValues()) {
            metricList.add(value);
        }

        Collections.sort(metricList, new Comparator<MetricValueDto>() {

            @Override
            public int compare(MetricValueDto o1, MetricValueDto o2) {
                return  o2.getSessionId() < o1.getSessionId() ? 1 : -1;
            }
        });

        for (MetricValueDto value: metricList) {
            double temp = Double.parseDouble(value.getValue());
            list.add(new PointDto(value.getSessionId(), temp));
        }

        String legend = metricDto.getMetricName().getMetricDisplayName();

        return new PlotDatasetDto(
                list,
                legend,
                ColorCodeGenerator.getHexColorCode(metricDto.getMetricName().getMetricName(), new String())
        );
    }
}

package com.griddynamics.jagger.dbapi.fetcher;

import com.griddynamics.jagger.dbapi.util.ColorCodeGenerator;
import com.griddynamics.jagger.dbapi.dto.*;

import java.util.*;

public abstract class SummaryDbMetricDataFetcher extends DbMetricDataFetcher<MetricDto> {

    protected PlotDatasetDto generatePlotDatasetDto(MetricDto metricDto) {
        //So plot draws as {(0, val0),(1, val1), (2, val2), ... (n, valn)}
        List<PointDto> list = new ArrayList<PointDto>();

        List<MetricValueDto> metricList = new ArrayList<MetricValueDto>();
        for(MetricValueDto value :metricDto.getValues()) {
            metricList.add(value);
        }

        Collections.sort(metricList, new Comparator<MetricValueDto>() {

            @Override
            public int compare(MetricValueDto o1, MetricValueDto o2) {
                return  o2.getSessionId() < o1.getSessionId() ? 1 : -1;
            }
        });

        for (MetricValueDto value: metricList) {
            double temp = Double.parseDouble(value.getValue());
            list.add(new PointDto(value.getSessionId(), temp));
        }

        String legend = metricDto.getMetricName().getMetricDisplayName();

        return new PlotDatasetDto(
                list,
                legend,
                ColorCodeGenerator.getHexColorCode(metricDto.getMetricName().getMetricName(), "")
        );
    }
}

Change new String() to "".


package de.akquinet.engineering.vaadinator.example.address.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import de.akquinet.engineering.vaadinator.annotations.DisplayBean;
import de.akquinet.engineering.vaadinator.annotations.DisplayProperty;
import de.akquinet.engineering.vaadinator.annotations.DisplayPropertySetting;
import de.akquinet.engineering.vaadinator.annotations.FieldType;

@DisplayBean
@Entity
public class Team {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;
	@DisplayProperty
	private String name;
	@DisplayProperty(profileSettings = {
			@DisplayPropertySetting(fieldType = FieldType.CUSTOM, customClassName = "AddressSelectField") })
	private Address leader;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Address getLeader() {
		return leader;
	}

	public void setLeader(Address leader) {
		this.leader = leader;
	}
}

package de.akquinet.engineering.vaadinator.example.address.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import de.akquinet.engineering.vaadinator.annotations.DisplayBean;
import de.akquinet.engineering.vaadinator.annotations.DisplayProperty;
import de.akquinet.engineering.vaadinator.annotations.DisplayPropertySetting;
import de.akquinet.engineering.vaadinator.annotations.FieldType;

@DisplayBean
@Entity
public class Team {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;
	@DisplayProperty(profileSettings = { @DisplayPropertySetting(showInTable = true) })
	private String name;
	@DisplayProperty(profileSettings = {
			@DisplayPropertySetting(fieldType = FieldType.CUSTOM, customClassName = "AddressSelectField") })
	private Address leader;
	@DisplayProperty(profileSettings = { @DisplayPropertySetting(showInTable = true, showInDetail = false) })
	public String getLeaderName() {
		return leader != null ? leader.getName() : "";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Address getLeader() {
		return leader;
	}

	public void setLeader(Address leader) {
		this.leader = leader;
	}
}

Add content for team table


package io.dongyue.at15.tree.indexer.mapreduce.sort;

import io.dongyue.at15.tree.indexer.mapreduce.Config;

/**
 * Created by at15 on 16-1-1.
 *
 * @TODO test
 */
public class SortConfig implements Config {
    private String input;
    private String output;
    private String partition;
    private String meta;

    public String[] toArray() {
        String[] args = {input, output, partition, meta};
        return args;
    }

    public void fromArray(String[] args) {
        setInput(args[0]);
        setOutput(args[1]);
        setPartition(args[2]);
        setMeta(args[3]);
    }

    public void fromBasePath(String base) {
        setInput(base + "/pre-sort/out");
        setOutput(base + "/sort/out");
        setPartition(base + "part.lst");
        setMeta(base + "/sort/meta");
    }

    public String getInput() {
        return input;
    }

    public void setInput(String input) {
        this.input = input;
    }

    public String getOutput() {
        return output;
    }

    public void setOutput(String output) {
        this.output = output;
    }

    public String getPartition() {
        return partition;
    }

    public void setPartition(String partition) {
        this.partition = partition;
    }

    public String getMeta() {
        return meta;
    }

    public void setMeta(String meta) {
        this.meta = meta;
    }

}

package io.dongyue.at15.tree.indexer.mapreduce.sort;

import io.dongyue.at15.tree.indexer.mapreduce.Config;

/**
 * Created by at15 on 16-1-1.
 *
 * @TODO test
 */
public class SortConfig implements Config {
    private String input;
    private String output;
    private String partition;
    private String meta;

    public String[] toArray() {
        String[] args = {input, output, partition, meta};
        return args;
    }

    public void fromArray(String[] args) {
        setInput(args[0]);
        setOutput(args[1]);
        setPartition(args[2]);
        setMeta(args[3]);
    }

    public void fromBasePath(String base) {
        setInput(base + "/pre-sort/out");
        setOutput(base + "/sort/out");
        setPartition(base + "/part.lst");
        setMeta(base + "/sort/meta");
    }

    public String getInput() {
        return input;
    }

    public void setInput(String input) {
        this.input = input;
    }

    public String getOutput() {
        return output;
    }

    public void setOutput(String output) {
        this.output = output;
    }

    public String getPartition() {
        return partition;
    }

    public void setPartition(String partition) {
        this.partition = partition;
    }

    public String getMeta() {
        return meta;
    }

    public void setMeta(String meta) {
        this.meta = meta;
    }

}

Fix the path for sort partition list file


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

import io.github.robwin.markup.builder.asciidoc.AsciiDocBuilder;
import io.github.robwin.markup.builder.markdown.MarkdownBuilder;

/**
 * @author Robert Winkler
 */
public final class MarkupDocBuilders {

    private MarkupDocBuilders(){}

    public static MarkupDocBuilder documentBuilder(MarkupLanguage markupLanguage){
        switch(markupLanguage){
            case MARKDOWN: return new MarkdownBuilder();
            case ASCIIDOC: return new AsciiDocBuilder();
            default: return new AsciiDocBuilder();
        }
    }

}

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

import io.github.robwin.markup.builder.asciidoc.AsciiDocBuilder;
import io.github.robwin.markup.builder.markdown.MarkdownBuilder;

/**
 * @author Robert Winkler
 */
public final class MarkupDocBuilders {

    private MarkupDocBuilders(){}

    public static MarkupDocBuilder documentBuilder(MarkupLanguage markupLanguage){
        switch(markupLanguage){
            case MARKDOWN: return new MarkdownBuilder();
            case ASCIIDOC: return new AsciiDocBuilder();
            default: return new AsciiDocBuilder();
        }
    }

    /**
     * Instantiate a new builder copying {@code docBuilder} characteristics.
     * You can use it to build intermediate MarkupDocBuilder for composition purpose.
     */
    public static MarkupDocBuilder documentBuilder(MarkupDocBuilder docBuilder){
        if (docBuilder instanceof MarkdownBuilder)
            return new MarkdownBuilder();
        else if (docBuilder instanceof AsciiDocBuilder)
            return new AsciiDocBuilder();
        else
            return new AsciiDocBuilder();
    }

}

Create a builder instance from another builder instance, for easier composition


package edu.kit.ipd.sdq.vitruvius.framework.contracts.interfaces;

import edu.kit.ipd.sdq.vitruvius.framework.contracts.datatypes.Blackboard;

public interface ChangePreparing {
    void prepareAllChanges(Blackboard blackboard);
}

package edu.kit.ipd.sdq.vitruvius.framework.contracts.interfaces;

import edu.kit.ipd.sdq.vitruvius.framework.contracts.datatypes.ProcessableChange;
import edu.kit.ipd.sdq.vitruvius.framework.contracts.datatypes.RecordedChange;

public interface ChangePreparing {
    ProcessableChange prepareAllChanges(RecordedChange unpreparedChange);
}

Restructure change preparer to prepare recorded changes and return processable changes.


/**
 * Copyright 2017 Pivotal Software, Inc.
 *

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *

 * http://www.apache.org/licenses/LICENSE-2.0
 *

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.micrometer.appoptics;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.MockClock;
import io.micrometer.core.tck.MeterRegistryCompatibilityKit;

import java.time.Duration;

class AppOpticsMeterRegistryCompatibilityTest extends MeterRegistryCompatibilityKit {
    private final AppOpticsConfig config = new AppOpticsConfig() {
        @Override
        public String get(String key) {
            return null;
        }

        @Override
        public boolean enabled() {
            return false;
        }
    };

    @Override
    public MeterRegistry registry() {
        return new AppOpticsMeterRegistry(config, new MockClock());
    }

    @Override
    public Duration step() {
        return config.step();
    }
}

/**
 * Copyright 2017 Pivotal Software, Inc.
 *

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *

 * http://www.apache.org/licenses/LICENSE-2.0
 *

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.micrometer.appoptics;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.MockClock;
import io.micrometer.core.tck.MeterRegistryCompatibilityKit;

import java.time.Duration;

class AppOpticsMeterRegistryCompatibilityTest extends MeterRegistryCompatibilityKit {
    private final AppOpticsConfig config = new AppOpticsConfig() {
        @Override
        public String get(String key) {
            return null;
        }

        @Override
        public boolean enabled() {
            return false;
        }

        @Override
        public String apiToken() {
            return "fake";
        }
    };

    @Override
    public MeterRegistry registry() {
        return new AppOpticsMeterRegistry(config, new MockClock());
    }

    @Override
    public Duration step() {
        return config.step();
    }
}

Use fake apiToken in AppOptics compatibility kit tests


package com.gurkensalat.android.xingsync.api;

import org.json.JSONArray;
import org.json.JSONException;

import android.util.Log;

import com.googlecode.androidannotations.annotations.EBean;

@EBean
public class MeCall // implements XingApiCall
{
	private static final String TAG = "xingsync.MeCall";

	public JSONArray perform(final String... args)
	{
		// Hardcoded Mock for now

		StringBuffer sb = new StringBuffer(1024);

		sb.append("{");
		sb.append("  \"users\": [");
		sb.append("    {");
		sb.append("      \"id\": \"3382304_64b174\",");
		sb.append("      \"first_name\": \"Hakan\",");
		sb.append("      \"last_name\": \"Tandogan\",");
		sb.append("      \"display_name\": \"Hakan Tandogan\"");
		sb.append("    }");
		sb.append("  ]");
		sb.append("}");

		Log.i(TAG, sb.toString());

		JSONArray jsonArray = new JSONArray();
		try
		{
			jsonArray = new JSONArray(sb.toString());
			Log.i(TAG, jsonArray.toString());
		}
		catch (JSONException e)
		{
			Log.e(TAG, "while parsing answer string", e);
		}

		return jsonArray;
	}
}

package com.gurkensalat.android.xingsync.api;

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

import android.util.Log;

import com.googlecode.androidannotations.annotations.EBean;

@EBean
public class MeCall // implements XingApiCall
{
	private static final String TAG = "xingsync.MeCall";

	public JSONObject perform(final String... args)
	{
		// Hardcoded Mock for now

		StringBuffer sb = new StringBuffer(1024);

		sb.append("{");
		sb.append("  \"users\": [");
		sb.append("    {");
		sb.append("      \"id\": \"3382304_64b174\",");
		sb.append("      \"first_name\": \"Hakan\",");
		sb.append("      \"last_name\": \"Tandogan\",");
		sb.append("      \"display_name\": \"Hakan Tandogan\"");
		sb.append("    }");
		sb.append("  ]");
		sb.append("}");

		Log.i(TAG, sb.toString());

		JSONObject json = new JSONObject();
		try
		{
			json = new JSONObject(sb.toString());
			Log.i(TAG, json.toString());
		}
		catch (JSONException e)
		{
			Log.e(TAG, "while parsing answer string", e);
		}

		return json;
	}
}

Make the contract a JSONObject


package com.seatgeek.sixpack.android;

import com.seatgeek.sixpack.Alternative;
import com.seatgeek.sixpack.Experiment;
import com.seatgeek.sixpack.Sixpack;
import com.seatgeek.sixpack.SixpackBuilder;
import com.seatgeek.sixpack.log.LogLevel;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;

@Module(
        injects = {
                SixpackActivity.class
        }
)
public class SixpackModule {
    public static final String BUTTON_COLOR = "button-color";
    public static final String BUTTON_COLOR_RED = "red";
    public static final String BUTTON_COLOR_BLUE = "blue";

    @Singleton @Provides Sixpack provideSixpack() {
        Sixpack sixpack = new SixpackBuilder()
                .setClientId(Sixpack.generateRandomClientId())
                .setSixpackUrl("http://10.0.3.2:5000/") // genymotion host
                .build();

        sixpack.setLogLevel(LogLevel.VERBOSE);

        return sixpack;
    }

    @Singleton @Provides @Named(BUTTON_COLOR) Experiment provideButtonColorExperiment(Sixpack sixpack) {
        return sixpack.experiment()
                .withName(BUTTON_COLOR)
                .withAlternatives(
                        new Alternative(BUTTON_COLOR_RED),
                        new Alternative(BUTTON_COLOR_BLUE)
                )
                .build();
    }
}

package com.seatgeek.sixpack.android;

import com.seatgeek.sixpack.Alternative;
import com.seatgeek.sixpack.Experiment;
import com.seatgeek.sixpack.Sixpack;
import com.seatgeek.sixpack.SixpackBuilder;
import com.seatgeek.sixpack.log.LogLevel;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import okhttp3.HttpUrl;

@Module(
        injects = {
                SixpackActivity.class
        }
)
public class SixpackModule {
    public static final String BUTTON_COLOR = "button-color";
    public static final String BUTTON_COLOR_RED = "red";
    public static final String BUTTON_COLOR_BLUE = "blue";

    @Singleton @Provides Sixpack provideSixpack() {
        Sixpack sixpack = new SixpackBuilder()
                .setClientId(Sixpack.generateRandomClientId())
                .setSixpackUrl(HttpUrl.parse("http://10.0.3.2:5000/")) // genymotion host
                .build();

        sixpack.setLogLevel(LogLevel.VERBOSE);

        return sixpack;
    }

    @Singleton @Provides @Named(BUTTON_COLOR) Experiment provideButtonColorExperiment(Sixpack sixpack) {
        return sixpack.experiment()
                .withName(BUTTON_COLOR)
                .withAlternatives(
                        new Alternative(BUTTON_COLOR_RED),
                        new Alternative(BUTTON_COLOR_BLUE)
                )
                .build();
    }
}

Fix compile error in android example app.


/**
 * Copyright (C) 2010 openecho
 *
 * 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 kinetic.math.statistic;

import java.lang.reflect.Array;

/**
 * Standard Deviation Utility
 *
 * @author openecho
 * @version 1.0.1
 */
public class StandardDeviation {
    public static Double evaluate(Double[] data) {
        if(data==null) {
            throw new NullPointerException();
        }
        int length = Array.getLength(data);
        if(length < 2) {
            throw new RuntimeException("More than two values are required to calculate a standard deviation");
        }
        double mean = Mean.evaluate(data);
        double sumDifferenceSquared = 0;
        for(int i=0;i<length;i++) {
            sumDifferenceSquared += Math.pow(data[i]-mean,2);
        }
        return Math.sqrt(sumDifferenceSquared/(length-1));
    }
}

/**
 * Copyright (C) 2010 openecho
 *
 * 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 kinetic.math.statistic;

import java.lang.reflect.Array;

/**
 * Standard Deviation Utility
 *
 * @author openecho
 * @version 1.0.1
 */
public class StandardDeviation {

    public static Double evaluate(Double[] data) {
        return StandardDeviation.evaluate(data, true);
    }

    public static Double evaluate(Double[] data, boolean partialPopulation) {
        if(data==null) {
            throw new NullPointerException();
        }
        int length = Array.getLength(data);
        if(length < 2) {
            throw new RuntimeException("More than two values are required to calculate a standard deviation");
        }
        double mean = Mean.evaluate(data);
        double sumDifferenceSquared = 0;
        for(int i=0;i<length;i++) {
            sumDifferenceSquared += Math.pow(data[i]-mean,2);
        }
        return Math.sqrt(sumDifferenceSquared/((partialPopulation) ? (length-1) : (length)));
    }
}

Add population based divide option


package org.concord.framework.otrunk.view;

import java.util.Vector;

import org.concord.framework.otrunk.OTChangeListener;
import org.concord.framework.otrunk.OTObject;
import org.concord.framework.otrunk.OTObjectService;

public interface OTLabbookManager
{
	public void add(OTObject otObject);

	public void add(OTObject otObject, OTObject container);

	public void addSnapshot(OTObject snapshot);

	public void addDataCollector(OTObject dataCollector);

	public void addDrawingTool(OTObject drawingTool);

	public void addText(OTObject text);

	public void remove(OTObject labbookEntry);

	public Vector getSnapshots();

	public Vector getGraphs();

	public Vector getDrawings();

	public Vector getText();

	public Vector getAllEntries();

	public boolean isEmpty();

	public void addLabbookListener(OTChangeListener listener);

	public void removeLabbookListener(OTChangeListener listener);

//	public void setOTObjectService(OTObjectService objectService);

}

package org.concord.framework.otrunk.view;

import java.util.Vector;

import org.concord.framework.otrunk.OTChangeListener;
import org.concord.framework.otrunk.OTObject;
import org.concord.framework.otrunk.OTObjectService;

public interface OTLabbookManager
{
	/*
	 * This object will be added directly to an entry, so the original should be cloned, preferably
	 * using the copy method in the OTLabbookViewProvider for the object
	 */
	public void add(OTObject otObject);

	/*
	 * If a refence to the original object is included, it will be easier to tie the entry back
	 * to its origins.
	 */
	public void add(OTObject otObject, OTObject originalObject);

	/*
	 * A container, such as the section the object was in, should be included to allow the lab
	 * book to sort based on contaner.
	 */
	public void add(OTObject otObject, OTObject originalObject, OTObject container);

	public void addSnapshot(OTObject snapshot);

	public void addDataCollector(OTObject dataCollector);

	public void addDrawingTool(OTObject drawingTool);

	public void addText(OTObject text);

	public void remove(OTObject labbookEntry);

	public Vector getSnapshots();

	public Vector getGraphs();

	public Vector getDrawings();

	public Vector getText();

	public Vector getAllEntries();

	public boolean isEmpty();

	public void addLabbookListener(OTChangeListener listener);

	public void removeLabbookListener(OTChangeListener listener);

}

Update methods on interface to allow adding reference objects