/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package itest.io.joynr.jeeintegration.preprocessor;

import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.joynr.messaging.RawMessagingPreprocessor;

public class TestRawMessagingProcessor extends RawMessagingPreprocessor {
    private static final Logger logger = LoggerFactory.getLogger(RawMessagingPreprocessor.class);

    @Override
    public byte[] process(byte[] rawMessage, Map<String, Serializable> context) {
        logger.info("raw message received: " + new String(rawMessage, StandardCharsets.UTF_8));
        return rawMessage;
    }
}

/*
 * #%L
 * %%
 * Copyright (C) 2011 - 2017 BMW Car IT GmbH
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */
package itest.io.joynr.jeeintegration.preprocessor;

import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.joynr.messaging.RawMessagingPreprocessor;

public class TestRawMessagingProcessor extends RawMessagingPreprocessor {
    private static final Logger logger = LoggerFactory.getLogger(TestRawMessagingProcessor.class);

    @Override
    public byte[] process(byte[] rawMessage, Map<String, Serializable> context) {
        logger.info("raw message received: " + new String(rawMessage, StandardCharsets.UTF_8));
        return rawMessage;
    }
}

Fix class used for logging

[Java] Fix class used for logging

Change-Id: Ic689a8b5e9ed090330737386ed814fb020afc6ea


package no.deichman.services.service;

import java.io.UnsupportedEncodingException;

import com.hp.hpl.jena.rdf.model.Model;

import no.deichman.services.error.PatchException;
import no.deichman.services.error.PatchParserException;
import no.deichman.services.repository.Repository;

public interface Service {

    void setRepository(Repository repository);
    void updateWork(String work);
    Model retrieveWorkById(String id);
    Model retrieveWorkItemsById(String id);
    String createWork(String work);
    String createPublication(String publication);
    void deleteWork(Model work);
    void deletePublication(Model publication);
    Model patchWork(String work, String requestBody) throws UnsupportedEncodingException, PatchException, PatchParserException;
    Model retrievePublicationById(String publicationId);
    Model patchPublication(String publicationId, String requestBody) throws PatchParserException;
    boolean resourceExists(String resourceUri);
}

package no.deichman.services.service;

import com.hp.hpl.jena.rdf.model.Model;
import no.deichman.services.error.PatchParserException;
import no.deichman.services.repository.Repository;

public interface Service {

    void setRepository(Repository repository);
    void updateWork(String work);
    Model retrieveWorkById(String id);
    Model retrieveWorkItemsById(String id);
    String createWork(String work);
    String createPublication(String publication);
    void deleteWork(Model work);
    void deletePublication(Model publication);
    Model patchWork(String work, String requestBody) throws PatchParserException;
    Model retrievePublicationById(String publicationId);
    Model patchPublication(String publicationId, String requestBody) throws PatchParserException;
    boolean resourceExists(String resourceUri);
}

Remove unused exceptions from signature.


package org.deviceconnect.android.deviceplugin.theta.core;

/**
 * THETA Device Manager.
 */
public class ThetaDeviceManager {

    /**
     * Get a THETA device which is connected currently to the host device via WiFi.
     *
     * @return an instance of {@link ThetaDevice}
     */
    public ThetaDevice getConnectedDevice() {
        // TODO Implement.
        return null;
    }

    /**
     * Register {@link ThetaDeviceEventListener}.
     * @param listener an instance of {@link ThetaDeviceEventListener}
     */
    public void registerDeviceEventListener(final ThetaDeviceEventListener listener) {
        // TODO Implement.
    }

    /**
     * Unregister {@link ThetaDeviceEventListener}.
     * @param listener an instance of {@link ThetaDeviceEventListener}
     */
    public void unregisterDeviceEventListener(final ThetaDeviceEventListener listener) {
        // TODO Implement.
    }

}

package org.deviceconnect.android.deviceplugin.theta.core;

/**
 * THETA Device Manager.
 *
 *
Overview

 *

 * THETA Device Manager manages a THETA devices which is connected to the Android host device.
 *

 *
 *
Usage

 *
 *     // Obtain the Theta Device Manager.
 *     ThetaDeviceApplication app = (ThetaDeviceApplication) getApplication();
 *     ThetaDeviceManager deviceMgr = app.getDeviceManager();
 *
 *     ThetaDevice device = deviceMgr.getConnectedDevice();
 *     if (device != null) {
 *       // Codes for case that a THETA device is connected.
 *     } else {
 *       // Codes for case that a THETA device is not connected.
 *     }
 *
 */
public class ThetaDeviceManager {

    /**
     * Get a THETA device which is connected currently to the host device via WiFi.
     *
     * @return an instance of {@link ThetaDevice}
     */
    public ThetaDevice getConnectedDevice() {
        // TODO Implement.
        return null;
    }

    /**
     * Register {@link ThetaDeviceEventListener}.
     * @param listener an instance of {@link ThetaDeviceEventListener}
     */
    public void registerDeviceEventListener(final ThetaDeviceEventListener listener) {
        // TODO Implement.
    }

    /**
     * Unregister {@link ThetaDeviceEventListener}.
     * @param listener an instance of {@link ThetaDeviceEventListener}
     */
    public void unregisterDeviceEventListener(final ThetaDeviceEventListener listener) {
        // TODO Implement.
    }

}

Add JavaDoc of THETA Device Manager.

Add JavaDoc of THETA Device Manager.


/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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.gravitee.repository.api;

import io.gravitee.repository.model.Member;
import io.gravitee.repository.model.TeamRole;

import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface TeamMembershipRepository {

    void addMember(String teamName, String username, TeamRole role);

    void updateMember(String teamName, String username, TeamRole role);

    void deleteMember(String teamName, String username);

    Set<Member> listMembers(String teamName);
}

/**
 * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
 *
 * 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.gravitee.repository.api;

import io.gravitee.repository.model.Member;
import io.gravitee.repository.model.Team;
import io.gravitee.repository.model.TeamRole;

import java.util.Set;

/**
 * @author David BRASSELY (brasseld at gmail.com)
 */
public interface TeamMembershipRepository {

    void addMember(String teamName, String username, TeamRole role);

    void updateMember(String teamName, String username, TeamRole role);

    void deleteMember(String teamName, String username);

    Set<Member> listMembers(String teamName);

    /**
     * List {@link Team} where the user is a member.
     *
     * @param username The name used to identify a user.
     * @return List of {@link Team}
     */
    Set<Team> findByUser(String username);
}

refactor: Add service to retrieve list of team for a user


package org.jbake.render.support;

import org.apache.commons.configuration.CompositeConfiguration;

public class MockCompositeConfiguration extends CompositeConfiguration {

    private boolean _bool = false;
    private String _string = "random string";

    public MockCompositeConfiguration withDefaultBoolean(boolean bool) {
        _bool = bool;
        return this;
    }

    public MockCompositeConfiguration withInnerString(String string) {
        _string = string;
        return this;
    }

    @Override
    public boolean getBoolean(String key) {

        if ( super.containsKey(key) ) {
            return super.getBoolean(key);
        }
        return _bool;
    }

    @Override
    public String getString(String string) {
        return _string;
    }
}

package org.jbake.render.support;

import org.apache.commons.configuration.CompositeConfiguration;

public class MockCompositeConfiguration extends CompositeConfiguration {

    private boolean _bool = false;
    private String _string = "random string";

    public MockCompositeConfiguration withDefaultBoolean(boolean bool) {
        _bool = bool;
        return this;
    }

    public MockCompositeConfiguration withInnerString(String string) {
        _string = string;
        return this;
    }

    @Override
    public boolean getBoolean(String key) {

        if ( super.containsKey(key) ) {
            return super.getBoolean(key);
        }
        return _bool;
    }

    @Override
    public String getString(String key) {
    	 if ( super.containsKey(key) ) {
             return super.getString(key);
         }
        return _string;
    }
}

Allow to pull value from parent configuration, if set.


package com.github.pedrovgs.app.problem3;

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

import static org.junit.Assert.assertEquals;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class SumBinaryNumberTest {

  private SumBinaryNumbers sumBinaryNumbers;

  @Before public void setUp() {
    this.sumBinaryNumbers = new SumBinaryNumbers();
  }

  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullInputs() {
    sumBinaryNumbers.sumBinaryNumbersCheating(null, null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptMalformedBinaryNumbers() {
    String n1 = "10";
    String n2 = "2";

    sumBinaryNumbers.sumBinaryNumbersCheating(null, null);
  }

  @Test public void zeroPlusZeroEqualsZero() {
    String n1 = "0";
    String n2 = "0";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals(0, result);
  }

  @Test public void zeroPlusTwoEqualsTwo() {
    String n1 = "0";
    String n2 = "10";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals("10", result);
  }

  @Test public void fivePlusSevenEqualsTwelve() {
    String n1 = "101";
    String n2 = "111";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals("1100", result);
  }
}

package com.github.pedrovgs.app.problem3;

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

import static org.junit.Assert.assertEquals;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class SumBinaryNumberTest {

  private SumBinaryNumbers sumBinaryNumbers;

  @Before public void setUp() {
    this.sumBinaryNumbers = new SumBinaryNumbers();
  }

  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullInputs() {
    sumBinaryNumbers.sumBinaryNumbersCheating(null, null);
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptMalformedBinaryNumbers() {
    String n1 = "10";
    String n2 = "2";

    sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);
  }

  @Test public void zeroPlusZeroEqualsZero() {
    String n1 = "0";
    String n2 = "0";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals(0, result);
  }

  @Test public void zeroPlusTwoEqualsTwo() {
    String n1 = "0";
    String n2 = "10";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals("10", result);
  }

  @Test public void fivePlusSevenEqualsTwelve() {
    String n1 = "101";
    String n2 = "111";

    String result = sumBinaryNumbers.sumBinaryNumbersCheating(n1, n2);

    assertEquals("1100", result);
  }
}

Fix test for malformed binary numbers

Fix test for malformed binary numbers


package arez.doc.examples.tracker;

import arez.Arez;
import arez.Observer;
import arez.Procedure;

public class TrackerExample
{
  public static void main( String[] args )
    throws Throwable
  {
    final Procedure trackedFunction = () -> {
      // Interact with arez observable state (or computed values) here
      // and any time these changed the rescheduleRender function will
      // be run which will somehow reschedule this function.
      //DOC ELIDE START
      //DOC ELIDE END
    };
    final Observer tracker = Arez.context().tracker( () -> rescheduleRender() );
    //DOC ELIDE START
    //DOC ELIDE END
    // The rescheduleRender should ultimately result in the following
    // invocation. This call will need to be run at least once so that
    // the Arez runtime can determine the dependencies and reschedule
    // when the dependencies are changed.
    Arez.context().track( tracker, trackedFunction );
  }

  static void rescheduleRender()
  {

  }
}

package arez.doc.examples.tracker;

import arez.Arez;
import arez.Observer;
import arez.Procedure;

public class TrackerExample
{
  public static void main( String[] args )
    throws Throwable
  {
    final Procedure observedFunction = () -> {
      // Interact with arez observable state (or computed values) here
      // and any time these changed the rescheduleRender function will
      // be run which will somehow reschedule this function.
      //DOC ELIDE START
      //DOC ELIDE END
    };
    final Observer tracker = Arez.context().tracker( () -> rescheduleRender() );
    //DOC ELIDE START
    //DOC ELIDE END
    // The rescheduleRender should ultimately result in the following
    // invocation. This call will need to be run at least once so that
    // the Arez runtime can determine the dependencies and reschedule
    // when the dependencies are changed.
    Arez.context().track( tracker, observedFunction );
  }

  static void rescheduleRender()
  {
  }
}

Rename variable to reflect current terminology


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

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.

git-svn-id: fe6d842192ccfb78748eb71580d1ce65f168b559@1301 9830eeb5-ddf4-0310-9ef7-f4b9a3e3227e


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

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

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

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

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"

This reverts commit 701cd1fbb6109ffc09aa77e694ffce9768e57752.


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

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

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

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

Split into declaration and assignment

#13763:As a developer, I will have implemented the Try My Policy UI and integrated with backend [v3.0]


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

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

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

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

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

Use Jython dont import site flag

The purpose of this change is to improve startup performance of the cslang CLI
According to jython java docs when this property is set to false site.py will not be imported
AFAIK this site packages doesn't exist unless you install jython (and not embedding)

Signed-off-by: Eliya Sadan <ee72bd64a89bf65c610af864999dbed3edbad28e@gmail.com>


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.

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""

This reverts commit 0d441ece80c6e8dbb7b9045a9e2a48d2af0ea992.


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.

This now just uses toString() to return the whole timestamp. We may need to change this at a later date once we have decided whether or not the last-updated time will be an object with or without a timezone.


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

Use 3 rows by default in test

svn changeset:16411/svn branch:6.5


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

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"

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.

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

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

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

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