Add missing @Test annotation to test class

--- swift-codec/src/test/java/com/facebook/swift/codec/internal/compiler/TestCompilerThriftCodecFactory.java
+++ swift-codec/src/test/java/com/facebook/swift/codec/internal/compiler/TestCompilerThriftCodecFactory.java
@@ -17,7 +17,9 @@

 import com.facebook.swift.codec.AbstractThriftCodecManagerTest;
 import com.facebook.swift.codec.ThriftCodecManager;
+import org.testng.annotations.Test;

+@Test
 public class TestCompilerThriftCodecFactory extends AbstractThriftCodecManagerTest
 {
     private final ThriftCodecManager manager = new ThriftCodecManager(new CompilerThriftCodecFactory(true));

<|original_code|>
/*
 * Copyright (C) 2012 Facebook, 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.facebook.swift.codec.internal.compiler;

import com.facebook.swift.codec.AbstractThriftCodecManagerTest;
import com.facebook.swift.codec.ThriftCodecManager;

public class TestCompilerThriftCodecFactory extends AbstractThriftCodecManagerTest
{
    private final ThriftCodecManager manager = new ThriftCodecManager(new CompilerThriftCodecFactory(true));

    @Override
    public ThriftCodecManager createReadCodecManager()
    {
        return manager;
    }

    @Override
    public ThriftCodecManager createWriteCodecManager()
    {
        return manager;
    }
}

<|edits_diff|>
--- swift-codec/src/test/java/com/facebook/swift/codec/internal/compiler/TestCompilerThriftCodecFactory.java
+++ swift-codec/src/test/java/com/facebook/swift/codec/internal/compiler/TestCompilerThriftCodecFactory.java
@@ -17,6 +17,7 @@

 import com.facebook.swift.codec.AbstractThriftCodecManagerTest;
 import com.facebook.swift.codec.ThriftCodecManager;
+import org.testng.annotations.Test;

 public class TestCompilerThriftCodecFactory extends AbstractThriftCodecManagerTest
 {
<|current_version|>
/*
 * Copyright (C) 2012 Facebook, 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.facebook.swift.codec.internal.compiler;

import com.facebook.swift.codec.AbstractThriftCodecManagerTest;
import com.facebook.swift.codec.ThriftCodecManager;
import org.testng.annotations.Test;

public class TestCompilerThriftCodecFactory extends AbstractThriftCodecManagerTest
{
    private final ThriftCodecManager manager = new ThriftCodecManager(new CompilerThriftCodecFactory(true));

    @Override
    public ThriftCodecManager createReadCodecManager()
    {
        return manager;
    }

    @Override
    public ThriftCodecManager createWriteCodecManager()
    {
        return manager;
    }
}

<|next_version|>
/*
 * Copyright (C) 2012 Facebook, 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.facebook.swift.codec.internal.compiler;

import com.facebook.swift.codec.AbstractThriftCodecManagerTest;
import com.facebook.swift.codec.ThriftCodecManager;
import org.testng.annotations.Test;

@Test
public class TestCompilerThriftCodecFactory extends AbstractThriftCodecManagerTest
{
    private final ThriftCodecManager manager = new ThriftCodecManager(new CompilerThriftCodecFactory(true));

    @Override
    public ThriftCodecManager createReadCodecManager()
    {
        return manager;
    }

    @Override
    public ThriftCodecManager createWriteCodecManager()
    {
        return manager;
    }
}


Add Small.preSetUp to sample application

--- Android/Sample/app/src/main/java/net/wequick/example/small/Application.java
+++ Android/Sample/app/src/main/java/net/wequick/example/small/Application.java
@@ -9,6 +9,11 @@
     @Override
     public void onCreate() {
         super.onCreate();
+
+        // Options
         Small.setBaseUri("http://m.wequick.net/demo/");
+
+        // Required
+        Small.preSetUp(this);
     }
 }

<|original_code|>
package net.wequick.example.small;

import net.wequick.small.Small;

/**
 * Created by galen on 15/11/3.
 */
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();
        Small.setBaseUri("http://m.wequick.net/demo/");
    }
}

<|edits_diff|>
--- Android/Sample/app/src/main/java/net/wequick/example/small/Application.java
+++ Android/Sample/app/src/main/java/net/wequick/example/small/Application.java
@@ -9,6 +9,8 @@
     @Override
     public void onCreate() {
         super.onCreate();
+
+        // Options
         Small.setBaseUri("http://m.wequick.net/demo/");
     }
 }
<|current_version|>
package net.wequick.example.small;

import net.wequick.small.Small;

/**
 * Created by galen on 15/11/3.
 */
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Options
        Small.setBaseUri("http://m.wequick.net/demo/");
    }
}

<|next_version|>
package net.wequick.example.small;

import net.wequick.small.Small;

/**
 * Created by galen on 15/11/3.
 */
public class Application extends android.app.Application {
    @Override
    public void onCreate() {
        super.onCreate();

        // Options
        Small.setBaseUri("http://m.wequick.net/demo/");

        // Required
        Small.preSetUp(this);
    }
}


Set ack to all to ensure records are replicated on other kafka nodes.

--- src/main/java/com/sixt/service/framework/kafka/messaging/ProducerFactory.java
+++ src/main/java/com/sixt/service/framework/kafka/messaging/ProducerFactory.java
@@ -15,6 +15,7 @@
 import com.google.inject.Inject;
 import com.sixt.service.framework.ServiceProperties;
 import org.apache.kafka.clients.CommonClientConfigs;
+import org.apache.kafka.clients.producer.ProducerConfig;

 import java.util.Properties;

@@ -32,6 +33,7 @@

         Properties kafkaProducerConfig = new Properties();
         kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);
+        kafkaProducerConfig.put(ProducerConfig.ACKS_CONFIG, "all");  // ensure that records have been replicated to other kafka nodes

         return new Producer(kafkaProducerConfig);
     }

<|original_code|>
/**
 * Copyright 2016-2017 Sixt GmbH & Co. Autovermietung KG
 * 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.sixt.service.framework.kafka.messaging;

import com.google.inject.Inject;
import com.sixt.service.framework.ServiceProperties;
import org.apache.kafka.clients.CommonClientConfigs;

import java.util.Properties;

public class ProducerFactory {

    private final ServiceProperties serviceProperties;

    @Inject
    public ProducerFactory(ServiceProperties serviceProperties) {
        this.serviceProperties = serviceProperties;
    }

    public Producer createProducer() {
        String kafkaBootstrapServers = serviceProperties.getKafkaServer();

        Properties kafkaProducerConfig = new Properties();
        kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);

        return new Producer(kafkaProducerConfig);
    }

}
<|edits_diff|>
--- src/main/java/com/sixt/service/framework/kafka/messaging/ProducerFactory.java
+++ src/main/java/com/sixt/service/framework/kafka/messaging/ProducerFactory.java
@@ -15,6 +15,7 @@
 import com.google.inject.Inject;
 import com.sixt.service.framework.ServiceProperties;
 import org.apache.kafka.clients.CommonClientConfigs;
+import org.apache.kafka.clients.producer.ProducerConfig;

 import java.util.Properties;

<|current_version|>
/**
 * Copyright 2016-2017 Sixt GmbH & Co. Autovermietung KG
 * 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.sixt.service.framework.kafka.messaging;

import com.google.inject.Inject;
import com.sixt.service.framework.ServiceProperties;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.producer.ProducerConfig;

import java.util.Properties;

public class ProducerFactory {

    private final ServiceProperties serviceProperties;

    @Inject
    public ProducerFactory(ServiceProperties serviceProperties) {
        this.serviceProperties = serviceProperties;
    }

    public Producer createProducer() {
        String kafkaBootstrapServers = serviceProperties.getKafkaServer();

        Properties kafkaProducerConfig = new Properties();
        kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);

        return new Producer(kafkaProducerConfig);
    }

}
<|next_version|>
/**
 * Copyright 2016-2017 Sixt GmbH & Co. Autovermietung KG
 * 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.sixt.service.framework.kafka.messaging;

import com.google.inject.Inject;
import com.sixt.service.framework.ServiceProperties;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.producer.ProducerConfig;

import java.util.Properties;

public class ProducerFactory {

    private final ServiceProperties serviceProperties;

    @Inject
    public ProducerFactory(ServiceProperties serviceProperties) {
        this.serviceProperties = serviceProperties;
    }

    public Producer createProducer() {
        String kafkaBootstrapServers = serviceProperties.getKafkaServer();

        Properties kafkaProducerConfig = new Properties();
        kafkaProducerConfig.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, kafkaBootstrapServers);
        kafkaProducerConfig.put(ProducerConfig.ACKS_CONFIG, "all");  // ensure that records have been replicated to other kafka nodes

        return new Producer(kafkaProducerConfig);
    }

}


Add delimited output file and new AuthorAbbreviatedMatcher

Updated luceneUtils.java and lucenematcher.java to output a new delimited file
than can be imported direct into a db. Also added new Matchers called
AuthorAbbreviatedMatcher.java, EmptyStringMatch.java. Also added a config
and properties file to read data from the T:drive

--- src/main/java/org/kew/shs/dedupl/transformers/StripPublishingAuthorTransformer.java
+++ src/main/java/org/kew/shs/dedupl/transformers/StripPublishingAuthorTransformer.java
@@ -13,12 +13,16 @@
 		String transformed = s;
 		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
 			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
+		else
+			transformed = "";
 		return transformed;
 	}

 	public static void main(String[] args) {
 		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
 		System.out.println(t.transform("(Author1) Author 2"));
+		System.out.println(t.transform("Author3"));
+		System.out.println(t.transform("(Author4)"));
 	}

 }

<|original_code|>
package org.kew.shs.dedupl.transformers;

import org.apache.commons.lang.StringUtils;

/**
 * This transformer translates author strings in the form "(Author1) Author2" to "Author1"
 * @author nn00kg
 *
 */
public class StripPublishingAuthorTransformer implements Transformer{

	public String transform(String s) {
		String transformed = s;
		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
		return transformed;
	}

	public static void main(String[] args) {
		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
		System.out.println(t.transform("(Author1) Author 2"));
	}

}

<|edits_diff|>
--- src/main/java/org/kew/shs/dedupl/transformers/StripPublishingAuthorTransformer.java
+++ src/main/java/org/kew/shs/dedupl/transformers/StripPublishingAuthorTransformer.java
@@ -13,6 +13,8 @@
 		String transformed = s;
 		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
 			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
+		else
+			transformed = "";
 		return transformed;
 	}

<|current_version|>
package org.kew.shs.dedupl.transformers;

import org.apache.commons.lang.StringUtils;

/**
 * This transformer translates author strings in the form "(Author1) Author2" to "Author1"
 * @author nn00kg
 *
 */
public class StripPublishingAuthorTransformer implements Transformer{

	public String transform(String s) {
		String transformed = s;
		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
		else
			transformed = "";
		return transformed;
	}

	public static void main(String[] args) {
		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
		System.out.println(t.transform("(Author1) Author 2"));
	}

}

<|next_version|>
package org.kew.shs.dedupl.transformers;

import org.apache.commons.lang.StringUtils;

/**
 * This transformer translates author strings in the form "(Author1) Author2" to "Author1"
 * @author nn00kg
 *
 */
public class StripPublishingAuthorTransformer implements Transformer{

	public String transform(String s) {
		String transformed = s;
		if (StringUtils.isNotBlank(s) && ((s.indexOf("(") != -1) && s.indexOf(")") != -1))
			transformed = s.substring(s.indexOf("(")+1,s.indexOf(")"));
		else
			transformed = "";
		return transformed;
	}

	public static void main(String[] args) {
		StripPublishingAuthorTransformer t  = new StripPublishingAuthorTransformer();
		System.out.println(t.transform("(Author1) Author 2"));
		System.out.println(t.transform("Author3"));
		System.out.println(t.transform("(Author4)"));
	}

}


Fix Scope (error during release)

Fix Scope (error during release)

--- integration-tests/test-jsf-war/src/test/java/de/hilling/cdi/sampleapp/ejb/JEETestConfiguration.java
+++ integration-tests/test-jsf-war/src/test/java/de/hilling/cdi/sampleapp/ejb/JEETestConfiguration.java
@@ -1,8 +1,10 @@
 package de.hilling.cdi.sampleapp.ejb;

 import de.hilling.junit.cdi.annotations.GlobalTestImplementation;
+import de.hilling.junit.cdi.scope.TestSuiteScoped;

 @GlobalTestImplementation
+@TestSuiteScoped
 public class JEETestConfiguration implements de.hilling.junit.cdi.jee.JEETestConfiguration {
     @Override
     public String getTestPersistenceUnitName() {

<|original_code|>
package de.hilling.cdi.sampleapp.ejb;

import de.hilling.junit.cdi.annotations.GlobalTestImplementation;

@GlobalTestImplementation
public class JEETestConfiguration implements de.hilling.junit.cdi.jee.JEETestConfiguration {
    @Override
    public String getTestPersistenceUnitName() {
        return "cdi-test-unit-eclipselink";
    }
}

<|edits_diff|>
--- integration-tests/test-jsf-war/src/test/java/de/hilling/cdi/sampleapp/ejb/JEETestConfiguration.java
+++ integration-tests/test-jsf-war/src/test/java/de/hilling/cdi/sampleapp/ejb/JEETestConfiguration.java
@@ -1,6 +1,7 @@
 package de.hilling.cdi.sampleapp.ejb;

 import de.hilling.junit.cdi.annotations.GlobalTestImplementation;
+import de.hilling.junit.cdi.scope.TestSuiteScoped;

 @GlobalTestImplementation
 public class JEETestConfiguration implements de.hilling.junit.cdi.jee.JEETestConfiguration {
<|current_version|>
package de.hilling.cdi.sampleapp.ejb;

import de.hilling.junit.cdi.annotations.GlobalTestImplementation;
import de.hilling.junit.cdi.scope.TestSuiteScoped;

@GlobalTestImplementation
public class JEETestConfiguration implements de.hilling.junit.cdi.jee.JEETestConfiguration {
    @Override
    public String getTestPersistenceUnitName() {
        return "cdi-test-unit-eclipselink";
    }
}

<|next_version|>
package de.hilling.cdi.sampleapp.ejb;

import de.hilling.junit.cdi.annotations.GlobalTestImplementation;
import de.hilling.junit.cdi.scope.TestSuiteScoped;

@GlobalTestImplementation
@TestSuiteScoped
public class JEETestConfiguration implements de.hilling.junit.cdi.jee.JEETestConfiguration {
    @Override
    public String getTestPersistenceUnitName() {
        return "cdi-test-unit-eclipselink";
    }
}


Put min/max constraints on sidecar.port

Put min/max constraints on sidecar.port

--- spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarProperties.java
+++ spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarProperties.java
@@ -18,6 +18,9 @@

 import java.net.URI;

+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
 import lombok.Data;

 import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -33,6 +36,8 @@

 	private URI homePageUri;

+	@Max(65535)
+	@Min(1)
 	private int port;

 }

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

package org.springframework.cloud.netflix.sidecar;

import java.net.URI;

import lombok.Data;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author Spencer Gibb
 */
@Data
@ConfigurationProperties("sidecar")
public class SidecarProperties {

	private URI healthUri;

	private URI homePageUri;

	private int port;

}

<|edits_diff|>
--- spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarProperties.java
+++ spring-cloud-netflix-sidecar/src/main/java/org/springframework/cloud/netflix/sidecar/SidecarProperties.java
@@ -18,6 +18,9 @@

 import java.net.URI;

+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
 import lombok.Data;

 import org.springframework.boot.context.properties.ConfigurationProperties;
<|current_version|>
/*
 * Copyright 2013-2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.netflix.sidecar;

import java.net.URI;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import lombok.Data;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author Spencer Gibb
 */
@Data
@ConfigurationProperties("sidecar")
public class SidecarProperties {

	private URI healthUri;

	private URI homePageUri;

	private int port;

}

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

package org.springframework.cloud.netflix.sidecar;

import java.net.URI;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import lombok.Data;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author Spencer Gibb
 */
@Data
@ConfigurationProperties("sidecar")
public class SidecarProperties {

	private URI healthUri;

	private URI homePageUri;

	@Max(65535)
	@Min(1)
	private int port;

}


Discard supplier after it's used

Discard supplier after it's used

--- src/main/java/editor/util/Lazy.java
+++ src/main/java/editor/util/Lazy.java
@@ -44,7 +44,10 @@
     public T get()
     {
         if (value == null)
+        {
             value = supplier.get();
+            supplier = null;
+        }
         return value;
     }
 }

<|original_code|>
package editor.util;

import java.util.function.Supplier;

/**
 * This class "lazily" supplies a value by not evaluating it until the first time
 * it is requested.  Then that function's result is cached so it doesn't have to
 * be reevaluated again.
 *
 * @param <T> Type of object that is being lazily evaluated
 * @author Alec Roelke
 */
public class Lazy<T> implements Supplier<T>
{

    /**
     * Cached value.
     */
    private T value;

    /**
     * Supplier for the cached value.
     */
    private Supplier<T> supplier;

    /**
     * Create a new Lazy supplier.
     *
     * @param val Function supplying the value to lazily evaluate.
     */
    public Lazy(Supplier<T> val)
    {
        value = null;
        supplier = val;
    }

    /**
     * If the value has not been computed, compute it and then return it.  Otherwise,
     * just return it.
     *
     * @return The value computed by the function
     */
    @Override
    public T get()
    {
        if (value == null)
            value = supplier.get();
        return value;
    }
}

<|edits_diff|>
--- src/main/java/editor/util/Lazy.java
+++ src/main/java/editor/util/Lazy.java
@@ -44,6 +44,7 @@
     public T get()
     {
         if (value == null)
+        {
             value = supplier.get();
         return value;
     }
<|current_version|>
package editor.util;

import java.util.function.Supplier;

/**
 * This class "lazily" supplies a value by not evaluating it until the first time
 * it is requested.  Then that function's result is cached so it doesn't have to
 * be reevaluated again.
 *
 * @param <T> Type of object that is being lazily evaluated
 * @author Alec Roelke
 */
public class Lazy<T> implements Supplier<T>
{

    /**
     * Cached value.
     */
    private T value;

    /**
     * Supplier for the cached value.
     */
    private Supplier<T> supplier;

    /**
     * Create a new Lazy supplier.
     *
     * @param val Function supplying the value to lazily evaluate.
     */
    public Lazy(Supplier<T> val)
    {
        value = null;
        supplier = val;
    }

    /**
     * If the value has not been computed, compute it and then return it.  Otherwise,
     * just return it.
     *
     * @return The value computed by the function
     */
    @Override
    public T get()
    {
        if (value == null)
        {
            value = supplier.get();
        return value;
    }
}

<|next_version|>
package editor.util;

import java.util.function.Supplier;

/**
 * This class "lazily" supplies a value by not evaluating it until the first time
 * it is requested.  Then that function's result is cached so it doesn't have to
 * be reevaluated again.
 *
 * @param <T> Type of object that is being lazily evaluated
 * @author Alec Roelke
 */
public class Lazy<T> implements Supplier<T>
{

    /**
     * Cached value.
     */
    private T value;

    /**
     * Supplier for the cached value.
     */
    private Supplier<T> supplier;

    /**
     * Create a new Lazy supplier.
     *
     * @param val Function supplying the value to lazily evaluate.
     */
    public Lazy(Supplier<T> val)
    {
        value = null;
        supplier = val;
    }

    /**
     * If the value has not been computed, compute it and then return it.  Otherwise,
     * just return it.
     *
     * @return The value computed by the function
     */
    @Override
    public T get()
    {
        if (value == null)
        {
            value = supplier.get();
            supplier = null;
        }
        return value;
    }
}


Print some diagnostic information when setting up the logging configuration.

--- org.metaborg.spoofax.eclipse/src/main/java/org/metaborg/spoofax/eclipse/logging/LoggingConfiguration.java
+++ org.metaborg.spoofax.eclipse/src/main/java/org/metaborg/spoofax/eclipse/logging/LoggingConfiguration.java
@@ -12,9 +12,11 @@

 public class LoggingConfiguration {
     public static void configure(Class<?> clazz, String location) {
+        System.err.println("Configuring logging framework for Spoofax");
         final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
         final ContextBase context = (ContextBase) loggerFactory;
         try {
+            System.err.println("Reading logging configuration from resource " + location + " in " + clazz);
             final JoranConfigurator configurator = new JoranConfigurator();
             configurator.setContext(context);
             context.reset();

<|original_code|>
package org.metaborg.spoofax.eclipse.logging;

import java.io.InputStream;

import org.slf4j.ILoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;

import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;

public class LoggingConfiguration {
    public static void configure(Class<?> clazz, String location) {
        final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
        final ContextBase context = (ContextBase) loggerFactory;
        try {
            final JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            context.reset();
            final InputStream configStream = clazz.getResourceAsStream(location);
            configurator.doConfigure(configStream);
        } catch(JoranException je) {
            // Ignore exception, StatusPrinter will handle it.
        }
        StatusPrinter.printInCaseOfErrorsOrWarnings(context);
    }
}

<|edits_diff|>
--- org.metaborg.spoofax.eclipse/src/main/java/org/metaborg/spoofax/eclipse/logging/LoggingConfiguration.java
+++ org.metaborg.spoofax.eclipse/src/main/java/org/metaborg/spoofax/eclipse/logging/LoggingConfiguration.java
@@ -12,6 +12,7 @@

 public class LoggingConfiguration {
     public static void configure(Class<?> clazz, String location) {
+        System.err.println("Configuring logging framework for Spoofax");
         final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
         final ContextBase context = (ContextBase) loggerFactory;
         try {
<|current_version|>
package org.metaborg.spoofax.eclipse.logging;

import java.io.InputStream;

import org.slf4j.ILoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;

import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;

public class LoggingConfiguration {
    public static void configure(Class<?> clazz, String location) {
        System.err.println("Configuring logging framework for Spoofax");
        final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
        final ContextBase context = (ContextBase) loggerFactory;
        try {
            final JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            context.reset();
            final InputStream configStream = clazz.getResourceAsStream(location);
            configurator.doConfigure(configStream);
        } catch(JoranException je) {
            // Ignore exception, StatusPrinter will handle it.
        }
        StatusPrinter.printInCaseOfErrorsOrWarnings(context);
    }
}

<|next_version|>
package org.metaborg.spoofax.eclipse.logging;

import java.io.InputStream;

import org.slf4j.ILoggerFactory;
import org.slf4j.impl.StaticLoggerBinder;

import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.ContextBase;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;

public class LoggingConfiguration {
    public static void configure(Class<?> clazz, String location) {
        System.err.println("Configuring logging framework for Spoofax");
        final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();
        final ContextBase context = (ContextBase) loggerFactory;
        try {
            System.err.println("Reading logging configuration from resource " + location + " in " + clazz);
            final JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            context.reset();
            final InputStream configStream = clazz.getResourceAsStream(location);
            configurator.doConfigure(configStream);
        } catch(JoranException je) {
            // Ignore exception, StatusPrinter will handle it.
        }
        StatusPrinter.printInCaseOfErrorsOrWarnings(context);
    }
}


Add output of running commands to SmartDashboard

--- src/org/usfirst/frc2832/Robot_2016/DashboardOutput.java
+++ src/org/usfirst/frc2832/Robot_2016/DashboardOutput.java
@@ -1,5 +1,6 @@
 package org.usfirst.frc2832.Robot_2016;

+import edu.wpi.first.wpilibj.command.Scheduler;
 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

 public class DashboardOutput {
@@ -13,5 +14,7 @@
 		SmartDashboard.putNumber("Combined Enc.", DriveEncoders.getAbsoluteValue());
 		SmartDashboard.putNumber("Servo val", Kicker.get());
 		SmartDashboard.putNumber("Gyro Reading", RobotMap.imu.getYaw());
+
+		SmartDashboard.putData(Scheduler.getInstance());
 	}
 }

<|original_code|>
package org.usfirst.frc2832.Robot_2016;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class DashboardOutput {

	//This method is invoked in teleopPeriodic to display all the crap we put on the dashboard
	public static void putData()
	{
		SmartDashboard.putNumber("laser",RobotMap.laser.pidGet()); //this value may not be right value?
		SmartDashboard.putNumber("Left Encoder", DriveEncoders.getLeftValue());
		SmartDashboard.putNumber("Right Encoder", DriveEncoders.getRightValue());
		SmartDashboard.putNumber("Combined Enc.", DriveEncoders.getAbsoluteValue());
		SmartDashboard.putNumber("Servo val", Kicker.get());
		SmartDashboard.putNumber("Gyro Reading", RobotMap.imu.getYaw());
	}
}

<|edits_diff|>
--- src/org/usfirst/frc2832/Robot_2016/DashboardOutput.java
+++ src/org/usfirst/frc2832/Robot_2016/DashboardOutput.java
@@ -1,5 +1,6 @@
 package org.usfirst.frc2832.Robot_2016;

+import edu.wpi.first.wpilibj.command.Scheduler;
 import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

 public class DashboardOutput {
<|current_version|>
package org.usfirst.frc2832.Robot_2016;

import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class DashboardOutput {

	//This method is invoked in teleopPeriodic to display all the crap we put on the dashboard
	public static void putData()
	{
		SmartDashboard.putNumber("laser",RobotMap.laser.pidGet()); //this value may not be right value?
		SmartDashboard.putNumber("Left Encoder", DriveEncoders.getLeftValue());
		SmartDashboard.putNumber("Right Encoder", DriveEncoders.getRightValue());
		SmartDashboard.putNumber("Combined Enc.", DriveEncoders.getAbsoluteValue());
		SmartDashboard.putNumber("Servo val", Kicker.get());
		SmartDashboard.putNumber("Gyro Reading", RobotMap.imu.getYaw());
	}
}

<|next_version|>
package org.usfirst.frc2832.Robot_2016;

import edu.wpi.first.wpilibj.command.Scheduler;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;

public class DashboardOutput {

	//This method is invoked in teleopPeriodic to display all the crap we put on the dashboard
	public static void putData()
	{
		SmartDashboard.putNumber("laser",RobotMap.laser.pidGet()); //this value may not be right value?
		SmartDashboard.putNumber("Left Encoder", DriveEncoders.getLeftValue());
		SmartDashboard.putNumber("Right Encoder", DriveEncoders.getRightValue());
		SmartDashboard.putNumber("Combined Enc.", DriveEncoders.getAbsoluteValue());
		SmartDashboard.putNumber("Servo val", Kicker.get());
		SmartDashboard.putNumber("Gyro Reading", RobotMap.imu.getYaw());

		SmartDashboard.putData(Scheduler.getInstance());
	}
}


Add comments to JPEG message

Add comments to JPEG message

--- app/drones/messages/JPEGFrameMessage.java
+++ app/drones/messages/JPEGFrameMessage.java
@@ -9,10 +9,18 @@

     private String imageData;

+    /**
+     *
+     * @param imageData The image data as a base 64 string
+     */
     public JPEGFrameMessage(String imageData) {
         this.imageData = imageData;
     }

+    /**
+     *
+     * @return The image data as a base 64 string
+     */
     public String getImageData() {
         return imageData;
     }

<|original_code|>
package drones.messages;

import java.io.Serializable;

/**
 * Created by brecht on 4/20/15.
 */
public class JPEGFrameMessage implements Serializable {

    private String imageData;

    public JPEGFrameMessage(String imageData) {
        this.imageData = imageData;
    }

    public String getImageData() {
        return imageData;
    }
}

<|edits_diff|>
--- app/drones/messages/JPEGFrameMessage.java
+++ app/drones/messages/JPEGFrameMessage.java
@@ -9,6 +9,10 @@

     private String imageData;

+    /**
+     *
+     * @param imageData The image data as a base 64 string
+     */
     public JPEGFrameMessage(String imageData) {
         this.imageData = imageData;
     }
<|current_version|>
package drones.messages;

import java.io.Serializable;

/**
 * Created by brecht on 4/20/15.
 */
public class JPEGFrameMessage implements Serializable {

    private String imageData;

    /**
     *
     * @param imageData The image data as a base 64 string
     */
    public JPEGFrameMessage(String imageData) {
        this.imageData = imageData;
    }

    public String getImageData() {
        return imageData;
    }
}

<|next_version|>
package drones.messages;

import java.io.Serializable;

/**
 * Created by brecht on 4/20/15.
 */
public class JPEGFrameMessage implements Serializable {

    private String imageData;

    /**
     *
     * @param imageData The image data as a base 64 string
     */
    public JPEGFrameMessage(String imageData) {
        this.imageData = imageData;
    }

    /**
     *
     * @return The image data as a base 64 string
     */
    public String getImageData() {
        return imageData;
    }
}


Add icon to primary stage

Add icon to primary stage

--- src/main/java/edu/cwru/sicu_sms/Main.java
+++ src/main/java/edu/cwru/sicu_sms/Main.java
@@ -12,6 +12,7 @@
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Parent;
 import javafx.scene.Scene;
+import javafx.scene.image.Image;
 import javafx.stage.Stage;

 /**
@@ -28,6 +29,8 @@
         Parent root = FXMLLoader.load(
                 getClass().getResource("sicu_sms.fxml")
         );
+        primaryStage.getIcons().add(new Image(
+                "http://s3.amazonaws.com/libapps/customers/558/images/CWRU_Logo.jpg"));
         primaryStage.setTitle("SICU Stress Measurement System");
         primaryStage.setScene(new Scene(root));
         primaryStage.setMaximized(true);

<|original_code|>
/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

/**
 * The main stage of the front-end program for interfacing with the electronic system.
 *
 * @since September 27, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(
                getClass().getResource("sicu_sms.fxml")
        );
        primaryStage.setTitle("SICU Stress Measurement System");
        primaryStage.setScene(new Scene(root));
        primaryStage.setMaximized(true);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

<|edits_diff|>
--- src/main/java/edu/cwru/sicu_sms/Main.java
+++ src/main/java/edu/cwru/sicu_sms/Main.java
@@ -12,6 +12,7 @@
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Parent;
 import javafx.scene.Scene;
+import javafx.scene.image.Image;
 import javafx.stage.Stage;

 /**
<|current_version|>
/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

/**
 * The main stage of the front-end program for interfacing with the electronic system.
 *
 * @since September 27, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(
                getClass().getResource("sicu_sms.fxml")
        );
        primaryStage.setTitle("SICU Stress Measurement System");
        primaryStage.setScene(new Scene(root));
        primaryStage.setMaximized(true);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

<|next_version|>
/*                                                                      *\
**                    SICU Stress Measurement System                    **
**                      Project P04  |  C380 Team A                     **
**          EBME 380: Biomedical Engineering Design Experience          **
**                    Case Western Reserve University                   **
**                          2016 Fall Semester                          **
\*                                                                      */

package edu.cwru.sicu_sms;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

/**
 * The main stage of the front-end program for interfacing with the electronic system.
 *
 * @since September 27, 2016
 * @author Ted Frohlich <ttf10@case.edu>
 * @author Abby Walker <amw138@case.edu>
 */
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(
                getClass().getResource("sicu_sms.fxml")
        );
        primaryStage.getIcons().add(new Image(
                "http://s3.amazonaws.com/libapps/customers/558/images/CWRU_Logo.jpg"));
        primaryStage.setTitle("SICU Stress Measurement System");
        primaryStage.setScene(new Scene(root));
        primaryStage.setMaximized(true);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}


Disable Airlift admin servlet in Proxy

Disable Airlift admin servlet in Proxy

Same as e9c217ae4a3e1a3c73be5bcd417bb5cf1384eaca, this time for Presto
Proxy.

--- presto-proxy/src/main/java/io/prestosql/proxy/ProxyModule.java
+++ presto-proxy/src/main/java/io/prestosql/proxy/ProxyModule.java
@@ -16,6 +16,7 @@
 import com.google.inject.Binder;
 import com.google.inject.Module;
 import com.google.inject.Scopes;
+import io.airlift.http.server.HttpServerConfig;

 import static io.airlift.configuration.ConfigBinder.configBinder;
 import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
@@ -27,6 +28,10 @@
     @Override
     public void configure(Binder binder)
     {
+        configBinder(binder).bindConfigDefaults(HttpServerConfig.class, httpServerConfig -> {
+            httpServerConfig.setAdminEnabled(false);
+        });
+
         httpClientBinder(binder).bindHttpClient("proxy", ForProxy.class);

         configBinder(binder).bindConfig(ProxyConfig.class);

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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;

import static io.airlift.configuration.ConfigBinder.configBinder;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
import static io.airlift.jaxrs.JaxrsBinder.jaxrsBinder;

public class ProxyModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder).bindHttpClient("proxy", ForProxy.class);

        configBinder(binder).bindConfig(ProxyConfig.class);
        configBinder(binder).bindConfig(JwtHandlerConfig.class, "proxy");

        jaxrsBinder(binder).bind(ProxyResource.class);

        binder.bind(JsonWebTokenHandler.class).in(Scopes.SINGLETON);
    }
}

<|edits_diff|>
--- presto-proxy/src/main/java/io/prestosql/proxy/ProxyModule.java
+++ presto-proxy/src/main/java/io/prestosql/proxy/ProxyModule.java
@@ -16,6 +16,7 @@
 import com.google.inject.Binder;
 import com.google.inject.Module;
 import com.google.inject.Scopes;
+import io.airlift.http.server.HttpServerConfig;

 import static io.airlift.configuration.ConfigBinder.configBinder;
 import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
<|current_version|>
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.prestosql.proxy;

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import io.airlift.http.server.HttpServerConfig;

import static io.airlift.configuration.ConfigBinder.configBinder;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
import static io.airlift.jaxrs.JaxrsBinder.jaxrsBinder;

public class ProxyModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        httpClientBinder(binder).bindHttpClient("proxy", ForProxy.class);

        configBinder(binder).bindConfig(ProxyConfig.class);
        configBinder(binder).bindConfig(JwtHandlerConfig.class, "proxy");

        jaxrsBinder(binder).bind(ProxyResource.class);

        binder.bind(JsonWebTokenHandler.class).in(Scopes.SINGLETON);
    }
}

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

import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Scopes;
import io.airlift.http.server.HttpServerConfig;

import static io.airlift.configuration.ConfigBinder.configBinder;
import static io.airlift.http.client.HttpClientBinder.httpClientBinder;
import static io.airlift.jaxrs.JaxrsBinder.jaxrsBinder;

public class ProxyModule
        implements Module
{
    @Override
    public void configure(Binder binder)
    {
        configBinder(binder).bindConfigDefaults(HttpServerConfig.class, httpServerConfig -> {
            httpServerConfig.setAdminEnabled(false);
        });

        httpClientBinder(binder).bindHttpClient("proxy", ForProxy.class);

        configBinder(binder).bindConfig(ProxyConfig.class);
        configBinder(binder).bindConfig(JwtHandlerConfig.class, "proxy");

        jaxrsBinder(binder).bind(ProxyResource.class);

        binder.bind(JsonWebTokenHandler.class).in(Scopes.SINGLETON);
    }
}


Fix timezone in submitted data

Fix timezone in submitted data

SimpleDateFormat uses the system's default time zone by default.

--- src/org/mozilla/mozstumbler/DateTimeUtils.java
+++ src/org/mozilla/mozstumbler/DateTimeUtils.java
@@ -5,11 +5,16 @@
 import java.util.Date;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.TimeZone;

 final class DateTimeUtils {
     private static final DateFormat mISO8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");

     static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day
+
+    static {
+        mISO8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
+    }

     private DateTimeUtils() {
     }

<|original_code|>
package org.mozilla.mozstumbler;

import android.annotation.SuppressLint;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

final class DateTimeUtils {
    private static final DateFormat mISO8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");

    static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day

    private DateTimeUtils() {
    }

    @SuppressLint("SimpleDateFormat")
    static String formatDate(Date date) {
        return mISO8601Format.format(date);
    }

    static String formatTime(long time) {
        return formatDate(new Date(time));
    }

    static String formatTimeForLocale(long time) {
        return DateFormat.getDateTimeInstance().format(time);
    }

    static String formatCurrentTime() {
        return formatTime(System.currentTimeMillis());
    }
}

<|edits_diff|>
--- src/org/mozilla/mozstumbler/DateTimeUtils.java
+++ src/org/mozilla/mozstumbler/DateTimeUtils.java
@@ -5,6 +5,7 @@
 import java.util.Date;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import java.util.TimeZone;

 final class DateTimeUtils {
     private static final DateFormat mISO8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
<|current_version|>
package org.mozilla.mozstumbler;

import android.annotation.SuppressLint;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

final class DateTimeUtils {
    private static final DateFormat mISO8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");

    static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day

    private DateTimeUtils() {
    }

    @SuppressLint("SimpleDateFormat")
    static String formatDate(Date date) {
        return mISO8601Format.format(date);
    }

    static String formatTime(long time) {
        return formatDate(new Date(time));
    }

    static String formatTimeForLocale(long time) {
        return DateFormat.getDateTimeInstance().format(time);
    }

    static String formatCurrentTime() {
        return formatTime(System.currentTimeMillis());
    }
}

<|next_version|>
package org.mozilla.mozstumbler;

import android.annotation.SuppressLint;

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.TimeZone;

final class DateTimeUtils {
    private static final DateFormat mISO8601Format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");

    static final long MILLISECONDS_PER_DAY = 86400000;  // milliseconds/day

    static {
        mISO8601Format.setTimeZone(TimeZone.getTimeZone("UTC"));
    }

    private DateTimeUtils() {
    }

    @SuppressLint("SimpleDateFormat")
    static String formatDate(Date date) {
        return mISO8601Format.format(date);
    }

    static String formatTime(long time) {
        return formatDate(new Date(time));
    }

    static String formatTimeForLocale(long time) {
        return DateFormat.getDateTimeInstance().format(time);
    }

    static String formatCurrentTime() {
        return formatTime(System.currentTimeMillis());
    }
}


Add VirtualMachineController mock to testing context

--- src/test/java/jp/ac/nii/prl/mape/autoscaling/analysis/TestContext.java
+++ src/test/java/jp/ac/nii/prl/mape/autoscaling/analysis/TestContext.java
@@ -5,6 +5,7 @@
 import org.springframework.context.annotation.Configuration;

 import jp.ac.nii.prl.mape.autoscaling.analysis.service.DeploymentService;
+import jp.ac.nii.prl.mape.autoscaling.analysis.service.VirtualMachineService;

 @Configuration
 public class TestContext {
@@ -13,4 +14,9 @@
 	public DeploymentService deploymentService() {
 		return Mockito.mock(DeploymentService.class);
 	}
+
+	@Bean
+	public VirtualMachineService virtualMachineService() {
+		return Mockito.mock(VirtualMachineService.class);
+	}
 }

<|original_code|>
package jp.ac.nii.prl.mape.autoscaling.analysis;

import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import jp.ac.nii.prl.mape.autoscaling.analysis.service.DeploymentService;

@Configuration
public class TestContext {

	@Bean
	public DeploymentService deploymentService() {
		return Mockito.mock(DeploymentService.class);
	}
}

<|edits_diff|>
--- src/test/java/jp/ac/nii/prl/mape/autoscaling/analysis/TestContext.java
+++ src/test/java/jp/ac/nii/prl/mape/autoscaling/analysis/TestContext.java
@@ -5,6 +5,7 @@
 import org.springframework.context.annotation.Configuration;

 import jp.ac.nii.prl.mape.autoscaling.analysis.service.DeploymentService;
+import jp.ac.nii.prl.mape.autoscaling.analysis.service.VirtualMachineService;

 @Configuration
 public class TestContext {
<|current_version|>
package jp.ac.nii.prl.mape.autoscaling.analysis;

import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import jp.ac.nii.prl.mape.autoscaling.analysis.service.DeploymentService;
import jp.ac.nii.prl.mape.autoscaling.analysis.service.VirtualMachineService;

@Configuration
public class TestContext {

	@Bean
	public DeploymentService deploymentService() {
		return Mockito.mock(DeploymentService.class);
	}
}

<|next_version|>
package jp.ac.nii.prl.mape.autoscaling.analysis;

import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import jp.ac.nii.prl.mape.autoscaling.analysis.service.DeploymentService;
import jp.ac.nii.prl.mape.autoscaling.analysis.service.VirtualMachineService;

@Configuration
public class TestContext {

	@Bean
	public DeploymentService deploymentService() {
		return Mockito.mock(DeploymentService.class);
	}

	@Bean
	public VirtualMachineService virtualMachineService() {
		return Mockito.mock(VirtualMachineService.class);
	}
}


Disable stage "unit" test for Hibernate Reactive

See #14812

Signed-off-by: Yoann Rodière <be2a24d2f52a7ba2aca48263378b2614d5b68cd6@hibernate.org>

--- extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java
+++ extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java
@@ -8,6 +8,7 @@
 import org.hibernate.reactive.stage.Stage;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;

@@ -25,6 +26,7 @@
     Stage.Session session;

     @Test
+    @Disabled("#14812: We're getting a ContextNotActiveException for some (unknown) reason")
     @ActivateRequestContext
     public void test() {
         DefaultEntity entity = new DefaultEntity("default");

<|original_code|>
package io.quarkus.hibernate.reactive.singlepersistenceunit;

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

import javax.enterprise.context.control.ActivateRequestContext;
import javax.inject.Inject;

import org.hibernate.reactive.stage.Stage;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class SinglePersistenceUnitCdiStageSessionTest {

    @RegisterExtension
    static QuarkusUnitTest runner = new QuarkusUnitTest()
            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
                    .addClass(DefaultEntity.class)
                    .addAsResource("application.properties"));

    @Inject
    Stage.Session session;

    @Test
    @ActivateRequestContext
    public void test() {
        DefaultEntity entity = new DefaultEntity("default");

        DefaultEntity retrievedEntity = session.withTransaction(tx -> session.persist(entity))
                .thenCompose($ -> session.withTransaction(tx -> session.clear().find(DefaultEntity.class, entity.getId())))
                .toCompletableFuture().join();

        assertThat(retrievedEntity)
                .isNotSameAs(entity)
                .returns(entity.getName(), DefaultEntity::getName);
    }

}

<|edits_diff|>
--- extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java
+++ extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java
@@ -8,6 +8,7 @@
 import org.hibernate.reactive.stage.Stage;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;

<|current_version|>
package io.quarkus.hibernate.reactive.singlepersistenceunit;

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

import javax.enterprise.context.control.ActivateRequestContext;
import javax.inject.Inject;

import org.hibernate.reactive.stage.Stage;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class SinglePersistenceUnitCdiStageSessionTest {

    @RegisterExtension
    static QuarkusUnitTest runner = new QuarkusUnitTest()
            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
                    .addClass(DefaultEntity.class)
                    .addAsResource("application.properties"));

    @Inject
    Stage.Session session;

    @Test
    @ActivateRequestContext
    public void test() {
        DefaultEntity entity = new DefaultEntity("default");

        DefaultEntity retrievedEntity = session.withTransaction(tx -> session.persist(entity))
                .thenCompose($ -> session.withTransaction(tx -> session.clear().find(DefaultEntity.class, entity.getId())))
                .toCompletableFuture().join();

        assertThat(retrievedEntity)
                .isNotSameAs(entity)
                .returns(entity.getName(), DefaultEntity::getName);
    }

}

<|next_version|>
package io.quarkus.hibernate.reactive.singlepersistenceunit;

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

import javax.enterprise.context.control.ActivateRequestContext;
import javax.inject.Inject;

import org.hibernate.reactive.stage.Stage;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusUnitTest;

public class SinglePersistenceUnitCdiStageSessionTest {

    @RegisterExtension
    static QuarkusUnitTest runner = new QuarkusUnitTest()
            .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
                    .addClass(DefaultEntity.class)
                    .addAsResource("application.properties"));

    @Inject
    Stage.Session session;

    @Test
    @Disabled("#14812: We're getting a ContextNotActiveException for some (unknown) reason")
    @ActivateRequestContext
    public void test() {
        DefaultEntity entity = new DefaultEntity("default");

        DefaultEntity retrievedEntity = session.withTransaction(tx -> session.persist(entity))
                .thenCompose($ -> session.withTransaction(tx -> session.clear().find(DefaultEntity.class, entity.getId())))
                .toCompletableFuture().join();

        assertThat(retrievedEntity)
                .isNotSameAs(entity)
                .returns(entity.getName(), DefaultEntity::getName);
    }

}


Fix formatting and please IDE

Fix formatting and please IDE

IntelliJ IDEA really likes `@Autowired` for XML configuration.

--- wisvch-connect-overlay/src/main/java/ch/wisv/connect/overlay/services/CHOIDCTokenService.java
+++ wisvch-connect-overlay/src/main/java/ch/wisv/connect/overlay/services/CHOIDCTokenService.java
@@ -4,6 +4,7 @@
 import org.mitre.oauth2.model.ClientDetailsEntity;
 import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
 import org.mitre.openid.connect.service.impl.DefaultOIDCTokenService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.oauth2.provider.OAuth2Request;

 import java.util.Set;
@@ -12,6 +13,7 @@

     private final CHUserDetailsService chUserDetailsService;

+    @Autowired
     public CHOIDCTokenService(CHUserDetailsService chUserDetailsService) {
         this.chUserDetailsService = chUserDetailsService;
     }

<|original_code|>
package ch.wisv.connect.overlay.services;

import com.nimbusds.jwt.JWTClaimsSet;
import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
import org.mitre.openid.connect.service.impl.DefaultOIDCTokenService;
import org.springframework.security.oauth2.provider.OAuth2Request;

import java.util.Set;

public class CHOIDCTokenService extends DefaultOIDCTokenService {

    private final CHUserDetailsService chUserDetailsService;

    public CHOIDCTokenService(CHUserDetailsService chUserDetailsService) {
        this.chUserDetailsService = chUserDetailsService;
    }

    @Override
    protected void addCustomIdTokenClaims(JWTClaimsSet.Builder idClaims, ClientDetailsEntity client, OAuth2Request request, String sub, OAuth2AccessTokenEntity accessToken) {
        Set<String> ldapGroups = chUserDetailsService.loadUserBySubject(sub).getLdapGroups();
        idClaims.claim("ldap_groups", ldapGroups);
    }

}

<|edits_diff|>
--- wisvch-connect-overlay/src/main/java/ch/wisv/connect/overlay/services/CHOIDCTokenService.java
+++ wisvch-connect-overlay/src/main/java/ch/wisv/connect/overlay/services/CHOIDCTokenService.java
@@ -4,6 +4,7 @@
 import org.mitre.oauth2.model.ClientDetailsEntity;
 import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
 import org.mitre.openid.connect.service.impl.DefaultOIDCTokenService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.oauth2.provider.OAuth2Request;

 import java.util.Set;
<|current_version|>
package ch.wisv.connect.overlay.services;

import com.nimbusds.jwt.JWTClaimsSet;
import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
import org.mitre.openid.connect.service.impl.DefaultOIDCTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.OAuth2Request;

import java.util.Set;

public class CHOIDCTokenService extends DefaultOIDCTokenService {

    private final CHUserDetailsService chUserDetailsService;

    public CHOIDCTokenService(CHUserDetailsService chUserDetailsService) {
        this.chUserDetailsService = chUserDetailsService;
    }

    @Override
    protected void addCustomIdTokenClaims(JWTClaimsSet.Builder idClaims, ClientDetailsEntity client, OAuth2Request request, String sub, OAuth2AccessTokenEntity accessToken) {
        Set<String> ldapGroups = chUserDetailsService.loadUserBySubject(sub).getLdapGroups();
        idClaims.claim("ldap_groups", ldapGroups);
    }

}

<|next_version|>
package ch.wisv.connect.overlay.services;

import com.nimbusds.jwt.JWTClaimsSet;
import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
import org.mitre.openid.connect.service.impl.DefaultOIDCTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.provider.OAuth2Request;

import java.util.Set;

public class CHOIDCTokenService extends DefaultOIDCTokenService {

    private final CHUserDetailsService chUserDetailsService;

    @Autowired
    public CHOIDCTokenService(CHUserDetailsService chUserDetailsService) {
        this.chUserDetailsService = chUserDetailsService;
    }

    @Override
    protected void addCustomIdTokenClaims(JWTClaimsSet.Builder idClaims, ClientDetailsEntity client, OAuth2Request request, String sub, OAuth2AccessTokenEntity accessToken) {
        Set<String> ldapGroups = chUserDetailsService.loadUserBySubject(sub).getLdapGroups();
        idClaims.claim("ldap_groups", ldapGroups);
    }

}


Add additional condition to transaction time PDF test

--- src/java/bps-data-generator/src/test/java/com/github/rnowling/bps/datagenerator/generators/transaction/TestTransactionTimePDF.java
+++ src/java/bps-data-generator/src/test/java/com/github/rnowling/bps/datagenerator/generators/transaction/TestTransactionTimePDF.java
@@ -13,6 +13,7 @@
 		TransactionTimePDF pdf = new TransactionTimePDF();

 		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
+		assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
 		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
 	}

@@ -22,6 +23,7 @@
 		TransactionTimePDF pdf = new TransactionTimePDF();

 		assertEquals(pdf.fixConditional(0.75).probability(0.5), 0.0, 0.000001);
+		assertEquals(pdf.fixConditional(0.5).probability(0.5), 1.0, 0.000001);
 		assertEquals(pdf.fixConditional(0.5).probability(0.75), 1.0, 0.000001);
 	}

<|original_code|>
package com.github.rnowling.bps.datagenerator.generators.transaction;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class TestTransactionTimePDF
{

	@Test
	public void testProbability() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
	}

	@Test
	public void testFixConditional() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.fixConditional(0.75).probability(0.5), 0.0, 0.000001);
		assertEquals(pdf.fixConditional(0.5).probability(0.75), 1.0, 0.000001);
	}

}

<|edits_diff|>
--- src/java/bps-data-generator/src/test/java/com/github/rnowling/bps/datagenerator/generators/transaction/TestTransactionTimePDF.java
+++ src/java/bps-data-generator/src/test/java/com/github/rnowling/bps/datagenerator/generators/transaction/TestTransactionTimePDF.java
@@ -13,6 +13,7 @@
 		TransactionTimePDF pdf = new TransactionTimePDF();

 		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
+		assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
 		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
 	}

<|current_version|>
package com.github.rnowling.bps.datagenerator.generators.transaction;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class TestTransactionTimePDF
{

	@Test
	public void testProbability() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
		assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
	}

	@Test
	public void testFixConditional() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.fixConditional(0.75).probability(0.5), 0.0, 0.000001);
		assertEquals(pdf.fixConditional(0.5).probability(0.75), 1.0, 0.000001);
	}

}

<|next_version|>
package com.github.rnowling.bps.datagenerator.generators.transaction;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class TestTransactionTimePDF
{

	@Test
	public void testProbability() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.probability(0.5, 0.75), 0.0, 0.000001);
		assertEquals(pdf.probability(0.5, 0.5), 1.0, 0.000001);
		assertEquals(pdf.probability(0.75, 0.5), 1.0, 0.000001);
	}

	@Test
	public void testFixConditional() throws Exception
	{
		TransactionTimePDF pdf = new TransactionTimePDF();

		assertEquals(pdf.fixConditional(0.75).probability(0.5), 0.0, 0.000001);
		assertEquals(pdf.fixConditional(0.5).probability(0.5), 1.0, 0.000001);
		assertEquals(pdf.fixConditional(0.5).probability(0.75), 1.0, 0.000001);
	}

}


Set default output to root

Set default output to root

--- YouGet.java
+++ YouGet.java
@@ -21,7 +21,11 @@
 		}
 	}

+	/**
+	 * Set the default output path to the root.
+	 */
 	YouGet() {
+		this.outputPath = "/";
 	}

 	YouGet(String outputPath) {

<|original_code|>
import java.io.File;

/**
 * Each instance of this class represents a You-Get process.
 *
 * @author Zhen Chen
 *
 */

public class YouGet implements Downloader {
	private static final String LOCATION = "E:/软件/You-Get/";
	private static String executable;
	private String outputPath;
	private String outputFilename;

	public static final void setExecutable() throws NoExecutableFileFoundException {
		try {
			executable = Helper.getFirstExecutablePath(LOCATION);
		} catch (NoExecutableFileFoundException e) {
			throw new NoExecutableFileFoundException("No YouGet program found in the given path: " + LOCATION, e);
		}
	}

	YouGet() {
	}

	YouGet(String outputPath) {
		this.outputPath = outputPath;
	}

	public static final String getLocation() {
		return LOCATION;
	}

	public static final String getExecutable() {
		return executable;
	}

	public void download() {
		// TODO
	}

}

<|edits_diff|>
--- YouGet.java
+++ YouGet.java
@@ -21,6 +21,9 @@
 		}
 	}

+	/**
+	 * Set the default output path to the root.
+	 */
 	YouGet() {
 	}

<|current_version|>
import java.io.File;

/**
 * Each instance of this class represents a You-Get process.
 *
 * @author Zhen Chen
 *
 */

public class YouGet implements Downloader {
	private static final String LOCATION = "E:/软件/You-Get/";
	private static String executable;
	private String outputPath;
	private String outputFilename;

	public static final void setExecutable() throws NoExecutableFileFoundException {
		try {
			executable = Helper.getFirstExecutablePath(LOCATION);
		} catch (NoExecutableFileFoundException e) {
			throw new NoExecutableFileFoundException("No YouGet program found in the given path: " + LOCATION, e);
		}
	}

	/**
	 * Set the default output path to the root.
	 */
	YouGet() {
	}

	YouGet(String outputPath) {
		this.outputPath = outputPath;
	}

	public static final String getLocation() {
		return LOCATION;
	}

	public static final String getExecutable() {
		return executable;
	}

	public void download() {
		// TODO
	}

}

<|next_version|>
import java.io.File;

/**
 * Each instance of this class represents a You-Get process.
 *
 * @author Zhen Chen
 *
 */

public class YouGet implements Downloader {
	private static final String LOCATION = "E:/软件/You-Get/";
	private static String executable;
	private String outputPath;
	private String outputFilename;

	public static final void setExecutable() throws NoExecutableFileFoundException {
		try {
			executable = Helper.getFirstExecutablePath(LOCATION);
		} catch (NoExecutableFileFoundException e) {
			throw new NoExecutableFileFoundException("No YouGet program found in the given path: " + LOCATION, e);
		}
	}

	/**
	 * Set the default output path to the root.
	 */
	YouGet() {
		this.outputPath = "/";
	}

	YouGet(String outputPath) {
		this.outputPath = outputPath;
	}

	public static final String getLocation() {
		return LOCATION;
	}

	public static final String getExecutable() {
		return executable;
	}

	public void download() {
		// TODO
	}

}


Increase watermark by one everytime when an entry is written

--- src/main/java/uk/gov/DestinationPostgresDB.java
+++ src/main/java/uk/gov/DestinationPostgresDB.java
@@ -20,10 +20,15 @@

     public void write(ResultSet resultSet) throws SQLException {
         while (resultSet.next()) {
+            connection.setAutoCommit(false);
             try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + indexedEntriesTableName + "(ENTRY) VALUES(?)")) {
                 statement.setObject(1, jsonbObject(resultSet.getBytes("ENTRY")));
                 statement.executeUpdate();
             }
+            try (PreparedStatement statement = connection.prepareStatement("UPDATE " + waterMarkTableName + " SET ID = ID + 1")) {
+                statement.executeUpdate();
+            }
+            connection.setAutoCommit(true);
         }
     }

<|original_code|>
package uk.gov;

import org.postgresql.util.PGobject;

import java.nio.charset.Charset;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

class DestinationPostgresDB extends PostgresDB {
    private final String indexedEntriesTableName;
    private final String waterMarkTableName;

    public DestinationPostgresDB(String connectionString) throws SQLException {
        super(connectionString);
        this.indexedEntriesTableName = "ordered_entry_index";
        this.waterMarkTableName = "streamed_entries";
    }

    public void write(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + indexedEntriesTableName + "(ENTRY) VALUES(?)")) {
                statement.setObject(1, jsonbObject(resultSet.getBytes("ENTRY")));
                statement.executeUpdate();
            }
        }
    }

    public int currentWaterMark() throws SQLException {
        try (Statement statement = connection.createStatement()) {
            try(ResultSet resultSet = statement.executeQuery("SELECT ID FROM " + waterMarkTableName)){
                return resultSet.next() ? resultSet.getInt("ID") : 0;
            }
        }
    }

    private PGobject jsonbObject(byte[] value) {
        try {
            PGobject pGobject = new PGobject();
            pGobject.setType("jsonb");
            pGobject.setValue(new String(value, Charset.forName("UTF-8")));
            return pGobject;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}

<|edits_diff|>
--- src/main/java/uk/gov/DestinationPostgresDB.java
+++ src/main/java/uk/gov/DestinationPostgresDB.java
@@ -20,6 +20,7 @@

     public void write(ResultSet resultSet) throws SQLException {
         while (resultSet.next()) {
+            connection.setAutoCommit(false);
             try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + indexedEntriesTableName + "(ENTRY) VALUES(?)")) {
                 statement.setObject(1, jsonbObject(resultSet.getBytes("ENTRY")));
                 statement.executeUpdate();
<|current_version|>
package uk.gov;

import org.postgresql.util.PGobject;

import java.nio.charset.Charset;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

class DestinationPostgresDB extends PostgresDB {
    private final String indexedEntriesTableName;
    private final String waterMarkTableName;

    public DestinationPostgresDB(String connectionString) throws SQLException {
        super(connectionString);
        this.indexedEntriesTableName = "ordered_entry_index";
        this.waterMarkTableName = "streamed_entries";
    }

    public void write(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            connection.setAutoCommit(false);
            try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + indexedEntriesTableName + "(ENTRY) VALUES(?)")) {
                statement.setObject(1, jsonbObject(resultSet.getBytes("ENTRY")));
                statement.executeUpdate();
            }
        }
    }

    public int currentWaterMark() throws SQLException {
        try (Statement statement = connection.createStatement()) {
            try(ResultSet resultSet = statement.executeQuery("SELECT ID FROM " + waterMarkTableName)){
                return resultSet.next() ? resultSet.getInt("ID") : 0;
            }
        }
    }

    private PGobject jsonbObject(byte[] value) {
        try {
            PGobject pGobject = new PGobject();
            pGobject.setType("jsonb");
            pGobject.setValue(new String(value, Charset.forName("UTF-8")));
            return pGobject;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}

<|next_version|>
package uk.gov;

import org.postgresql.util.PGobject;

import java.nio.charset.Charset;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

class DestinationPostgresDB extends PostgresDB {
    private final String indexedEntriesTableName;
    private final String waterMarkTableName;

    public DestinationPostgresDB(String connectionString) throws SQLException {
        super(connectionString);
        this.indexedEntriesTableName = "ordered_entry_index";
        this.waterMarkTableName = "streamed_entries";
    }

    public void write(ResultSet resultSet) throws SQLException {
        while (resultSet.next()) {
            connection.setAutoCommit(false);
            try (PreparedStatement statement = connection.prepareStatement("INSERT INTO " + indexedEntriesTableName + "(ENTRY) VALUES(?)")) {
                statement.setObject(1, jsonbObject(resultSet.getBytes("ENTRY")));
                statement.executeUpdate();
            }
            try (PreparedStatement statement = connection.prepareStatement("UPDATE " + waterMarkTableName + " SET ID = ID + 1")) {
                statement.executeUpdate();
            }
            connection.setAutoCommit(true);
        }
    }

    public int currentWaterMark() throws SQLException {
        try (Statement statement = connection.createStatement()) {
            try(ResultSet resultSet = statement.executeQuery("SELECT ID FROM " + waterMarkTableName)){
                return resultSet.next() ? resultSet.getInt("ID") : 0;
            }
        }
    }

    private PGobject jsonbObject(byte[] value) {
        try {
            PGobject pGobject = new PGobject();
            pGobject.setType("jsonb");
            pGobject.setValue(new String(value, Charset.forName("UTF-8")));
            return pGobject;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}


Add useful addAll() metric to the suite

Add useful addAll() metric to the suite

--- parfait-core/src/main/java/com/custardsource/parfait/timing/ThreadMetricSuite.java
+++ parfait-core/src/main/java/com/custardsource/parfait/timing/ThreadMetricSuite.java
@@ -1,6 +1,7 @@
 package com.custardsource.parfait.timing;

 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;

@@ -11,6 +12,10 @@
     public final void addMetric(ThreadMetric metric) {
         metrics.add(metric);
     }
+
+    public final void addAllMetrics(Collection<ThreadMetric> metrics) {
+        metrics.addAll(metrics);
+    }

     public final List<ThreadMetric> metrics() {
         return Collections.unmodifiableList(metrics);

<|original_code|>
package com.custardsource.parfait.timing;

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

public class ThreadMetricSuite {
    private final List<ThreadMetric> metrics = new ArrayList<ThreadMetric>(StandardThreadMetrics
            .defaults());

    public final void addMetric(ThreadMetric metric) {
        metrics.add(metric);
    }

    public final List<ThreadMetric> metrics() {
        return Collections.unmodifiableList(metrics);
    }

}

<|edits_diff|>
--- parfait-core/src/main/java/com/custardsource/parfait/timing/ThreadMetricSuite.java
+++ parfait-core/src/main/java/com/custardsource/parfait/timing/ThreadMetricSuite.java
@@ -1,6 +1,7 @@
 package com.custardsource.parfait.timing;

 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;

<|current_version|>
package com.custardsource.parfait.timing;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class ThreadMetricSuite {
    private final List<ThreadMetric> metrics = new ArrayList<ThreadMetric>(StandardThreadMetrics
            .defaults());

    public final void addMetric(ThreadMetric metric) {
        metrics.add(metric);
    }

    public final List<ThreadMetric> metrics() {
        return Collections.unmodifiableList(metrics);
    }

}

<|next_version|>
package com.custardsource.parfait.timing;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class ThreadMetricSuite {
    private final List<ThreadMetric> metrics = new ArrayList<ThreadMetric>(StandardThreadMetrics
            .defaults());

    public final void addMetric(ThreadMetric metric) {
        metrics.add(metric);
    }

    public final void addAllMetrics(Collection<ThreadMetric> metrics) {
        metrics.addAll(metrics);
    }

    public final List<ThreadMetric> metrics() {
        return Collections.unmodifiableList(metrics);
    }

}


Add shutdown code for logback's async appender

--- basearch-webapp/src/main/java/basearch/integration/ApplicationInitializerListener.java
+++ basearch-webapp/src/main/java/basearch/integration/ApplicationInitializerListener.java
@@ -5,6 +5,7 @@

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.LoggerContext;

 public class ApplicationInitializerListener implements ServletContextListener {

@@ -13,6 +14,8 @@
 	@Override
 	public void contextDestroyed(ServletContextEvent arg0) {
 		logger.debug("Shutting down application...");
+		// logback's async appender shutdown
+		((LoggerContext)LoggerFactory.getILoggerFactory()).stop();
 	}

 	@Override

<|original_code|>
 package basearch.integration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

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

public class ApplicationInitializerListener implements ServletContextListener {

	private static final Logger logger = LoggerFactory.getLogger(ApplicationInitializerListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		logger.debug("Shutting down application...");
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		logger.debug("Starting up application...");
	}

}

<|edits_diff|>
--- basearch-webapp/src/main/java/basearch/integration/ApplicationInitializerListener.java
+++ basearch-webapp/src/main/java/basearch/integration/ApplicationInitializerListener.java
@@ -5,6 +5,7 @@

 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.LoggerContext;

 public class ApplicationInitializerListener implements ServletContextListener {

<|current_version|>
 package basearch.integration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;

public class ApplicationInitializerListener implements ServletContextListener {

	private static final Logger logger = LoggerFactory.getLogger(ApplicationInitializerListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		logger.debug("Shutting down application...");
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		logger.debug("Starting up application...");
	}

}

<|next_version|>
 package basearch.integration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;

public class ApplicationInitializerListener implements ServletContextListener {

	private static final Logger logger = LoggerFactory.getLogger(ApplicationInitializerListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		logger.debug("Shutting down application...");
		// logback's async appender shutdown
		((LoggerContext)LoggerFactory.getILoggerFactory()).stop();
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		logger.debug("Starting up application...");
	}

}


Add logging when flavors are updated

Add logging when flavors are updated

--- storage-controller-lib/src/main/java/enmasse/storage/controller/admin/FlavorManager.java
+++ storage-controller-lib/src/main/java/enmasse/storage/controller/admin/FlavorManager.java
@@ -7,12 +7,15 @@
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.stream.Collectors;

 /**
  * @author Ulf Lilleengen
  */
 public class FlavorManager implements ConfigManager, FlavorRepository {
+    private static final Logger log = Logger.getLogger(FlavorManager.class.getName());
     private volatile Map<String, FlavorConfig> flavorMap = Collections.emptyMap();
     private final FlavorConfigParser parser = new FlavorConfigParser();

@@ -38,5 +41,10 @@

     public void configUpdated(Map<String, FlavorConfig> flavorMap) {
         this.flavorMap = flavorMap;
+        if (log.isLoggable(Level.INFO)) {
+            String flavors = flavorMap.keySet().stream().collect(Collectors.joining(","));
+            log.log(Level.INFO, String.format("Got new set of flavors: [%s]", flavors));
+        }
+
     }
 }

<|original_code|>
package enmasse.storage.controller.admin;

import com.fasterxml.jackson.databind.JsonNode;
import enmasse.storage.controller.model.FlavorConfig;
import enmasse.storage.controller.model.parser.FlavorConfigParser;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author Ulf Lilleengen
 */
public class FlavorManager implements ConfigManager, FlavorRepository {
    private volatile Map<String, FlavorConfig> flavorMap = Collections.emptyMap();
    private final FlavorConfigParser parser = new FlavorConfigParser();

    @Override
    public FlavorConfig getFlavor(String flavorName) {
        FlavorConfig flavor = flavorMap.get(flavorName);
        if (flavor == null) {
            String flavors = flavorMap.keySet().stream().collect(Collectors.joining(","));
            throw new IllegalArgumentException(String.format("No flavor with name '%s' exists, have [%s]", flavorName, flavors));
        }
        return flavor;
    }

    @Override
    public FlavorConfig getDefaultFlavor() {
        return new FlavorConfig.Builder().build();
    }

    @Override
    public void configUpdated(JsonNode jsonConfig) throws IOException {
        configUpdated(parser.parse(jsonConfig));
    }

    public void configUpdated(Map<String, FlavorConfig> flavorMap) {
        this.flavorMap = flavorMap;
    }
}

<|edits_diff|>
--- storage-controller-lib/src/main/java/enmasse/storage/controller/admin/FlavorManager.java
+++ storage-controller-lib/src/main/java/enmasse/storage/controller/admin/FlavorManager.java
@@ -7,12 +7,15 @@
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.stream.Collectors;

 /**
  * @author Ulf Lilleengen
  */
 public class FlavorManager implements ConfigManager, FlavorRepository {
+    private static final Logger log = Logger.getLogger(FlavorManager.class.getName());
     private volatile Map<String, FlavorConfig> flavorMap = Collections.emptyMap();
     private final FlavorConfigParser parser = new FlavorConfigParser();

<|current_version|>
package enmasse.storage.controller.admin;

import com.fasterxml.jackson.databind.JsonNode;
import enmasse.storage.controller.model.FlavorConfig;
import enmasse.storage.controller.model.parser.FlavorConfigParser;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

/**
 * @author Ulf Lilleengen
 */
public class FlavorManager implements ConfigManager, FlavorRepository {
    private static final Logger log = Logger.getLogger(FlavorManager.class.getName());
    private volatile Map<String, FlavorConfig> flavorMap = Collections.emptyMap();
    private final FlavorConfigParser parser = new FlavorConfigParser();

    @Override
    public FlavorConfig getFlavor(String flavorName) {
        FlavorConfig flavor = flavorMap.get(flavorName);
        if (flavor == null) {
            String flavors = flavorMap.keySet().stream().collect(Collectors.joining(","));
            throw new IllegalArgumentException(String.format("No flavor with name '%s' exists, have [%s]", flavorName, flavors));
        }
        return flavor;
    }

    @Override
    public FlavorConfig getDefaultFlavor() {
        return new FlavorConfig.Builder().build();
    }

    @Override
    public void configUpdated(JsonNode jsonConfig) throws IOException {
        configUpdated(parser.parse(jsonConfig));
    }

    public void configUpdated(Map<String, FlavorConfig> flavorMap) {
        this.flavorMap = flavorMap;
    }
}

<|next_version|>
package enmasse.storage.controller.admin;

import com.fasterxml.jackson.databind.JsonNode;
import enmasse.storage.controller.model.FlavorConfig;
import enmasse.storage.controller.model.parser.FlavorConfigParser;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;

/**
 * @author Ulf Lilleengen
 */
public class FlavorManager implements ConfigManager, FlavorRepository {
    private static final Logger log = Logger.getLogger(FlavorManager.class.getName());
    private volatile Map<String, FlavorConfig> flavorMap = Collections.emptyMap();
    private final FlavorConfigParser parser = new FlavorConfigParser();

    @Override
    public FlavorConfig getFlavor(String flavorName) {
        FlavorConfig flavor = flavorMap.get(flavorName);
        if (flavor == null) {
            String flavors = flavorMap.keySet().stream().collect(Collectors.joining(","));
            throw new IllegalArgumentException(String.format("No flavor with name '%s' exists, have [%s]", flavorName, flavors));
        }
        return flavor;
    }

    @Override
    public FlavorConfig getDefaultFlavor() {
        return new FlavorConfig.Builder().build();
    }

    @Override
    public void configUpdated(JsonNode jsonConfig) throws IOException {
        configUpdated(parser.parse(jsonConfig));
    }

    public void configUpdated(Map<String, FlavorConfig> flavorMap) {
        this.flavorMap = flavorMap;
        if (log.isLoggable(Level.INFO)) {
            String flavors = flavorMap.keySet().stream().collect(Collectors.joining(","));
            log.log(Level.INFO, String.format("Got new set of flavors: [%s]", flavors));
        }

    }
}


Fix to bracket ordering in tree representation

--- java/upparse/corpus/UnlabeledBracket.java
+++ java/upparse/corpus/UnlabeledBracket.java
@@ -41,7 +41,9 @@
     if (o == null) throw new NullPointerException();
     else if (last < o.first) return -1;
     else if (o.last < first) return 1;
+    else if (o.first == first && last == o.last) return 0;
     else if (o.first <= first && last <= o.last) return -1;
+    else if (first <= o.first && o.last <= last) return 1;
     else return 0;
   }

<|original_code|>
package upparse.corpus;

/**
 * Data structure representing a bracket, not including a category label
 * @author eponvert@utexas.edu (Elias Ponvert)
 */
public class UnlabeledBracket implements Comparable<UnlabeledBracket> {

  private final int first, last;

  public UnlabeledBracket(final int _first, final int _last) {
    first = _first;
    last = _last;
  }

  @Override
  public boolean equals(Object obj) {
    final UnlabeledBracket b = (UnlabeledBracket) obj;
    return first == b.first && last == b.last;
  }

  @Override
  public int hashCode() {
    return 37 * first + last;
  }

  public int getFirst() {
    return first;
  }

  public int getLast() {
    return last;
  }

  public int len() {
    return last - first;
  }

  @Override
  public int compareTo(UnlabeledBracket o) {
    if (o == null) throw new NullPointerException();
    else if (last < o.first) return -1;
    else if (o.last < first) return 1;
    else if (o.first <= first && last <= o.last) return -1;
    else return 0;
  }

  public boolean contains(UnlabeledBracket b) {
    return first <= b.first && b.last <= last;
  }

  @Override
  public String toString() {
    return String.format("[%d,%d]", first, last);
  }
}

<|edits_diff|>
--- java/upparse/corpus/UnlabeledBracket.java
+++ java/upparse/corpus/UnlabeledBracket.java
@@ -41,6 +41,7 @@
     if (o == null) throw new NullPointerException();
     else if (last < o.first) return -1;
     else if (o.last < first) return 1;
+    else if (o.first == first && last == o.last) return 0;
     else if (o.first <= first && last <= o.last) return -1;
     else return 0;
   }
<|current_version|>
package upparse.corpus;

/**
 * Data structure representing a bracket, not including a category label
 * @author eponvert@utexas.edu (Elias Ponvert)
 */
public class UnlabeledBracket implements Comparable<UnlabeledBracket> {

  private final int first, last;

  public UnlabeledBracket(final int _first, final int _last) {
    first = _first;
    last = _last;
  }

  @Override
  public boolean equals(Object obj) {
    final UnlabeledBracket b = (UnlabeledBracket) obj;
    return first == b.first && last == b.last;
  }

  @Override
  public int hashCode() {
    return 37 * first + last;
  }

  public int getFirst() {
    return first;
  }

  public int getLast() {
    return last;
  }

  public int len() {
    return last - first;
  }

  @Override
  public int compareTo(UnlabeledBracket o) {
    if (o == null) throw new NullPointerException();
    else if (last < o.first) return -1;
    else if (o.last < first) return 1;
    else if (o.first == first && last == o.last) return 0;
    else if (o.first <= first && last <= o.last) return -1;
    else return 0;
  }

  public boolean contains(UnlabeledBracket b) {
    return first <= b.first && b.last <= last;
  }

  @Override
  public String toString() {
    return String.format("[%d,%d]", first, last);
  }
}

<|next_version|>
package upparse.corpus;

/**
 * Data structure representing a bracket, not including a category label
 * @author eponvert@utexas.edu (Elias Ponvert)
 */
public class UnlabeledBracket implements Comparable<UnlabeledBracket> {

  private final int first, last;

  public UnlabeledBracket(final int _first, final int _last) {
    first = _first;
    last = _last;
  }

  @Override
  public boolean equals(Object obj) {
    final UnlabeledBracket b = (UnlabeledBracket) obj;
    return first == b.first && last == b.last;
  }

  @Override
  public int hashCode() {
    return 37 * first + last;
  }

  public int getFirst() {
    return first;
  }

  public int getLast() {
    return last;
  }

  public int len() {
    return last - first;
  }

  @Override
  public int compareTo(UnlabeledBracket o) {
    if (o == null) throw new NullPointerException();
    else if (last < o.first) return -1;
    else if (o.last < first) return 1;
    else if (o.first == first && last == o.last) return 0;
    else if (o.first <= first && last <= o.last) return -1;
    else if (first <= o.first && o.last <= last) return 1;
    else return 0;
  }

  public boolean contains(UnlabeledBracket b) {
    return first <= b.first && b.last <= last;
  }

  @Override
  public String toString() {
    return String.format("[%d,%d]", first, last);
  }
}