package com.gentics.mesh.test.docker;

import java.nio.charset.Charset;
import java.time.Duration;
import java.util.Collections;

import org.apache.commons.io.IOUtils;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.Wait;
import org.testcontainers.images.builder.ImageFromDockerfile;

/**
 * Testcontainer for a non-clustered Elasticsearch instance.
 */
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {

	public static final String VERSION = "6.3.1";

	public ElasticsearchContainer(boolean withIngestPlugin) {
		super(prepareDockerImage(withIngestPlugin));
	}

	private static ImageFromDockerfile prepareDockerImage(boolean withIngestPlugin) {
		try {
			ImageFromDockerfile dockerImage = new ImageFromDockerfile("elasticsearch", false);
			String dockerFile = IOUtils.toString(ElasticsearchContainer.class.getResourceAsStream("/elasticsearch/Dockerfile.ingest"),
				Charset.defaultCharset());
			dockerFile = dockerFile.replace("%VERSION%", VERSION);
			if (!withIngestPlugin) {
				dockerFile = dockerFile.replace("RUN", "#RUN");
			}
			dockerImage.withFileFromString("Dockerfile", dockerFile);
			return dockerImage;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	@Override
	protected void configure() {
		addEnv("discovery.type", "single-node");
		withTmpFs(Collections.singletonMap("/usr/share/elasticsearch/data", "rw,size=64m"));
		// addEnv("xpack.security.enabled", "false");
		withExposedPorts(9200);
		withStartupTimeout(Duration.ofSeconds(250L));
		waitingFor(Wait.forHttp("/"));
	}

}

package com.gentics.mesh.test.docker;

import java.time.Duration;
import java.util.Collections;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;

/**
 * Testcontainer for a non-clustered Elasticsearch instance.
 */
public class ElasticsearchContainer extends GenericContainer<ElasticsearchContainer> {

	public static final String VERSION = "6.6.1";

	public ElasticsearchContainer(boolean withIngestPlugin) {
		super(withIngestPlugin ? "jotschi/elasticsearch-ingest:" + VERSION : "docker.elastic.co/elasticsearch/elasticsearch-oss:" + VERSION);
	}

	@Override
	protected void configure() {
		addEnv("discovery.type", "single-node");
		withTmpFs(Collections.singletonMap("/usr/share/elasticsearch/data", "rw,size=64m"));
		// addEnv("xpack.security.enabled", "false");
		withExposedPorts(9200);
		withStartupTimeout(Duration.ofSeconds(250L));
		waitingFor(new HttpWaitStrategy().forPath("/"));
	}

}

Use pre-build docker image for ES and bump ES version to 6.6.1


#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import edu.pdx.cs410J.web.HttpRequestHelper;

import java.io.IOException;

/**
 * A helper class for accessing the rest client
 */
public class AirlineRestClient extends HttpRequestHelper
{
    private static final String WEB_APP = "${artifactId}";
    private static final String SERVLET = "flights";

    private final String url;

    /**
     * Creates a client to the airline REST service running on the given host and port
     * @param hostName The name of the host
     * @param port The port
     */
    public AirlineRestClient( String hostName, int port )
    {
        this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET );
    }

    /**
     * Returns all keys and values from the server
     */
    public Response getAllKeysAndValues() throws IOException
    {
        return get(this.url );
    }

    /**
     * Returns all values for the given key
     */
    public Response getValues( String key ) throws IOException
    {
        return get(this.url, "key", key);
    }

    public Response addKeyValuePair( String key, String value ) throws IOException
    {
        return post( this.url, "key", key, "value", value );
    }
}

#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import edu.pdx.cs410J.web.HttpRequestHelper;

import java.io.IOException;

/**
 * A helper class for accessing the rest client.  Note that this class provides
 * an example of how to make gets and posts to a URL.  You'll need to change it
 * to do something other than just send key/value pairs.
 */
public class AirlineRestClient extends HttpRequestHelper
{
    private static final String WEB_APP = "${artifactId}";
    private static final String SERVLET = "flights";

    private final String url;

    /**
     * Creates a client to the airline REST service running on the given host and port
     * @param hostName The name of the host
     * @param port The port
     */
    public AirlineRestClient( String hostName, int port )
    {
        this.url = String.format( "http://%s:%d/%s/%s", hostName, port, WEB_APP, SERVLET );
    }

    /**
     * Returns all keys and values from the server
     */
    public Response getAllKeysAndValues() throws IOException
    {
        return get(this.url );
    }

    /**
     * Returns all values for the given key
     */
    public Response getValues( String key ) throws IOException
    {
        return get(this.url, "key", key);
    }

    public Response addKeyValuePair( String key, String value ) throws IOException
    {
        return post( this.url, "key", key, "value", value );
    }
}

Add a comment instructing the student to make changes to this code.


package devopsdistilled.operp.client.abstracts;

import devopsdistilled.operp.client.items.exceptions.EntityNameExistsException;
import devopsdistilled.operp.client.items.exceptions.NullFieldException;
import devopsdistilled.operp.server.data.entity.Entiti;

public interface CreateEntityPaneController<E extends Entiti<?>> extends
		SubTaskPaneController {

	public void validate(E entity) throws NullFieldException,
			EntityNameExistsException;

	public E save(E entity);

}

package devopsdistilled.operp.client.abstracts;

import devopsdistilled.operp.server.data.entity.Entiti;

public interface CreateEntityPaneController<E extends Entiti<?>> extends
		SubTaskPaneController {

	public void validate(E entity) throws Exception;

	public E save(E entity);

}

Change validate() signature (i.e throws Exception)


package com.indeed.flamdex.simple;

/**
 * @author vladimir
 */

public class StringToIntTermIterator implements SimpleIntTermIterator  {
    private final SimpleStringTermIterator stringTermIterator;

    public StringToIntTermIterator(SimpleStringTermIterator stringTermIterator) {
        this.stringTermIterator = stringTermIterator;
    }

    @Override
    public void reset(long term) {
        stringTermIterator.reset(String.valueOf(term));
    }

    @Override
    public long term() {
        try {
            return Long.valueOf(stringTermIterator.term());
        } catch(NumberFormatException ignored) {
            return 0;
        }
    }

    @Override
    public String getFilename() {
        return stringTermIterator.getFilename();
    }

    @Override
    public long getOffset() {
        return stringTermIterator.getOffset();
    }

    @Override
    public boolean next() {
        return stringTermIterator.next();
    }

    @Override
    public int docFreq() {
        return stringTermIterator.docFreq();
    }

    @Override
    public void close() {
        stringTermIterator.close();
    }
}

package com.indeed.flamdex.simple;

/**
 * @author vladimir
 */

public class StringToIntTermIterator implements SimpleIntTermIterator  {
    private final SimpleStringTermIterator stringTermIterator;

    public StringToIntTermIterator(SimpleStringTermIterator stringTermIterator) {
        this.stringTermIterator = stringTermIterator;
    }

    @Override
    public void reset(long term) {
        stringTermIterator.reset(String.valueOf(term));
    }

    @Override
    public long term() {
        try {
            return Long.parseLong(stringTermIterator.term());
        } catch(NumberFormatException ignored) {
            return 0;
        }
    }

    @Override
    public String getFilename() {
        return stringTermIterator.getFilename();
    }

    @Override
    public long getOffset() {
        return stringTermIterator.getOffset();
    }

    @Override
    public boolean next() {
        return stringTermIterator.next();
    }

    @Override
    public int docFreq() {
        return stringTermIterator.docFreq();
    }

    @Override
    public void close() {
        stringTermIterator.close();
    }
}

Use Long.parseLong() instead of Long.valueOf()


package org.theultimatedeployer.enforcer.editorconfig.check;

/**
 * Created by chris on 20.09.16.
 */
public class EOLCheckConfig implements CheckConfig{

  public static final int SYSTEM = 0;

  public static final int UNIX = 1;

  public static final int WINDOWS = 2;

  // MAC OS X now uses UNIX -> old apple ;-)
  public static final int OLD_APPLE = 3;

  int plattform;

  public EOLCheckConfig(final String configVal) {
    if ("system".equalsIgnoreCase(configVal)) {
      plattform = SYSTEM;
    } else if ("LF".equalsIgnoreCase(configVal)) {
      plattform = UNIX;
    } else if ("CRLF".equalsIgnoreCase(configVal)){
      plattform = WINDOWS;
    }
  }

  public boolean isWindows() {
    return plattform == WINDOWS;
  }

  public boolean isUnix() {
    return plattform == UNIX;
  }

  public boolean isOldApple() {
    return plattform == OLD_APPLE;
  }

  public void setUnix() {
    plattform = UNIX;
  }

  public void setWindows() {
    plattform = WINDOWS;
  }

  public void setOldApple() {
    plattform = OLD_APPLE;
  }
}

package org.theultimatedeployer.enforcer.editorconfig.check;

/**
 * Created by chris on 20.09.16.
 */
public class EOLCheckConfig implements CheckConfig{

  public static final int SYSTEM = 0;

  public static final int UNIX = 1;

  public static final int WINDOWS = 2;

  // MAC OS X now uses UNIX -> old apple ;-)
  public static final int OLD_APPLE = 3;

  int plattform;

  public EOLCheckConfig(final String configVal) {
    if ("system".equalsIgnoreCase(configVal) || "os".equalsIgnoreCase(configVal)) {
      plattform = SYSTEM;
    } else if ("LF".equalsIgnoreCase(configVal)) {
      plattform = UNIX;
    } else if ("CRLF".equalsIgnoreCase(configVal)){
      plattform = WINDOWS;
    }
  }

  public boolean isWindows() {
    return plattform == WINDOWS;
  }

  public boolean isUnix() {
    return plattform == UNIX;
  }

  public boolean isOldApple() {
    return plattform == OLD_APPLE;
  }

  public void setUnix() {
    plattform = UNIX;
  }

  public void setWindows() {
    plattform = WINDOWS;
  }

  public void setOldApple() {
    plattform = OLD_APPLE;
  }
}

Use "os" as valid constant for SYSTEM EOL check


package io.quarkus.agroal.runtime;

import java.util.Map;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "datasource", phase = ConfigPhase.RUN_TIME)
public class AgroalRuntimeConfig {

    /**
     * The default datasource.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public DataSourceRuntimeConfig defaultDataSource;

    /**
     * Additional datasources.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public Map<String, DataSourceRuntimeConfig> namedDataSources;
}

package io.quarkus.agroal.runtime;

import java.util.Map;

import io.quarkus.runtime.annotations.ConfigDocMapKey;
import io.quarkus.runtime.annotations.ConfigDocSection;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "datasource", phase = ConfigPhase.RUN_TIME)
public class AgroalRuntimeConfig {

    /**
     * The default datasource.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    public DataSourceRuntimeConfig defaultDataSource;

    /**
     * Additional named datasources.
     */
    @ConfigItem(name = ConfigItem.PARENT)
    @ConfigDocMapKey("datasource-name")
    @ConfigDocSection
    public Map<String, DataSourceRuntimeConfig> namedDataSources;
}

Tweak Agroal configuration reference documentation


package net.happygiraffe.jslint;

/**
 * @author dom
 * @version $Id$
 */
public enum Option {
    ADSAFE   ("if use of some browser features should be restricted"),
    BITWISE  ("if bitwise operators should not be allowed"),
    BROWSER  ("if the standard browser globals should be predefined"),
    CAP      ("if upper case HTML should be allowed"),
    DEBUG    ("if debugger statements should be allowed"),
    EQEQEQ   ("if === should be required"),
    EVIL     ("if eval should be allowed"),
    FRAGMENT ("if HTML fragments should be allowed"),
    LAXBREAK ("if line breaks should not be checked"),
    NOMEN    ("if names should be checked"),
    PASSFAIL ("if the scan should stop on first error"),
    PLUSPLUS ("if increment/decrement should not be allowed"),
    RHINO    ("if the Rhino environment globals should be predefined"),
    UNDEF    ("if undefined variables are errors"),
    WHITE    ("if strict whitespace rules apply"),
    WIDGET   ("if the Yahoo Widgets globals should be predefined");

    private String description;

    Option(String description) {
        this.description = description;
    }

    /**
     * Return a description of what this option affects.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Return the lowercase name of this option.
     */
    public String getLowerName() {
        return name().toLowerCase();
    }

    /**
     * Provide a JavaScript form of this option.
     */
    @Override
    public String toString() {
        return getLowerName() + ":true";
    }
}

package net.happygiraffe.jslint;

/**
 * @author dom
 * @version $Id$
 */
public enum Option {
    ADSAFE   ("if use of some browser features should be restricted"),
    BITWISE  ("if bitwise operators should not be allowed"),
    BROWSER  ("if the standard browser globals should be predefined"),
    CAP      ("if upper case HTML should be allowed"),
    DEBUG    ("if debugger statements should be allowed"),
    EQEQEQ   ("if === should be required"),
    EVIL     ("if eval should be allowed"),
    FRAGMENT ("if HTML fragments should be allowed"),
    LAXBREAK ("if line breaks should not be checked"),
    NOMEN    ("if names should be checked"),
    PASSFAIL ("if the scan should stop on first error"),
    PLUSPLUS ("if increment/decrement should not be allowed"),
    RHINO    ("if the Rhino environment globals should be predefined"),
    UNDEF    ("if undefined variables are errors"),
    WHITE    ("if strict whitespace rules apply"),
    WIDGET   ("if the Yahoo Widgets globals should be predefined");

    private String description;

    Option(String description) {
        this.description = description;
    }

    /**
     * Return a description of what this option affects.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Return the lowercase name of this option.
     */
    public String getLowerName() {
        return name().toLowerCase();
    }

    /**
     * Provide a JavaScript form of this option.
     */
    @Override
    public String toString() {
        return getLowerName() + "[" + getDescription() + "]";
    }
}

Make toString include the description, which may be helpful.


package com.biotronisis.pettplant.type;

/**
 * Created by john on 6/16/15.
 */
public enum EntrainmentMode {

   oldMEDITATE(0),
   oldSLEEP(1),
   oldSTAY_AWAKE(2);

   // Run/Stop button values
//   public static final String RUN = "Run";
//   public static final String STOP = "Stop";

   // Pause/Resume button values
//   public static final String PAUSE = "Pause";
//   public static final String RESUME = "Resume";

   // Loop checkbox values
//   public static final String LOOP_OFF = "Off";
//   public static final String LOOP_ON = "On";
//
//   public static final boolean LOOP_CHECKBOX_DEFAULT = false;

   private int id;

   EntrainmentMode(int id) {
      this.id = id;
   }

//   public int getValue() {
//      return id;
//   }
//
//   public int getId() {
//      return id;
//   }
//
//   public static EntrainmentMode getEntrainmentMode(int id) {
//      return EntrainmentMode.values()[id];
//   }
}

package com.biotronisis.pettplant.type;

//public enum EntrainmentMode {

//   oldMEDITATE(0),
//   oldSLEEP(1),
//   oldSTAY_AWAKE(2);

   // Run/Stop button values
//   public static final String RUN = "Run";
//   public static final String STOP = "Stop";

   // Pause/Resume button values
//   public static final String PAUSE = "Pause";
//   public static final String RESUME = "Resume";

   // Loop checkbox values
//   public static final String LOOP_OFF = "Off";
//   public static final String LOOP_ON = "On";
//
//   public static final boolean LOOP_CHECKBOX_DEFAULT = false;

//   private int id;

//   EntrainmentMode(int id) {
//      this.id = id;
//   }

//   public int getValue() {
//      return id;
//   }
//
//   public int getId() {
//      return id;
//   }
//
//   public static EntrainmentMode getEntrainmentMode(int id) {
//      return EntrainmentMode.values()[id];
//   }
//}

Delete auto generated comments. Comment out the entire file.


package com.box.androidsdk.content.models;

/**
 * A class representing list of BoxRecentItem's
 */
public class BoxIteratorRecentItems extends BoxIterator<BoxRecentItem> {
    private static final long serialVersionUID = -2642748896882484555L;

    private transient BoxJsonObjectCreator<BoxRecentItem> representationCreator;

    @Override
    protected BoxJsonObjectCreator<BoxRecentItem> getObjectCreator() {
        if (representationCreator != null){
            return representationCreator;
        }
        representationCreator = BoxJsonObject.getBoxJsonObjectCreator(BoxRecentItem.class);
        return representationCreator;
    }
}

package com.box.androidsdk.content.models;

import com.eclipsesource.json.JsonObject;

/**
 * A class representing list of BoxRecentItem's
 */
public class BoxIteratorRecentItems extends BoxIterator<BoxRecentItem> {
    private static final long serialVersionUID = -2642748896882484555L;

    private transient BoxJsonObjectCreator<BoxRecentItem> representationCreator;

    public BoxIteratorRecentItems() {
        super();
    }

    public BoxIteratorRecentItems(JsonObject jsonObject) {
        super(jsonObject);
    }

    @Override
    protected BoxJsonObjectCreator<BoxRecentItem> getObjectCreator() {
        if (representationCreator != null){
            return representationCreator;
        }
        representationCreator = BoxJsonObject.getBoxJsonObjectCreator(BoxRecentItem.class);
        return representationCreator;
    }
}

Store the GET response in levelDB and populate the UI


package com.github.onsdigital.babbage.template.handlebars;

import org.junit.Test;

/**
 * Created by bren on 11/08/15.
 */
//TODO:
public class HandlebarsRendererTest {

    @Test
    public void testRenderTemplate() throws Exception {
        new HandlebarsRenderer("","");
    }

    public void testRenderTemplate1() throws Exception {

    }

    public void testInitialize() {

    }
}

package com.github.onsdigital.babbage.template.handlebars;

import org.junit.Test;

/**
 * Created by bren on 11/08/15.
 */
//TODO:
public class HandlebarsRendererTest {

    @Test
    public void testRenderTemplate() throws Exception {
        new HandlebarsRenderer("","", true);
    }

    public void testRenderTemplate1() throws Exception {

    }

    public void testInitialize() {

    }
}

Tweak to fix compile error for now.


package org.nusco.narjillos.shared.utilities;

import java.text.DecimalFormat;

/**
 * Formats numbers for pretty printing.
 *
 * For example, 2000 becomes 2K, 1200000 becomes 1.2M, and so on.
 */
public class NumberFormat {

	private final static DecimalFormat THOUSANDS_FORMAT = new DecimalFormat("##.#K");
	private final static DecimalFormat MILLIONS_FORMAT = new DecimalFormat("#.##M");

	public static String format(long number) {
		if (number < 1_000)
			return String.valueOf(number);

		if (number < 999_999) {
			double thousands = (double) number / 1000;
			return THOUSANDS_FORMAT.format(thousands);
		}

		double millions = (double) number / 1_000_000;
		return MILLIONS_FORMAT.format(millions);
	}

	public static String format(double number) {
		// two decimals
		return Double.toString(((long) number * 100) / 100.0);
	}
}

package org.nusco.narjillos.shared.utilities;

import java.text.DecimalFormat;

/**
 * Formats numbers for pretty printing.
 *
 * For example, 2000 becomes 2K, 1200000 becomes 1.2M, and so on.
 */
public class NumberFormat {

	private final static DecimalFormat THOUSANDS_FORMAT = new DecimalFormat("##.#K");
	private final static DecimalFormat MILLIONS_FORMAT = new DecimalFormat("#.##M");

	public static String format(long number) {
		if (number < 1_000)
			return String.valueOf(number);

		if (number < 999_999) {
			double thousands = (double) number / 1000;
			return THOUSANDS_FORMAT.format(thousands);
		}

		double millions = (double) number / 1_000_000;
		return MILLIONS_FORMAT.format(millions);
	}

	public static String format(double number) {
		// two decimals
		return Double.toString(((long) (number * 100)) / 100.0);
	}
}

Fix formatting of doubles in reports


package de.retest.recheck.ignore;

import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.util.List;

import org.junit.jupiter.api.Test;

class SearchFilterFilesTest {

	@Test
	void getDefaultFilterFiles_should_get_all_filter_files_from_classpath() {
		final List<File> defaultFilterFiles = SearchFilterFiles.getDefaultFilterFiles();
		assertThat( defaultFilterFiles.stream().map( File::getName ) ).contains( "positioning.filter",
				"visibility.filter" );
	}
}

package de.retest.recheck.ignore;

import static de.retest.recheck.configuration.ProjectConfiguration.FILTER_FOLDER;
import static de.retest.recheck.configuration.ProjectConfiguration.RETEST_PROJECT_CONFIG_FOLDER;
import static de.retest.recheck.configuration.ProjectConfiguration.RETEST_PROJECT_ROOT;
import static de.retest.recheck.ignore.SearchFilterFiles.FILES_ENDING;
import static org.assertj.core.api.Assertions.assertThat;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import de.retest.recheck.util.junit.jupiter.SystemProperty;

class SearchFilterFilesTest {

	@Test
	void getDefaultFilterFiles_should_get_all_filter_files_from_classpath() {
		final List<File> defaultFilterFiles = SearchFilterFiles.getDefaultFilterFiles();
		assertThat( defaultFilterFiles.stream().map( File::getName ) ).contains( "positioning.filter",
				"visibility.filter" );
	}

	@Test
	@SystemProperty( key = RETEST_PROJECT_ROOT )
	void getProjectFilterFiles_should_only_get_filter_files( @TempDir final Path temp ) throws Exception {
		final Path configFolder = temp.resolve( RETEST_PROJECT_ROOT );
		Files.createDirectory( configFolder );
		final Path retestFolder = configFolder.resolve( RETEST_PROJECT_CONFIG_FOLDER );
		Files.createDirectory( retestFolder );
		final Path filterFolder = retestFolder.resolve( FILTER_FOLDER );
		Files.createDirectory( filterFolder );

		Files.createTempFile( filterFolder, "random", ".ignore" ).toFile();
		final File colorFilter = Files.createTempFile( filterFolder, "color", FILES_ENDING ).toFile();
		final File webFontFilter = Files.createTempFile( filterFolder, "web-font", FILES_ENDING ).toFile();
		System.setProperty( RETEST_PROJECT_ROOT, filterFolder.toString() );

		final List<File> projectFilterFiles = SearchFilterFiles.getProjectFilterFiles();
		assertThat( projectFilterFiles ).allMatch( file -> file.toString().endsWith( FILES_ENDING ) );
		assertThat( projectFilterFiles.stream().map( File::getName ) ).contains( colorFilter.getName().toString(),
				webFontFilter.getName().toString() );
	}
}

Test the behavior of the method


// Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.buildtool.buildevent;

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.buildtool.ExecutionTool;

import java.util.Collection;

/**
 * This event is fired from {@link ExecutionTool#executeBuild} to indicate that the execution phase
 * of the build is starting.
 */
public class ExecutionStartingEvent {
  private final Collection<TransitiveInfoCollection> targets;

  /**
   * Construct the event with a set of targets.
   * @param targets Remaining active targets.
   */
  public ExecutionStartingEvent(Collection<? extends TransitiveInfoCollection> targets) {
    this.targets = ImmutableList.copyOf(targets);
  }

  /**
   * @return The set of active targets remaining, which is a subset
   *     of the targets in the user request.
   */
  public Collection<TransitiveInfoCollection> getTargets() {
    return targets;
  }
}

// Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.buildtool.buildevent;

import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import java.util.Collection;

/**
 * This event is fired from {@link com.google.devtools.build.lib.buildtool.ExecutionTool} to
 * indicate that the execution phase of the build is starting.
 */
public class ExecutionStartingEvent {
  private final Collection<TransitiveInfoCollection> targets;

  /**
   * Construct the event with a set of targets.
   * @param targets Remaining active targets.
   */
  public ExecutionStartingEvent(Collection<? extends TransitiveInfoCollection> targets) {
    this.targets = ImmutableList.copyOf(targets);
  }

  /**
   * @return The set of active targets remaining, which is a subset
   *     of the targets in the user request.
   */
  public Collection<TransitiveInfoCollection> getTargets() {
    return targets;
  }
}

Remove dependency on ExecutionTool to break a build cycle.


import java.util.List;

/**
 * Created by nate on 4/10/16.
 */
public class Game extends Model {
    public int id;
    public String name;
    public float price;

    public List<Category> categories() {
        return null;
    }

    public List<Review> reviews() {
        return null;
    }
}

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by nate on 4/10/16.
 */
public class Game extends Model {
    public int id;
    public String name;
    public float price;

    public List<Category> categories() {
        try {
            List<Category> categories = new ArrayList<Category>();
            Category cat;

            PreparedStatement s = c.prepareStatement(
                    "SELECT id, name from game_category join category on id=category_id where game_id=?"
            );
            s.setInt(1, id);

            ResultSet rs = s.executeQuery();
            while (rs.next()) {
                cat = new Category();
                cat.id = rs.getInt("id");
                cat.name = rs.getString("name");

                categories.add(cat);
            }

            return categories;
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }

    public List<Review> reviews() {
        try {
            List<Review> reviews = new ArrayList<>();
            UserReview ur;
            CriticReview cr;
            User u;

            PreparedStatement s = c.prepareStatement(
                    "SELECT rating, text, real_name, profile_name, credit_card, level, phone, user.id" +
                            "from user_review" +
                            "join user on user.id=user_review.user_id" +
                            "where game_id=?"
            );
            s.setInt(1, id);

            ResultSet rs = s.executeQuery();
            while (rs.next()) {
                ur = new UserReview();
                ur.rating = rs.getInt("id");
                ur.text = rs.getString("text");
                ur.game = this;

                u = new User();
                ur.user = u;
                u.realName = rs.getString("real_name");
                u.creditCard = rs.getString("credit_card");
                u.level = rs.getInt("level");
                u.phone = rs.getString("phone");
                u.id = rs.getInt("user.id");

                reviews.add(ur);
            }

            s = c.prepareStatement("SELECT rating, text, company, link from critic_review where game_id=?");
            s.setInt(1, id);

            rs = s.executeQuery();
            while (rs.next()) {
                cr = new CriticReview();

                cr.game = this;
                cr.company = rs.getString("company");
                cr.rating = rs.getFloat("rating");
                cr.link = rs.getString("link");

                reviews.add(cr);
            }

            return reviews;
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Add query methods to game class


package be.kuleuven.cs.distrinet.jnome.core.type;

import org.aikodi.chameleon.oo.type.Type;
import org.aikodi.chameleon.oo.type.generics.FormalParameterType;
import org.aikodi.chameleon.oo.type.generics.FormalTypeParameter;
import org.aikodi.chameleon.oo.type.generics.LazyFormalAlias;

public class JavaLazyFormalAlias extends LazyFormalAlias implements JavaType {

  public JavaLazyFormalAlias(String name, FormalTypeParameter param) {
    super(name, param);
  }

  @Override
  public Type erasure() {
    return this;
  }

  @Override
  public FormalParameterType cloneSelf() {
    return new JavaLazyFormalAlias(name(), parameter());
  }

}

package be.kuleuven.cs.distrinet.jnome.core.type;

import org.aikodi.chameleon.core.lookup.LookupException;
import org.aikodi.chameleon.oo.type.Type;
import org.aikodi.chameleon.oo.type.TypeFixer;
import org.aikodi.chameleon.oo.type.generics.FormalParameterType;
import org.aikodi.chameleon.oo.type.generics.FormalTypeParameter;
import org.aikodi.chameleon.oo.type.generics.LazyFormalAlias;

public class JavaLazyFormalAlias extends LazyFormalAlias implements JavaType {

  public JavaLazyFormalAlias(String name, FormalTypeParameter param) {
    super(name, param);
  }

  @Override
  public Type erasure() {
    return this;
  }

  @Override
  public FormalParameterType cloneSelf() {
    return new JavaLazyFormalAlias(name(), parameter());
  }

  @Override
  public boolean upperBoundNotHigherThan(Type other, TypeFixer trace) throws LookupException {
    if(trace.contains(other, parameter())) {
      return true;
    }
    if(sameAs(other)) {
      return true;
    }
    trace.add(other, parameter());
    return super.upperBoundNotHigherThan(other, trace);
  }

}

Update the type fixer to avoid an infinite loop for recursively defined captured type parameters


package fr.insee.rmes.utils;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.codehaus.stax2.io.EscapingWriterFactory;

public class CustomXmlEscapingWriterFactory implements EscapingWriterFactory {
public Writer createEscapingWriterFor(final Writer out, String enc) {
    return new Writer(){
        @Override
        public void write(char[] cbuf, int off, int len) throws IOException {
            String val = "";
            for (int i = off; i < len; i++) {
                val += cbuf[i];
            }
            String escapedStr = escapeHtml(val); //convert special characters excluding xml tags
            out.write(escapedStr);
        }

        @Override
        public void flush() throws IOException {
            out.flush();
        }

        @Override
        public void close() throws IOException {
            out.close();
        }
      };
    }

	private String escapeHtml(String s) {
		 return s.replace("&", "&")
				 .replace(">", ">")
				 .replace("<", "<")
				 .replace("\"", """);
				// .replace("'", "'");
	}

    public Writer createEscapingWriterFor(OutputStream out, String enc) {
        throw new IllegalArgumentException("not supported");
    }
}

package fr.insee.rmes.utils;

import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;

import org.codehaus.stax2.io.EscapingWriterFactory;

public class CustomXmlEscapingWriterFactory implements EscapingWriterFactory {

public Writer createEscapingWriterFor(final Writer out, String enc) {
    return new Writer(){
        @Override
        public void write(char[] cbuf, int off, int len) throws IOException {
        	//WARN : the cbuf contains only part of the string = can't validate xml here
            String val = "";
            for (int i = off; i < len; i++) {
                val += cbuf[i];
            }
            String escapedStr = encodeXml(escapeHtml(val)); //encode manually some xml tags
            out.write(escapedStr);
        }

        @Override
        public void flush() throws IOException {
            out.flush();
        }

        @Override
        public void close() throws IOException {
            out.close();
        }
      };
    }

	private String escapeHtml(String s) {
		 return s.replace("&", "&")
				 .replace(">", ">")
				 .replace("<", "<")
				 .replace("\"", """);
	}

	private String encodeXml(String s) {
		 return s.replaceAll("<([a-zA-Z]+)>", "<$1>") //xml open tag
				 .replaceAll("</([a-zA-Z]+)>", "</$1>") //xml close tag
				 .replaceAll("<([a-zA-Z]+)/>", "<$1/>") //br
				 .replaceAll("<([a-zA-Z]+) />", "<$1 />"); //br with space
	}

    public Writer createEscapingWriterFor(OutputStream out, String enc) {
        throw new IllegalArgumentException("not supported");
    }
}

Change encoding of xml to encode all except xml tags


/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.repository;

import org.openmhealth.dsu.domain.DataPoint;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;

import java.util.Optional;

/**
 * A repository of data points.
 *
 * @see org.springframework.data.repository.CrudRepository
 * @author Emerson Farrugia
 */
@NoRepositoryBean
public interface DataPointRepository extends Repository<DataPoint, String>, CustomDataPointRepository {

    Optional<DataPoint> findOne(String id);

    Iterable<DataPoint> findAll();

    Iterable<DataPoint> save(Iterable<DataPoint> dataPoints);

    void delete(String id);
}

/*
 * Copyright 2014 Open mHealth
 *
 * 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.openmhealth.dsu.repository;

import org.openmhealth.dsu.domain.DataPoint;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.Repository;

import java.util.Optional;

/**
 * A repository of data points.
 *
 * @see org.springframework.data.repository.CrudRepository
 * @author Emerson Farrugia
 */
@NoRepositoryBean
public interface DataPointRepository extends Repository<DataPoint, String>, CustomDataPointRepository {

    Optional<DataPoint> findOne(String id);

    Iterable<DataPoint> findAll();

    DataPoint save(DataPoint dataPoint);

    Iterable<DataPoint> save(Iterable<DataPoint> dataPoints);

    Long delete(String id);
}

Add save method and fix delete method in data point repository.


/*
 *  Copyright 2013 Pascal Christoph, hbz
 * Licensed under the Eclipse Public License 1.0 */
package org.culturegraph.mf.util.tries;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * tests {@link SimpleRegexTrie}
 *
 * @author Pascal Christoph
 *
 */
public final class SimpleRegexTrieTest {
	private static final String SCC = "aacbb|a[ab]bb";
	private static final String AACBB = "aacbb";

	@Test
	public void testWithSimpleCharacterClass() {
		final SimpleRegexTrie<String> trie = new SimpleRegexTrie<String>();
		trie.put(SCC, SCC);
		assertTrue(AACBB, trie.get(AACBB).size() == 1);
	}
}

/*
 *  Copyright 2013 Pascal Christoph, hbz
 *  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.culturegraph.mf.util.tries;

import static org.junit.Assert.assertTrue;

import org.junit.Test;

/**
 * tests {@link SimpleRegexTrie}
 *
 * @author Pascal Christoph
 *
 */
public final class SimpleRegexTrieTest {
	private static final String SCC = "aacbb|a[ab]bb";
	private static final String AACBB = "aacbb";

	@Test
	public void testWithSimpleCharacterClass() {
		final SimpleRegexTrie<String> trie = new SimpleRegexTrie<String>();
		trie.put(SCC, SCC);
		assertTrue(AACBB, trie.get(AACBB).size() == 1);
	}
}

Change license from epl to apache2


package uk.ac.ebi.atlas.profiles.baseline;

import com.google.common.base.Joiner;
import com.google.common.collect.Iterables;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExpression;
import uk.ac.ebi.atlas.model.experiment.baseline.FactorGroup;
import uk.ac.ebi.atlas.profiles.ExpressionsRowRawDeserializer;

import java.util.Iterator;
import java.util.List;
import java.util.Queue;

public class ExpressionsRowRawDeserializerBaseline extends ExpressionsRowRawDeserializer<BaselineExpression> {

    final int expectedNumberOfValues;
    Iterator<FactorGroup> factorGroups;

    public ExpressionsRowRawDeserializerBaseline(List<FactorGroup> orderedFactorGroups) {
        expectedNumberOfValues = orderedFactorGroups.size();
        factorGroups = Iterables.cycle(orderedFactorGroups).iterator();
    }

    @Override
    public ExpressionsRowRawDeserializer<BaselineExpression> reload(BaselineExpression... values) {
        if (values.length != expectedNumberOfValues) {
            throw new IllegalArgumentException(String.format("Expected %s values but got [%s]", expectedNumberOfValues, Joiner.on(",").join(values)));
        }
        return super.reload(values);
    }

    @Override
    public BaselineExpression nextExpression(Queue<BaselineExpression> rawValuesRow) {
        return rawValuesRow.poll();
    }

}

package uk.ac.ebi.atlas.profiles.baseline;

import com.google.common.base.Joiner;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExpression;
import uk.ac.ebi.atlas.model.experiment.baseline.FactorGroup;
import uk.ac.ebi.atlas.profiles.ExpressionsRowRawDeserializer;

import java.util.List;
import java.util.Queue;

public class ExpressionsRowRawDeserializerBaseline extends ExpressionsRowRawDeserializer<BaselineExpression> {

    private  int expectedNumberOfValues;

    public ExpressionsRowRawDeserializerBaseline(List<FactorGroup> orderedFactorGroups) {
        expectedNumberOfValues = orderedFactorGroups.size();
    }

    @Override
    public ExpressionsRowRawDeserializer<BaselineExpression> reload(BaselineExpression... values) {
        if (values.length != expectedNumberOfValues) {
            throw new IllegalArgumentException(String.format("Expected %s values but got [%s]", expectedNumberOfValues, Joiner.on(",").join(values)));
        }
        return super.reload(values);
    }

    @Override
    public BaselineExpression nextExpression(Queue<BaselineExpression> rawValuesRow) {
        return rawValuesRow.poll();
    }

}

Remove field which was never accessed


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

import org.apache.camel.spring.SpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringSimpleExpressionTest extends SpringTestSupport {

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/language/SpringSimpleExpressionTest.xml");
    }

    public void testSimpleEmptyString() throws Exception {
        getMockEndpoint("mock:result").expectedBodiesReceived("False");

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }

}

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

import org.apache.camel.spring.SpringTestSupport;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringSimpleExpressionTest extends SpringTestSupport {

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/language/SpringSimpleExpressionTest.xml");
    }

    public void testSimpleWhenString() throws Exception {
        getMockEndpoint("mock:result").expectedBodiesReceived("correct");

        template.sendBody("direct:start", "Hello World");

        assertMockEndpointsSatisfied();
    }

    public void testSimpleOtherwiseString() throws Exception {
        getMockEndpoint("mock:result").expectedBodiesReceived("incorrect");

        template.sendBody("direct:start", "Bye World");

        assertMockEndpointsSatisfied();
    }

}

Fix the failing test and add one more test to cover both when/otherwise conditions.


package net.jpountz.util;

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

import java.nio.ByteOrder;

public enum Utils {
  ;

  public static final ByteOrder NATIVE_BYTE_ORDER = ByteOrder.nativeOrder();

  private static final boolean unalignedAccessAllowed;
  static {
    String arch = System.getProperty("os.arch");
    unalignedAccessAllowed = arch.equals("i386") || arch.equals("x86")
            || arch.equals("amd64") || arch.equals("x86_64");
  }

  public static boolean isUnalignedAccessAllowed() {
    return unalignedAccessAllowed;
  }

}

package net.jpountz.util;

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

import java.nio.ByteOrder;

public enum Utils {
  ;

  public static final ByteOrder NATIVE_BYTE_ORDER = ByteOrder.nativeOrder();

  private static final boolean unalignedAccessAllowed;
  static {
    String arch = System.getProperty("os.arch");
    unalignedAccessAllowed = arch.equals("i386") || arch.equals("x86")
            || arch.equals("amd64") || arch.equals("x86_64")
            || arch.equals("aarch64");
  }

  public static boolean isUnalignedAccessAllowed() {
    return unalignedAccessAllowed;
  }

}

Add unsafeInstance support for AArch64


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

import afu.org.checkerframework.checker.nullness.qual.Nullable;

/** Exception thrown when BeamSQL cannot convert sql to BeamRelNode. */
public class SqlConversionException extends RuntimeException {

  public SqlConversionException(@Nullable Throwable cause) {
    super(cause);
  }

  public SqlConversionException(String message) {
    super(message);
  }

  public SqlConversionException(String message, Throwable cause) {
    super(message, cause);
  }
}

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

import org.checkerframework.checker.nullness.qual.Nullable;

/** Exception thrown when BeamSQL cannot convert sql to BeamRelNode. */
public class SqlConversionException extends RuntimeException {

  public SqlConversionException(@Nullable Throwable cause) {
    super(cause);
  }

  public SqlConversionException(String message) {
    super(message);
  }

  public SqlConversionException(String message, Throwable cause) {
    super(message, cause);
  }
}

Fix null error in Beam SQL


/*
 * Copyright 2017 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.autonomy.abc.dashboards;

import com.hp.autonomy.frontend.selenium.config.TestConfig;
import org.junit.Before;

public class SunburstWidgetITCase extends ClickableDashboardITCase {
    public SunburstWidgetITCase(final TestConfig config) {
        super(config, 1, "Sunburst Dashboard", "Sunburst", "SunburstSearch");
    }

    @Override
    @Before
    public void setUp() {
        page.waitForSunburstWidgetToRender();
    }

    //TODO once config is set up, test:
    //      * sunburst renders segments
    //      * sunburst resizes
    //      * legend is populated (colours, order by counts)
    //      * segment colours and ordering are correct (give segments data-id for testing?)
    //      * the 'too many entries' legend item is displayed when necessary
    //      * legend changes position with resizing
}

/*
 * Copyright 2017 Hewlett Packard Enterprise Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.autonomy.abc.dashboards;

import com.hp.autonomy.frontend.selenium.config.TestConfig;
import org.junit.Before;

public class SunburstWidgetITCase extends ClickableDashboardITCase {
    public SunburstWidgetITCase(final TestConfig config) {
        super(config, 1, "Sunburst Dashboard", "Sunburst", "SunburstSearch");
    }

    @Override
    @Before
    public void setUp() {
        super.setUp();
        page.waitForSunburstWidgetToRender();
    }

    //TODO once config is set up, test:
    //      * sunburst renders segments
    //      * sunburst resizes
    //      * legend is populated (colours, order by counts)
    //      * segment colours and ordering are correct (give segments data-id for testing?)
    //      * the 'too many entries' legend item is displayed when necessary
    //      * legend changes position with resizing
}

Call super in SunburstWidgetIT setUp method.


package com.thinkaurelius.titan.diskstorage.util;

import java.util.concurrent.TimeUnit;

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

public abstract class AbstractTimestampProvider implements TimestampProvider {

    private static final Logger log =
            LoggerFactory.getLogger(AbstractTimestampProvider.class);

    @Override
    public long sleepUntil(final long time, final TimeUnit unit, final Logger log) throws InterruptedException {

        // All long variables are times in parameter unit

        long now;

        while ((now = unit.convert(getTime(), getUnit())) <= time) {
            final long delta = time - now;
            /*
             * TimeUnit#sleep(long) internally preserves the nanoseconds parts
             * of the argument, if applicable, and passes both milliseconds and
             * nanoseconds parts into Thread#sleep(long, long)
             */
//            if (log.isDebugEnabled()) {
//                log.error("Sleeping: now={} targettime={} delta={} (unit={})",
//                        new Object[] { now, time, delta, unit });
//            }
            unit.sleep(delta);
        }

        return now;
    }

    @Override
    public long sleepUntil(final long time, final TimeUnit unit) throws InterruptedException {
        return sleepUntil(time, unit, log);
    }

    @Override
    public String toString() {
        return "TimestampProvider[" + getUnit() + "]";
    }
}

package com.thinkaurelius.titan.diskstorage.util;

import java.util.concurrent.TimeUnit;

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

public abstract class AbstractTimestampProvider implements TimestampProvider {

    private static final Logger log =
            LoggerFactory.getLogger(AbstractTimestampProvider.class);

    @Override
    public long sleepUntil(final long time, final TimeUnit unit, final Logger log) throws InterruptedException {

        // All long variables are times in parameter unit

        long now;

        while ((now = unit.convert(getTime(), getUnit())) <= time) {
            final long delta = time - now;
            /*
             * TimeUnit#sleep(long) internally preserves the nanoseconds parts
             * of the argument, if applicable, and passes both milliseconds and
             * nanoseconds parts into Thread#sleep(long, long)
             */
            if (log.isDebugEnabled()) {
                log.debug("Sleeping: now={} targettime={} delta={} (unit={})",
                        new Object[] { now, time, delta, unit });
            }
            unit.sleep(delta);
        }

        return now;
    }

    @Override
    public long sleepUntil(final long time, final TimeUnit unit) throws InterruptedException {
        return sleepUntil(time, unit, log);
    }

    @Override
    public String toString() {
        return "TimestampProvider[" + getUnit() + "]";
    }
}

Add a logging statement in TimestampProvider


// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// TODO: This implements the old, deprecated document HTTP= API. Remove on Vespa 7
/**
 * Exported not as an API, but specifically for SSBE.
 */
@ExportPackage
package com.yahoo.feedhandler;

import com.yahoo.osgi.annotation.ExportPackage;

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * Exported not as an API, but specifically for SSBE.
 */
@ExportPackage
package com.yahoo.feedhandler;

import com.yahoo.osgi.annotation.ExportPackage;

Remove wrong TODO - this is needed for vespafeeder


package com.elmakers.mine.bukkit.action.builtin;

import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.SpellResult;

public class AggroAction extends BaseSpellAction
{
    @Override
    public SpellResult perform(CastContext context)
    {
        Entity target = context.getTargetEntity();
        if (!(target instanceof Creature))
        {
            return SpellResult.NO_TARGET;
        }
        LivingEntity source = context.getLivingEntity();
        if (source == null)
        {
            return SpellResult.NO_TARGET;
        }

        Creature creatureTarget = (Creature)target;
        LivingEntity current = creatureTarget.getTarget();
        if (source == current)
        {
            return SpellResult.NO_ACTION;
        }

        ((Creature) target).setTarget(source);
        return SpellResult.CAST;
    }

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

    @Override
    public boolean requiresTargetEntity()
    {
        return true;
    }
}

package com.elmakers.mine.bukkit.action.builtin;

import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;

import com.elmakers.mine.bukkit.action.BaseSpellAction;
import com.elmakers.mine.bukkit.api.action.CastContext;
import com.elmakers.mine.bukkit.api.spell.SpellResult;

public class AggroAction extends BaseSpellAction
{
    private boolean clearTarget;

    @Override
    public void prepare(CastContext context, ConfigurationSection parameters) {
        super.prepare(context, parameters);
        clearTarget = parameters.getBoolean("clear_target", false);
    }

    @Override
    public SpellResult perform(CastContext context)
    {
        Entity target = context.getTargetEntity();
        if (!(target instanceof Creature))
        {
            return SpellResult.NO_TARGET;
        }

        Creature creatureTarget = (Creature)target;
        if (clearTarget) {
            LivingEntity current = creatureTarget.getTarget();
            if (current == null) {
                return SpellResult.NO_TARGET;
            }
            creatureTarget.setTarget(null);
            return SpellResult.CAST;
        }
        LivingEntity source = context.getLivingEntity();
        if (source == null)
        {
            return SpellResult.NO_TARGET;
        }

        LivingEntity current = creatureTarget.getTarget();
        if (source == current)
        {
            return SpellResult.NO_ACTION;
        }

        ((Creature) target).setTarget(source);
        return SpellResult.CAST;
    }

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

    @Override
    public boolean requiresTargetEntity()
    {
        return true;
    }
}

Add clear_target parameter to Aggro action


package jp.ac.nii.prl.mape.autoscaling.analysis.model.dto;

import jp.ac.nii.prl.mape.autoscaling.analysis.model.Adaptation;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.Deployment;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.Instance;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.InstanceType;

public class DeploymentFactory {

	public static Deployment createDeployment(DeploymentDTO dto) {
		return null;
	}

	public static DeploymentDTO createDeploymentDTO(Deployment deployment) {
		return null;
	}

	public static Adaptation createAdaptation(AdaptationDTO dto) {
		return null;
	}

	public static AdaptationDTO createAdaptationDTO(Adaptation adaptation) {
		return null;
	}

	public static Instance createInstance(InstanceDTO dto) {
		return null;
	}

	public static InstanceDTO createInstanceDTO(Instance instance) {
		return null;
	}

	public static InstanceType createInstanceType(InstanceTypeDTO dto) {
		return null;
	}

	public static InstanceTypeDTO createInstanceTypeDTO(InstanceType instanceType) {
		return null;
	}

}

package jp.ac.nii.prl.mape.autoscaling.analysis.model.dto;

import jp.ac.nii.prl.mape.autoscaling.analysis.model.Adaptation;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.Deployment;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.Instance;
import jp.ac.nii.prl.mape.autoscaling.analysis.model.InstanceType;

public class DeploymentFactory {

	public static Deployment createDeployment(DeploymentDTO dto) {
		return null;
	}

	public static DeploymentDTO createDeploymentDTO(Deployment deployment) {
		return null;
	}

	public static Adaptation createAdaptation(AdaptationDTO dto, Deployment deployment) {
		Adaptation adaptation = new Adaptation();

		adaptation.setAdapt(dto.isAdapt());
		adaptation.setCpuCount(dto.getCpuCount());
		adaptation.setScaleUp(dto.isScaleUp());
		adaptation.setDeployment(deployment);

		return adaptation;
	}

	public static AdaptationDTO createAdaptationDTO(Adaptation adaptation) {
		AdaptationDTO dto = new AdaptationDTO();

		dto.setAdapt(adaptation.isAdapt());
		dto.setCpuCount(adaptation.getCpuCount());
		dto.setScaleUp(adaptation.isScaleUp());

		return dto;
	}

	public static Instance createInstance(InstanceDTO dto) {
		return null;
	}

	public static InstanceDTO createInstanceDTO(Instance instance) {
		return null;
	}

	public static InstanceType createInstanceType(InstanceTypeDTO dto) {
		return null;
	}

	public static InstanceTypeDTO createInstanceTypeDTO(InstanceType instanceType) {
		return null;
	}

}

Implement Adaptation to AdaptationDTO and back


package io.georocket.commands;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import de.undercouch.underline.InputReader;
import de.undercouch.underline.OptionParserException;
import de.undercouch.underline.UnknownAttributes;
import io.georocket.GeoRocketCli;
import io.vertx.core.Handler;

/**
 * Displays a command's help
 * @author Michel Kraemer
 */
public class HelpCommand extends AbstractGeoRocketCommand {
  private List<String> commands = new ArrayList<String>();

  /**
   * Sets the commands to display the help for
   * @param commands the commands
   */
  @UnknownAttributes("COMMAND")
  public void setCommands(List<String> commands) {
    this.commands = commands;
  }

  @Override
  public String getUsageName() {
    return "help";
  }

  @Override
  public String getUsageDescription() {
    return "Display a command's help";
  }

  @Override
  public void doRun(String[] remainingArgs, InputReader in, PrintWriter out,
      Handler<Integer> handler) throws OptionParserException, IOException {
    // simply forward commands to GeoRocketCli and append '-h'
    GeoRocketCli cmd = new GeoRocketCli();
    cmd.setup();
    String[] args = commands.toArray(new String[commands.size() + 1]);
    args[args.length - 1] = "-h";
    cmd.setEndHandler(handler);
    cmd.run(args, in, out);
  }
}

package io.georocket.commands;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import de.undercouch.underline.InputReader;
import de.undercouch.underline.OptionParserException;
import de.undercouch.underline.UnknownAttributes;
import io.georocket.GeoRocketCli;
import io.vertx.core.Handler;

/**
 * Displays a command's help
 * @author Michel Kraemer
 */
public class HelpCommand extends AbstractGeoRocketCommand {
  protected List<String> commands = new ArrayList<String>();

  /**
   * Sets the commands to display the help for
   * @param commands the commands
   */
  @UnknownAttributes("COMMAND")
  public void setCommands(List<String> commands) {
    this.commands = commands;
  }

  @Override
  public String getUsageName() {
    return "help";
  }

  @Override
  public String getUsageDescription() {
    return "Display a command's help";
  }

  @Override
  public void doRun(String[] remainingArgs, InputReader in, PrintWriter out,
      Handler<Integer> handler) throws OptionParserException, IOException {
    // simply forward commands to GeoRocketCli and append '-h'
    GeoRocketCli cmd = new GeoRocketCli();
    cmd.setup();
    String[] args = commands.toArray(new String[commands.size() + 1]);
    args[args.length - 1] = "-h";
    cmd.setEndHandler(handler);
    cmd.run(args, in, out);
  }
}

Prepare help command for inheritance


package edu.brown.cs.systems.tracingplane.transit_layer.impl;

import org.junit.Test;
import edu.brown.cs.systems.tracingplane.transit_layer.Baggage;
import junit.framework.TestCase;

public class TestDefaultTransitLayer extends TestCase {

    @Test
    public void testNullTransitLayerImpl() {
        assertNotNull(Baggage.transit);
        assertTrue(Baggage.transit instanceof NullTransitLayer);

        Baggage baggage = Baggage.newInstance();
        assertNotNull(baggage);
        assertEquals(baggage, NullBaggage.INSTANCE);
    }

}

package edu.brown.cs.systems.tracingplane.transit_layer.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import edu.brown.cs.systems.tracingplane.transit_layer.Baggage;

public class TestDefaultTransitLayer {

    @Test
    public void testNullTransitLayerImpl() {
        assertNotNull(Baggage.transit);
        assertTrue(Baggage.transit instanceof NullTransitLayer);

        Baggage baggage = Baggage.newInstance();
        assertNotNull(baggage);
        assertEquals(baggage, NullBaggage.INSTANCE);
    }

}

Convert transit-layer testcases to JUnit 4


package org.metaborg.meta.interpreter.framework;

import org.spoofax.interpreter.core.Tools;
import org.spoofax.interpreter.terms.IStrategoAppl;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.interpreter.terms.ITermFactory;

public class TermUtils {

	public static boolean boolFromTerm(IStrategoTerm term) {
		if (Tools.isTermAppl(term)) {
			IStrategoAppl tAppl = (IStrategoAppl) term;
			if (Tools.hasConstructor(tAppl, "$__DS_False__$", 0)) {
				return false;
			} else if (Tools.hasConstructor(tAppl, "$__DS_True__$", 0)) {
				return true;
			}
		}
		throw new RuntimeException("Malformed boolean: " + term);
	}

	public static IStrategoTerm termFromBool(boolean bV, ITermFactory factory) {
		return factory.makeAppl(factory.makeConstructor(bV ? "$__DS_True__$"
				: "$__DS_False__$", 0));
	}
}

package org.metaborg.meta.interpreter.framework;

import org.spoofax.interpreter.core.Tools;
import org.spoofax.interpreter.terms.IStrategoAppl;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.interpreter.terms.ITermFactory;

public class TermUtils {

	public static boolean boolFromTerm(IStrategoTerm term) {
		if (Tools.isTermAppl(term)) {
			IStrategoAppl tAppl = (IStrategoAppl) term;
			if (Tools.hasConstructor(tAppl, "___DS_False___", 0)) {
				return false;
			} else if (Tools.hasConstructor(tAppl, "___DS_True___", 0)) {
				return true;
			}
		}
		throw new RuntimeException("Malformed boolean: " + term);
	}

	public static IStrategoTerm termFromBool(boolean bV, ITermFactory factory) {
		return factory.makeAppl(factory.makeConstructor(bV ? "___DS_True___"
				: "___DS_False___", 0));
	}
}

Fix incorrect ATerms being emitted for booleans


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

public class RestError {

	String developerMsg;
	String userMsg;
	Integer errorCode;

	public RestError() {
		super();
	}

	public RestError(String developerMsg, String userMsg, Integer errorCode) {
		super();
		this.developerMsg = developerMsg;
		this.userMsg = userMsg;
		this.errorCode = errorCode;
	}
	public String getDeveloperMsg() {
		return developerMsg;
	}
	public void setDeveloperMsg(String developerMsg) {
		this.developerMsg = developerMsg;
	}
	public String getUserMsg() {
		return userMsg;
	}
	public void setUserMsg(String userMsg) {
		this.userMsg = userMsg;
	}
	public Integer getErrorCode() {
		return errorCode;
	}
	public void setErrorCode(Integer errorCode) {
		this.errorCode = errorCode;
	}
}

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

public class RestError {

	String developerMsg;
	String userMsg;
	Integer errorCode;

	public RestError() {
	}

	public RestError(String developerMsg, String userMsg, Integer errorCode) {
		this.developerMsg = developerMsg;
		this.userMsg = userMsg;
		this.errorCode = errorCode;
	}
	public String getDeveloperMsg() {
		return developerMsg;
	}
	public void setDeveloperMsg(String developerMsg) {
		this.developerMsg = developerMsg;
	}
	public String getUserMsg() {
		return userMsg;
	}
	public void setUserMsg(String userMsg) {
		this.userMsg = userMsg;
	}
	public Integer getErrorCode() {
		return errorCode;
	}
	public void setErrorCode(Integer errorCode) {
		this.errorCode = errorCode;
	}
}

Remove redundant super calls in constructor


package org.madura.mobile.demo;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;

/**
 * This UI is served for browsers that don't support TouchKit.
 */
@SuppressWarnings("serial")
//// Disable browser caching the app for running it when offline
//@CacheManifestEnabled(false)
//// Prevent showing OfflineMode client UI if network fails
//@OfflineModeEnabled(false)
public class MaduraMobileDemoFallbackUI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setSpacing(true);
        layout.setMargin(true);

        Button button = new Button("Continue anyway.", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                getSession().setAttribute("mobile", true);
                getUI().getPage().reload();
            }
        });
        button.addStyleName("link");

        layout.addComponent(new Label("You seem to be using a desktop browser."));
        layout.addComponent(button);

        setContent(layout);
    }

}

package org.madura.mobile.demo;

import com.vaadin.annotations.Theme;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;

/**
 * This UI is served for browsers that don't support TouchKit.
 */
@SuppressWarnings("serial")
@Theme("mytheme")
//// Disable browser caching the app for running it when offline
//@CacheManifestEnabled(false)
//// Prevent showing OfflineMode client UI if network fails
//@OfflineModeEnabled(false)
public class MaduraMobileDemoFallbackUI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setSpacing(true);
        layout.setMargin(true);

        Button button = new Button("Continue anyway.", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                getSession().setAttribute("mobile", true);
                getUI().getPage().reload();
            }
        });
        button.addStyleName("link");

        layout.addComponent(new Label("You seem to be using a desktop browser."));
        layout.addComponent(button);

        setContent(layout);
    }

}

Set mytheme on fallback UI


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

/**
 * Created by rishabh.goyal on 06/05/14.
 */
public enum FieldType {
    STRING,
    INTEGER,
    LONG,
    FLOAT,
    DOUBLE,
    BOOLEAN,
    DATE
}

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

/**
 * Created by rishabh.goyal on 06/05/14.
 */
public enum FieldType {
    STRING,
    INTEGER,
    LONG,
    FLOAT,
    DOUBLE,
    BOOLEAN,
    DATE,
    OBJECT
}

Fix for elasticsearch object type


package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_13;

import protocolsupport.protocol.ConnectionImpl;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleCustomPayload;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.StringSerializer;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class CustomPayload extends MiddleCustomPayload {

	public CustomPayload(ConnectionImpl connection) {
		super(connection);
	}

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData() {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_CUSTOM_PAYLOAD_ID);
		StringSerializer.writeString(serializer, connection.getVersion(), tag);
		serializer.writeBytes(data);
		return RecyclableSingletonList.create(serializer);
	}

}

package protocolsupport.protocol.packet.middleimpl.clientbound.play.v_13;

import protocolsupport.protocol.ConnectionImpl;
import protocolsupport.protocol.packet.ClientBoundPacket;
import protocolsupport.protocol.packet.middle.clientbound.play.MiddleCustomPayload;
import protocolsupport.protocol.packet.middleimpl.ClientBoundPacketData;
import protocolsupport.protocol.serializer.MerchantDataSerializer;
import protocolsupport.protocol.serializer.StringSerializer;
import protocolsupport.protocol.typeremapper.legacy.LegacyCustomPayloadChannelName;
import protocolsupport.protocol.utils.ProtocolVersionsHelper;
import protocolsupport.utils.recyclable.RecyclableCollection;
import protocolsupport.utils.recyclable.RecyclableSingletonList;

public class CustomPayload extends MiddleCustomPayload {

	public CustomPayload(ConnectionImpl connection) {
		super(connection);
	}

	@Override
	public RecyclableCollection<ClientBoundPacketData> toData() {
		ClientBoundPacketData serializer = ClientBoundPacketData.create(ClientBoundPacket.PLAY_CUSTOM_PAYLOAD_ID);
		StringSerializer.writeString(serializer, connection.getVersion(), tag);
		switch (tag) {
			case (LegacyCustomPayloadChannelName.MODERN_TRADER_LIST): {
				String locale = cache.getAttributesCache().getLocale();
				MerchantDataSerializer.writeMerchantData(
					serializer, connection.getVersion(), locale,
					MerchantDataSerializer.readMerchantData(data, ProtocolVersionsHelper.LATEST_PC, locale)
				);
				break;
			}
			default: {
				serializer.writeBytes(data);
				break;
			}
		}
		return RecyclableSingletonList.create(serializer);
	}

}

Fix traders in 1.13 and 1.13.1


// BSD License (http://www.galagosearch.org/license)
package org.lemurproject.galago.utility.buffer;

import java.io.DataInput;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author trevor
 */
public abstract class DataStream extends InputStream implements DataInput {
    public abstract DataStream subStream(long start, long length) throws IOException;
    public abstract long getPosition();
    public abstract boolean isDone();
    public abstract long length();

    @Override
    public int read() throws IOException {
      if(isDone()) { return -1; }
      return readUnsignedByte();
    }

    /**
     * Seeks forward into the stream to a particular byte offset (reverse
     * seeks are not allowed).  The offset is relative to the start position of
     * this data stream, not the beginning of the file.
     */
    public abstract void seek(long offset);
}

// BSD License (http://www.galagosearch.org/license)
package org.lemurproject.galago.utility.buffer;

import java.io.DataInput;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author trevor
 */
public abstract class DataStream extends InputStream implements DataInput {
    public abstract DataStream subStream(long start, long length) throws IOException;
    public abstract long getPosition();
    public abstract boolean isDone();
    public abstract long length();

    @Override
    public int read() throws IOException {
      if(isDone()) { return -1; }
      return readUnsignedByte();
    }

    @Override
    public int read(byte[] b) throws IOException {
        return read(b, 0, b.length);
    }

    @Override
    public int read(byte[] b, int off, int len) throws IOException {
        int read;
        for(read=0; read<len && !isDone(); read++) {
            b[off+read] = (byte) readUnsignedByte();
        }
        return read;
    }

    /**
     * Seeks forward into the stream to a particular byte offset (reverse
     * seeks are not allowed).  The offset is relative to the start position of
     * this data stream, not the beginning of the file.
     */
    public abstract void seek(long offset);
}

Speed up the InputStream interface on Galago's cached stream class.


package hello.controllers;

import java.io.IOException;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import models.Greeting;

@RestController
@RequestMapping(value = "/api", produces = { MediaType.APPLICATION_JSON_VALUE })
public class ApiController {

	@RequestMapping(value = "/greeting", method = RequestMethod.GET)
	public @ResponseBody ResponseEntity<Greeting> get() {
		return new ResponseEntity<Greeting>(new Greeting(), HttpStatus.OK);
	}

	@RequestMapping(value = "/greeting", method = RequestMethod.POST)
	public @ResponseBody ResponseEntity<Greeting> post(@RequestBody String body) {
		Greeting greeting = new Greeting(getNameFromJson(body));
		return new ResponseEntity<Greeting>(greeting, HttpStatus.OK);
	}

	private String getNameFromJson(String json) {
		ObjectMapper objectMapper = new ObjectMapper();

		JsonNode rootNode;
		String name;

		try {
			rootNode = objectMapper.readTree(json);
			name = rootNode.path("name").textValue();
		} catch (IOException e) {
			name = null;
		}

		return name;
	}

}

package hello.controllers;

import java.io.IOException;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import models.Greeting;

@RestController
@RequestMapping(value = "/api", produces = { MediaType.APPLICATION_JSON_VALUE })
public class ApiController {

	@RequestMapping(value = "/greeting", method = RequestMethod.GET)
	public @ResponseBody ResponseEntity<Greeting> get() {
		return new ResponseEntity<Greeting>(new Greeting(), HttpStatus.OK);
	}

	@RequestMapping(value = "/greeting", method = RequestMethod.POST)
	public @ResponseBody ResponseEntity<Greeting> post(@RequestBody String body) {
		Greeting greeting = new Greeting(getNameFromJson(body));
		return new ResponseEntity<Greeting>(greeting, HttpStatus.OK);
	}

	private String getNameFromJson(String json) {
		ObjectMapper objectMapper = new ObjectMapper();

		String name;

		try {
			JsonNode rootNode = objectMapper.readTree(json);
			name = rootNode.path("name").textValue();
		} catch (IOException e) {
			name = null;
		}

		return name;
	}

}

Tidy up scope in API Controller.


/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.iod.client.api.textindexing;

import com.hp.autonomy.iod.client.util.MultiMap;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

@Setter
@Accessors(chain = true)
public class ListIndexesRequestBuilder {
    /**
     * @param indexTypes The value of the type parameter
     */
    private final Set<IndexType> indexTypes = Collections.emptySet();

    /**
     * @param indexFlavors The value of the flavor parameter
     */
    private final Set<IndexFlavor> indexFlavors = Collections.emptySet();

    /**
     * @return A map of parameters suitable for use with {@link ListIndexesService}.
     */
    public Map<String, Object> build() {
        final Map<String, Object> map = new MultiMap<>();

        for(final IndexType indexType : indexTypes) {
            map.put("type", indexType);
        }

        for (final IndexFlavor indexFlavor : indexFlavors) {
            map.put("flavor", indexFlavor);
        }

        return map;
    }
}

/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.iod.client.api.textindexing;

import com.hp.autonomy.iod.client.util.MultiMap;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

@Setter
@Accessors(chain = true)
public class ListIndexesRequestBuilder {
    /**
     * @param indexTypes The value of the type parameter
     */
    private Set<IndexType> indexTypes = new HashSet<>();

    /**
     * @param indexFlavors The value of the flavor parameter
     */
    private Set<IndexFlavor> indexFlavors = new HashSet<>();

    /**
     * @return A map of parameters suitable for use with {@link ListIndexesService}.
     */
    public Map<String, Object> build() {
        final Map<String, Object> map = new MultiMap<>();

        for(final IndexType indexType : indexTypes) {
            map.put("type", indexType);
        }

        for (final IndexFlavor indexFlavor : indexFlavors) {
            map.put("flavor", indexFlavor);
        }

        return map;
    }
}

Fix a compilation error in the tests.


package com.pixable.pixalytics.google_analytics.platform;

import com.pixable.pixalytics.core.platform.Platform;
import com.pixable.pixalytics.google_analytics.proxy.GoogleAnalyticsProxy;
import com.pixable.pixalytics.google_analytics.R;

import java.util.Map;

public class GoogleAnalyticsPlatform extends Platform {

    public GoogleAnalyticsPlatform(String id, Config config) {
        super(id, R.drawable.pixalytics__tracking_toast_google_analytics, new GoogleAnalyticsProxy(config));
    }

    /**
     * Configuration parameters for a tracking platform. For instance, a project in your Mixpanel
     * account.
     */
    public static class Config extends Platform.Config {
        Map<String, Integer> dimensionsMapping;
        Map<String, Integer>  metricsMapping;

        public Config(String appKey, Map<String, Integer> dimensionsMapping, Map<String, Integer> metricsMapping) {
            super(appKey);
            this.dimensionsMapping = dimensionsMapping;
            this.metricsMapping = metricsMapping;
        }

        public Map<String, Integer> getDimensionsMapping() {
            return dimensionsMapping;
        }

        public Map<String, Integer> getMetricsMapping() {
            return metricsMapping;
        }
    }
}

package com.pixable.pixalytics.google_analytics.platform;

import com.pixable.pixalytics.core.platform.Platform;
import com.pixable.pixalytics.google_analytics.proxy.GoogleAnalyticsProxy;
import com.pixable.pixalytics.google_analytics.R;

import java.util.Map;

public class GoogleAnalyticsPlatform extends Platform {

    public GoogleAnalyticsPlatform(String id, Config config) {
        super(id, R.drawable.pixalytics__tracking_toast_google_analytics, new GoogleAnalyticsProxy(config));
    }

    /**
     * Configuration parameters for a tracking platform. For instance, a project in your Google Analytics
     * account.
     * This configuration consists in:
     * - appKey: Google Analytics Project Id (like 'UA-XXXXXXXX-1')
     * - dimensionsMapping: Mapping of dimensions defined in Google Analytics Admin page to match Properties name and Dimensions Id
     *   Example: ({'view', 1},{'user', 2}...)
     * - metricsMapping: Mapping of metrics defined in Google Analytics Admin page to match Properties name and Metrics Id
     */
    public static class Config extends Platform.Config {
        Map<String, Integer> dimensionsMapping;
        Map<String, Integer>  metricsMapping;

        public Config(String appKey, Map<String, Integer> dimensionsMapping, Map<String, Integer> metricsMapping) {
            super(appKey);
            this.dimensionsMapping = dimensionsMapping;
            this.metricsMapping = metricsMapping;
        }

        public Map<String, Integer> getDimensionsMapping() {
            return dimensionsMapping;
        }

        public Map<String, Integer> getMetricsMapping() {
            return metricsMapping;
        }
    }
}

Add little documentation about Google Analytics Config


package info.u_team.u_team_core.item;

import java.util.function.Supplier;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.world.World;

public class NoPlaceUBucketItem extends UBucketItem {

	public NoPlaceUBucketItem(String name, ItemGroup group, Properties properties, Supplier<? extends Fluid> fluid) {
		super(name, group, properties, fluid);
	}

	public NoPlaceUBucketItem(String name, Properties properties, Supplier<? extends Fluid> fluid) {
		super(name, properties, fluid);
	}

	@Override
	public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
		return new ActionResult<ItemStack>(ActionResultType.PASS, player.getHeldItem(hand));
	}

}

package info.u_team.u_team_core.item;

import java.util.function.Supplier;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.world.World;

public class NoPlaceUBucketItem extends UBucketItem {

	public NoPlaceUBucketItem(ItemGroup group, Properties properties, Supplier<? extends Fluid> fluid) {
		super(group, properties, fluid);
	}

	public NoPlaceUBucketItem(Properties properties, Supplier<? extends Fluid> fluid) {
		super(properties, fluid);
	}

	@Override
	public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player, Hand hand) {
		return new ActionResult<ItemStack>(ActionResultType.PASS, player.getHeldItem(hand));
	}

}

Add new no place u bucket item


package tars.ui;

import javafx.scene.paint.Color;

/**
 * Manages color for UI parts
 * @@author A0121533W
 *
 */
public class UiColor {

    public static final String STATUS_UNDONE_TEXT_FILL =
            "-fx-text-fill: #212121";
    public static final String STATUS_DONE_TEXT_FILL = "-fx-text-fill: lightgrey";
    public static final String CIRCLE_LABEL_COLOR = "-fx-text-fill: white;";
    public static final String TASK_CARD_NEWLY_ADDED_BORDER = "-fx-border-color: lightblue";
    public static final String TASK_CARD_DEFAULT_BORDER = "-fx-border-color: #455A64";

    public enum CircleColor {
        HIGH(Color.RED), MEDIUM(Color.ORANGE), LOW(Color.GREEN),
        DONE(Color.LIGHTGREY), NONE(Color.TRANSPARENT);
        private Color circleColor;

        CircleColor(Color circleColor) {
            this.circleColor = circleColor;
        }

        Color getCircleColor() {
            return circleColor;
        }
    }
}

package tars.ui;

import javafx.scene.paint.Color;

/**
 * Manages color for UI parts
 * @@author A0121533W
 *
 */
public class UiColor {

    public static final String STATUS_UNDONE_TEXT_FILL_DARK =
            "-fx-text-fill: #212121";
    public static final String STATUS_UNDONE_TEXT_FILL_LIGHT =
            "-fx-text-fill: #757575";
    public static final String STATUS_DONE_TEXT_FILL = "-fx-text-fill: lightgrey";
    public static final String CIRCLE_LABEL_COLOR = "-fx-text-fill: white;";
    public static final String TASK_CARD_NEWLY_ADDED_BORDER = "-fx-border-color: #2E8AF7";
    public static final String TASK_CARD_DEFAULT_BORDER = "-fx-border-color: lightgrey";

    public enum CircleColor {
        HIGH(Color.RED), MEDIUM(Color.ORANGE), LOW(Color.GREEN),
        DONE(Color.LIGHTGREY), NONE(Color.TRANSPARENT);
        private Color circleColor;

        CircleColor(Color circleColor) {
            this.circleColor = circleColor;
        }

        Color getCircleColor() {
            return circleColor;
        }
    }
}

Update colors for task cards


package org.apereo.cas.services;

import org.apereo.cas.util.services.RegisteredServiceJsonSerializer;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.io.ClassPathResource;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

/**
 * Handles test cases for {@link JsonServiceRegistryDao}.
 *
 * @author Misagh Moayyed
 * @since 4.1.0
 */
public class JsonServiceRegistryDaoTests extends AbstractResourceBasedServiceRegistryDaoTests {

    @Before
    public void setUp() {
        try {
            this.dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
        } catch (final Exception e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Test
    public void verifyLegacyServiceDefn() throws Exception {
        final ClassPathResource resource = new ClassPathResource("Legacy-10000003.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }
}

package org.apereo.cas.services;

import org.apereo.cas.util.services.RegisteredServiceJsonSerializer;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.IOException;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;

/**
 * Handles test cases for {@link JsonServiceRegistryDao}.
 *
 * @author Misagh Moayyed
 * @since 4.1.0
 */
public class JsonServiceRegistryDaoTests extends AbstractResourceBasedServiceRegistryDaoTests {

    @Before
    public void setUp() {
        try {
            this.dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
        } catch (final Exception e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Test
    public void verifyLegacyServiceDefn() throws Exception {
        final ClassPathResource resource = new ClassPathResource("Legacy-10000003.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }

    @Test
    public void verifyExistingDefinitionForCompatibility() throws IOException {
        final Resource resource = new ClassPathResource("returnMappedAttributeReleasePolicyTest1.json");
        final RegisteredServiceJsonSerializer serializer = new RegisteredServiceJsonSerializer();
        final RegisteredService service = serializer.from(resource.getInputStream());
        assertNotNull(service);
    }
}

Clean up transformations of multimaps into JSON


package macrobase.analysis.outlier;

import java.util.List;

import macrobase.conf.MacroBaseConf;
import macrobase.conf.MacroBaseDefaults;
import macrobase.datamodel.Datum;

public abstract class TimeSeriesOutlierDetector extends OutlierDetector {
    protected final int tupleWindowSize;
    private int currentTupleWindowSize;

    public TimeSeriesOutlierDetector(MacroBaseConf conf) {
        super(conf);
        this.tupleWindowSize = conf.getInt(MacroBaseConf.TUPLE_WINDOW, MacroBaseDefaults.TUPLE_WINDOW);
        assert tupleWindowSize > 1;
    }

    public abstract void addToWindow(Datum datum);

    public abstract void removeLastFromWindow();

    // Score current window.
    public abstract double scoreWindow();

    @Override
    public void train(List<Datum> data) {
        // Just sanity checks - we don't actually compute anything in train,
        // since we train as we go while scoring.
        assert data.size() >= tupleWindowSize;
        assert data.get(0).getTime() != null;
    }

    @Override
    public double score(Datum datum) {
        /*
         * Note: we assume score is called with data in order - this is true for
         * batch analysis. Somewhat hacky but allows us to maintain
         * compatibility with OutlierDetector.
         */
        if (currentTupleWindowSize == tupleWindowSize) {
            currentTupleWindowSize--;
            removeLastFromWindow();
        }
        currentTupleWindowSize++;
        addToWindow(datum);
        return scoreWindow();
    }

    @Override
    public double getZScoreEquivalent(double zscore) {
        return 0;
    }

}

package macrobase.analysis.outlier;

import java.util.List;

import macrobase.conf.MacroBaseConf;
import macrobase.conf.MacroBaseDefaults;
import macrobase.datamodel.Datum;

public abstract class TimeSeriesOutlierDetector extends OutlierDetector {
    protected final int tupleWindowSize;
    private int currentTupleWindowSize;

    public TimeSeriesOutlierDetector(MacroBaseConf conf) {
        super(conf);
        this.tupleWindowSize = conf.getInt(MacroBaseConf.TUPLE_WINDOW, MacroBaseDefaults.TUPLE_WINDOW);
        assert tupleWindowSize > 1;
    }

    public abstract void addToWindow(Datum datum);

    public abstract void removeLastFromWindow();

    /**
     * Use the current window to build a model and then score the latest datum.
     */
    public abstract double scoreWindow();

    @Override
    public void train(List<Datum> data) {
        // Just sanity checks - we don't actually compute anything in train,
        // since we train as we go while scoring.
        assert data.size() >= tupleWindowSize;
        assert data.get(0).getTime() != null;
    }

    @Override
    public double score(Datum datum) {
        /*
         * Note: we assume score is called with data in order - this is true for
         * batch analysis. Somewhat hacky but allows us to maintain
         * compatibility with OutlierDetector.
         */
        if (currentTupleWindowSize == tupleWindowSize) {
            currentTupleWindowSize--;
            removeLastFromWindow();
        }
        currentTupleWindowSize++;
        addToWindow(datum);
        return scoreWindow();
    }

    @Override
    public double getZScoreEquivalent(double zscore) {
        return 0;
    }

}

Clarify current model of time series scoring