Add support for DriverManager and JDBC URL-based pool configuration.

--- src/test/java/com/zaxxer/hikari/JdbcDriverTest.java
+++ src/test/java/com/zaxxer/hikari/JdbcDriverTest.java
@@ -15,6 +15,7 @@
  */
 package com.zaxxer.hikari;

+import java.sql.Connection;
 import java.sql.SQLException;

 import org.junit.Test;
@@ -35,6 +36,8 @@
         config.addDataSourceProperty("password", "simpson");

         HikariDataSource ds = new HikariDataSource(config);
+        Connection connection = ds.getConnection();
+        connection.close();
         ds.shutdown();
     }
 }

<|original_code|>
/*
 * Copyright (C) 2014 Brett Wooldridge
 *
 * 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.zaxxer.hikari;

import java.sql.SQLException;

import org.junit.Test;

public class JdbcDriverTest
{
    @Test
    public void driverTest1() throws SQLException
    {
        HikariConfig config = new HikariConfig();
        config.setMinimumPoolSize(1);
        config.setMaximumPoolSize(1);
        config.setAcquireIncrement(1);
        config.setConnectionTestQuery("VALUES 1");
        config.setDriverClassName("com.zaxxer.hikari.mocks.StubDriver");
        config.setJdbcUrl("jdbc:stub");
        config.addDataSourceProperty("user", "bart");
        config.addDataSourceProperty("password", "simpson");

        HikariDataSource ds = new HikariDataSource(config);
        ds.shutdown();
    }
}

<|edits_diff|>
--- src/test/java/com/zaxxer/hikari/JdbcDriverTest.java
+++ src/test/java/com/zaxxer/hikari/JdbcDriverTest.java
@@ -15,6 +15,7 @@
  */
 package com.zaxxer.hikari;

+import java.sql.Connection;
 import java.sql.SQLException;

 import org.junit.Test;
<|current_version|>
/*
 * Copyright (C) 2014 Brett Wooldridge
 *
 * 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.zaxxer.hikari;

import java.sql.Connection;
import java.sql.SQLException;

import org.junit.Test;

public class JdbcDriverTest
{
    @Test
    public void driverTest1() throws SQLException
    {
        HikariConfig config = new HikariConfig();
        config.setMinimumPoolSize(1);
        config.setMaximumPoolSize(1);
        config.setAcquireIncrement(1);
        config.setConnectionTestQuery("VALUES 1");
        config.setDriverClassName("com.zaxxer.hikari.mocks.StubDriver");
        config.setJdbcUrl("jdbc:stub");
        config.addDataSourceProperty("user", "bart");
        config.addDataSourceProperty("password", "simpson");

        HikariDataSource ds = new HikariDataSource(config);
        ds.shutdown();
    }
}

<|next_version|>
/*
 * Copyright (C) 2014 Brett Wooldridge
 *
 * 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.zaxxer.hikari;

import java.sql.Connection;
import java.sql.SQLException;

import org.junit.Test;

public class JdbcDriverTest
{
    @Test
    public void driverTest1() throws SQLException
    {
        HikariConfig config = new HikariConfig();
        config.setMinimumPoolSize(1);
        config.setMaximumPoolSize(1);
        config.setAcquireIncrement(1);
        config.setConnectionTestQuery("VALUES 1");
        config.setDriverClassName("com.zaxxer.hikari.mocks.StubDriver");
        config.setJdbcUrl("jdbc:stub");
        config.addDataSourceProperty("user", "bart");
        config.addDataSourceProperty("password", "simpson");

        HikariDataSource ds = new HikariDataSource(config);
        Connection connection = ds.getConnection();
        connection.close();
        ds.shutdown();
    }
}


Add results to LoadSessionServlet model.

Each reservation may contain many results. Since clients may
be depending on these results we will want to keep them
constant when loading sessions from the CMS. This means that
results must be included in the model that is used to update
the reservation.

Change-Id: I8318b3866573b71a4e02dbd43541021f78a57f34

--- server/src/main/java/com/google/samples/apps/iosched/server/schedule/reservations/model/Reservation.java
+++ server/src/main/java/com/google/samples/apps/iosched/server/schedule/reservations/model/Reservation.java
@@ -15,6 +15,8 @@
  */
 package com.google.samples.apps.iosched.server.schedule.reservations.model;

+import java.util.Map;
+
 /**
  * Representation of a Reservation object in RTDB.
  */
@@ -22,6 +24,7 @@

   public long last_status_changed;
   public String status;
+  public Map<String, String> results;

   @Override
   public int compareTo(Reservation reservation) {

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

/**
 * Representation of a Reservation object in RTDB.
 */
public class Reservation implements Comparable<Reservation> {

  public long last_status_changed;
  public String status;

  @Override
  public int compareTo(Reservation reservation) {
    if (last_status_changed < reservation.last_status_changed) {
      return -1;
    } else if (last_status_changed > reservation.last_status_changed) {
      return 1;
    }
    return 0;
  }
}

<|edits_diff|>
--- server/src/main/java/com/google/samples/apps/iosched/server/schedule/reservations/model/Reservation.java
+++ server/src/main/java/com/google/samples/apps/iosched/server/schedule/reservations/model/Reservation.java
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 package com.google.samples.apps.iosched.server.schedule.reservations.model;
+
+import java.util.Map;

 /**
  * Representation of a Reservation object in RTDB.
<|current_version|>
/*
 * Copyright 2017 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.samples.apps.iosched.server.schedule.reservations.model;

import java.util.Map;

/**
 * Representation of a Reservation object in RTDB.
 */
public class Reservation implements Comparable<Reservation> {

  public long last_status_changed;
  public String status;

  @Override
  public int compareTo(Reservation reservation) {
    if (last_status_changed < reservation.last_status_changed) {
      return -1;
    } else if (last_status_changed > reservation.last_status_changed) {
      return 1;
    }
    return 0;
  }
}

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

import java.util.Map;

/**
 * Representation of a Reservation object in RTDB.
 */
public class Reservation implements Comparable<Reservation> {

  public long last_status_changed;
  public String status;
  public Map<String, String> results;

  @Override
  public int compareTo(Reservation reservation) {
    if (last_status_changed < reservation.last_status_changed) {
      return -1;
    } else if (last_status_changed > reservation.last_status_changed) {
      return 1;
    }
    return 0;
  }
}


Add a constructor that takes a cause Exception.

git-svn-id: becfadaebdf67c7884f0d18099f2460615305e2e@1638 c76caeb1-94fd-44dd-870f-0c9d92034fc1

--- org/xbill/DNS/WireParseException.java
+++ org/xbill/DNS/WireParseException.java
@@ -22,4 +22,9 @@
 	super(s);
 }

+public
+WireParseException(String s, Throwable cause) {
+	super(s, cause);
 }
+
+}

<|original_code|>
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

import java.io.*;

/**
 * An exception thrown when a DNS message is invalid.
 *
 * @author Brian Wellington
 */

public class WireParseException extends IOException {

public
WireParseException() {
	super();
}

public
WireParseException(String s) {
	super(s);
}

}

<|edits_diff|>
--- org/xbill/DNS/WireParseException.java
+++ org/xbill/DNS/WireParseException.java
@@ -22,4 +22,7 @@
 	super(s);
 }

+public
+WireParseException(String s, Throwable cause) {
+	super(s, cause);
 }
<|current_version|>
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

import java.io.*;

/**
 * An exception thrown when a DNS message is invalid.
 *
 * @author Brian Wellington
 */

public class WireParseException extends IOException {

public
WireParseException() {
	super();
}

public
WireParseException(String s) {
	super(s);
}

public
WireParseException(String s, Throwable cause) {
	super(s, cause);
}

<|next_version|>
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)

package org.xbill.DNS;

import java.io.*;

/**
 * An exception thrown when a DNS message is invalid.
 *
 * @author Brian Wellington
 */

public class WireParseException extends IOException {

public
WireParseException() {
	super();
}

public
WireParseException(String s) {
	super(s);
}

public
WireParseException(String s, Throwable cause) {
	super(s, cause);
}

}


Enable Jackson on jaxrs clients

Enable Jackson on jaxrs clients

--- client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java
+++ client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java
@@ -1,4 +1,6 @@
 package com.opentable.jaxrs;
+
+import com.fasterxml.jackson.databind.ObjectMapper;

 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -23,4 +25,9 @@
     JaxRsFeatureBinding dataUriHandler() {
         return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
     }
+
+    @Bean
+    JaxRsFeatureBinding jsonFeature(ObjectMapper mapper) {
+        return JaxRsFeatureBinding.bindToAllGroups(JsonClientFeature.forMapper(mapper));
+    }
 }

<|original_code|>
package com.opentable.jaxrs;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;

import com.opentable.spring.SpecializedConfigFactory;

@Configuration
public class JaxRsClientConfiguration {

    @Bean
    SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
        return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
    }

    @Bean
    JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
        return new JaxRsClientFactory(config);
    }

    @Bean
    JaxRsFeatureBinding dataUriHandler() {
        return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
    }
}

<|edits_diff|>
--- client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java
+++ client/src/main/java/com/opentable/jaxrs/JaxRsClientConfiguration.java
@@ -1,4 +1,6 @@
 package com.opentable.jaxrs;
+
+import com.fasterxml.jackson.databind.ObjectMapper;

 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
<|current_version|>
package com.opentable.jaxrs;

import com.fasterxml.jackson.databind.ObjectMapper;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;

import com.opentable.spring.SpecializedConfigFactory;

@Configuration
public class JaxRsClientConfiguration {

    @Bean
    SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
        return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
    }

    @Bean
    JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
        return new JaxRsClientFactory(config);
    }

    @Bean
    JaxRsFeatureBinding dataUriHandler() {
        return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
    }
}

<|next_version|>
package com.opentable.jaxrs;

import com.fasterxml.jackson.databind.ObjectMapper;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;

import com.opentable.spring.SpecializedConfigFactory;

@Configuration
public class JaxRsClientConfiguration {

    @Bean
    SpecializedConfigFactory<JaxRsClientConfig> jaxRsConfigFactory(PropertyResolver pr) {
        return SpecializedConfigFactory.create(pr, JaxRsClientConfig.class, "jaxrs.client.${name}");
    }

    @Bean
    JaxRsClientFactory jaxrsClientFactory(SpecializedConfigFactory<JaxRsClientConfig> config) {
        return new JaxRsClientFactory(config);
    }

    @Bean
    JaxRsFeatureBinding dataUriHandler() {
        return JaxRsFeatureBinding.bindToAllGroups(new DataUriFeature());
    }

    @Bean
    JaxRsFeatureBinding jsonFeature(ObjectMapper mapper) {
        return JaxRsFeatureBinding.bindToAllGroups(JsonClientFeature.forMapper(mapper));
    }
}


Add the schematic icon to the starting message.

--- src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java
+++ src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java
@@ -1,12 +1,15 @@
 package com.github.lunatrius.schematica.network.message;

 import com.github.lunatrius.schematica.world.SchematicWorld;
+import cpw.mods.fml.common.network.ByteBufUtils;
 import cpw.mods.fml.common.network.simpleimpl.IMessage;
 import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
 import cpw.mods.fml.common.network.simpleimpl.MessageContext;
 import io.netty.buffer.ByteBuf;
+import net.minecraft.item.ItemStack;

 public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
+    public ItemStack icon;
     public int width;
     public int height;
     public int length;
@@ -15,6 +18,7 @@
     }

     public MessageSchematicBegin(SchematicWorld schematic) {
+        this.icon = schematic.getIcon();
         this.width = schematic.getWidth();
         this.height = schematic.getHeight();
         this.length = schematic.getLength();
@@ -22,6 +26,7 @@

     @Override
     public void fromBytes(ByteBuf buf) {
+        this.icon = ByteBufUtils.readItemStack(buf);
         this.width = buf.readShort();
         this.height = buf.readShort();
         this.length = buf.readShort();
@@ -29,6 +34,7 @@

     @Override
     public void toBytes(ByteBuf buf) {
+        ByteBufUtils.writeItemStack(buf, this.icon);
         buf.writeShort(this.width);
         buf.writeShort(this.height);
         buf.writeShort(this.length);

<|original_code|>
package com.github.lunatrius.schematica.network.message;

import com.github.lunatrius.schematica.world.SchematicWorld;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;

public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
    public int width;
    public int height;
    public int length;

    public MessageSchematicBegin() {
    }

    public MessageSchematicBegin(SchematicWorld schematic) {
        this.width = schematic.getWidth();
        this.height = schematic.getHeight();
        this.length = schematic.getLength();
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        this.width = buf.readShort();
        this.height = buf.readShort();
        this.length = buf.readShort();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeShort(this.width);
        buf.writeShort(this.height);
        buf.writeShort(this.length);
    }

    @Override
    public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) {
        // TODO: implement
        return null;
    }
}

<|edits_diff|>
--- src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java
+++ src/main/java/com/github/lunatrius/schematica/network/message/MessageSchematicBegin.java
@@ -1,12 +1,15 @@
 package com.github.lunatrius.schematica.network.message;

 import com.github.lunatrius.schematica.world.SchematicWorld;
+import cpw.mods.fml.common.network.ByteBufUtils;
 import cpw.mods.fml.common.network.simpleimpl.IMessage;
 import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
 import cpw.mods.fml.common.network.simpleimpl.MessageContext;
 import io.netty.buffer.ByteBuf;
+import net.minecraft.item.ItemStack;

 public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
+    public ItemStack icon;
     public int width;
     public int height;
     public int length;
@@ -15,6 +18,7 @@
     }

     public MessageSchematicBegin(SchematicWorld schematic) {
+        this.icon = schematic.getIcon();
         this.width = schematic.getWidth();
         this.height = schematic.getHeight();
         this.length = schematic.getLength();
@@ -22,6 +26,7 @@

     @Override
     public void fromBytes(ByteBuf buf) {
+        this.icon = ByteBufUtils.readItemStack(buf);
         this.width = buf.readShort();
         this.height = buf.readShort();
         this.length = buf.readShort();
<|current_version|>
package com.github.lunatrius.schematica.network.message;

import com.github.lunatrius.schematica.world.SchematicWorld;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;

public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
    public ItemStack icon;
    public int width;
    public int height;
    public int length;

    public MessageSchematicBegin() {
    }

    public MessageSchematicBegin(SchematicWorld schematic) {
        this.icon = schematic.getIcon();
        this.width = schematic.getWidth();
        this.height = schematic.getHeight();
        this.length = schematic.getLength();
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        this.icon = ByteBufUtils.readItemStack(buf);
        this.width = buf.readShort();
        this.height = buf.readShort();
        this.length = buf.readShort();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        buf.writeShort(this.width);
        buf.writeShort(this.height);
        buf.writeShort(this.length);
    }

    @Override
    public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) {
        // TODO: implement
        return null;
    }
}

<|next_version|>
package com.github.lunatrius.schematica.network.message;

import com.github.lunatrius.schematica.world.SchematicWorld;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;

public class MessageSchematicBegin implements IMessage, IMessageHandler<MessageSchematicBegin, IMessage> {
    public ItemStack icon;
    public int width;
    public int height;
    public int length;

    public MessageSchematicBegin() {
    }

    public MessageSchematicBegin(SchematicWorld schematic) {
        this.icon = schematic.getIcon();
        this.width = schematic.getWidth();
        this.height = schematic.getHeight();
        this.length = schematic.getLength();
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        this.icon = ByteBufUtils.readItemStack(buf);
        this.width = buf.readShort();
        this.height = buf.readShort();
        this.length = buf.readShort();
    }

    @Override
    public void toBytes(ByteBuf buf) {
        ByteBufUtils.writeItemStack(buf, this.icon);
        buf.writeShort(this.width);
        buf.writeShort(this.height);
        buf.writeShort(this.length);
    }

    @Override
    public IMessage onMessage(MessageSchematicBegin message, MessageContext ctx) {
        // TODO: implement
        return null;
    }
}


Add not empty validation annotation.

Add not empty validation annotation.

--- src/test/java/com/github/aureliano/achmed/Model.java
+++ src/test/java/com/github/aureliano/achmed/Model.java
@@ -1,6 +1,8 @@
 package com.github.aureliano.achmed;

+import com.github.aureliano.achmed.annotation.NotEmpty;
 import com.github.aureliano.achmed.annotation.NotNull;
+import com.github.aureliano.achmed.annotation.Pattern;

 public class Model {

@@ -11,6 +13,8 @@
 	}

 	@NotNull
+	@NotEmpty
+	@Pattern(value = "[\\d\\w]{3,5}")
 	public String getId() {
 		return this.id;
 	}

<|original_code|>
package com.github.aureliano.achmed;

import com.github.aureliano.achmed.annotation.NotNull;

public class Model {

	private String id;

	public Model() {
		super();
	}

	@NotNull
	public String getId() {
		return this.id;
	}

	public Model withId(String id) {
		this.id = id;
		return this;
	}
}
<|edits_diff|>
--- src/test/java/com/github/aureliano/achmed/Model.java
+++ src/test/java/com/github/aureliano/achmed/Model.java
@@ -1,6 +1,8 @@
 package com.github.aureliano.achmed;

+import com.github.aureliano.achmed.annotation.NotEmpty;
 import com.github.aureliano.achmed.annotation.NotNull;
+import com.github.aureliano.achmed.annotation.Pattern;

 public class Model {

<|current_version|>
package com.github.aureliano.achmed;

import com.github.aureliano.achmed.annotation.NotEmpty;
import com.github.aureliano.achmed.annotation.NotNull;
import com.github.aureliano.achmed.annotation.Pattern;

public class Model {

	private String id;

	public Model() {
		super();
	}

	@NotNull
	public String getId() {
		return this.id;
	}

	public Model withId(String id) {
		this.id = id;
		return this;
	}
}
<|next_version|>
package com.github.aureliano.achmed;

import com.github.aureliano.achmed.annotation.NotEmpty;
import com.github.aureliano.achmed.annotation.NotNull;
import com.github.aureliano.achmed.annotation.Pattern;

public class Model {

	private String id;

	public Model() {
		super();
	}

	@NotNull
	@NotEmpty
	@Pattern(value = "[\\d\\w]{3,5}")
	public String getId() {
		return this.id;
	}

	public Model withId(String id) {
		this.id = id;
		return this;
	}
}


FIX BUILD: Unit test assumed polycom authid was first visible on page

git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@7583 a612230a-c5fa-0310-af8b-88eea846685b

--- sipXconfig/web/test/org/sipfoundry/sipxconfig/site/phone/polycom/PasswordSettingTestUi.java
+++ sipXconfig/web/test/org/sipfoundry/sipxconfig/site/phone/polycom/PasswordSettingTestUi.java
@@ -39,9 +39,11 @@

     public void testEditSipSetttings() {
         m_helper.seedLine(1);
+        SiteTestHelper.setScriptingEnabled(true);
         clickLink("ManagePhones");
         clickLinkWithText(SiteTestHelper.TEST_USER);
         clickLinkWithText("Registration");
+        clickLink("setting:toggle");
         Element passwordField = getDialog().getElement("setting:auth.password");
         assertEquals("password", passwordField.getAttribute("type"));
     }

<|original_code|>
/*
 *
 *
 * Copyright (C) 2004 SIPfoundry Inc.
 * Licensed by SIPfoundry under the LGPL license.
 *
 * Copyright (C) 2004 Pingtel Corp.
 * Licensed to SIPfoundry under a Contributor Agreement.
 *
 * $
 */
package org.sipfoundry.sipxconfig.site.phone.polycom;

import junit.framework.Test;
import net.sourceforge.jwebunit.WebTestCase;

import org.sipfoundry.sipxconfig.site.SiteTestHelper;
import org.sipfoundry.sipxconfig.site.phone.PhoneTestHelper;
import org.w3c.dom.Element;

public class PasswordSettingTestUi extends WebTestCase {

    private PhoneTestHelper m_helper;

    public static Test suite() throws Exception {
        return SiteTestHelper.webTestSuite(PasswordSettingTestUi.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        getTestContext().setBaseUrl(SiteTestHelper.getBaseUrl());
        m_helper = new PhoneTestHelper(tester);
        m_helper.reset();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testEditSipSetttings() {
        m_helper.seedLine(1);
        clickLink("ManagePhones");
        clickLinkWithText(SiteTestHelper.TEST_USER);
        clickLinkWithText("Registration");
        Element passwordField = getDialog().getElement("setting:auth.password");
        assertEquals("password", passwordField.getAttribute("type"));
    }
}

<|edits_diff|>
--- sipXconfig/web/test/org/sipfoundry/sipxconfig/site/phone/polycom/PasswordSettingTestUi.java
+++ sipXconfig/web/test/org/sipfoundry/sipxconfig/site/phone/polycom/PasswordSettingTestUi.java
@@ -39,6 +39,7 @@

     public void testEditSipSetttings() {
         m_helper.seedLine(1);
+        SiteTestHelper.setScriptingEnabled(true);
         clickLink("ManagePhones");
         clickLinkWithText(SiteTestHelper.TEST_USER);
         clickLinkWithText("Registration");
<|current_version|>
/*
 *
 *
 * Copyright (C) 2004 SIPfoundry Inc.
 * Licensed by SIPfoundry under the LGPL license.
 *
 * Copyright (C) 2004 Pingtel Corp.
 * Licensed to SIPfoundry under a Contributor Agreement.
 *
 * $
 */
package org.sipfoundry.sipxconfig.site.phone.polycom;

import junit.framework.Test;
import net.sourceforge.jwebunit.WebTestCase;

import org.sipfoundry.sipxconfig.site.SiteTestHelper;
import org.sipfoundry.sipxconfig.site.phone.PhoneTestHelper;
import org.w3c.dom.Element;

public class PasswordSettingTestUi extends WebTestCase {

    private PhoneTestHelper m_helper;

    public static Test suite() throws Exception {
        return SiteTestHelper.webTestSuite(PasswordSettingTestUi.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        getTestContext().setBaseUrl(SiteTestHelper.getBaseUrl());
        m_helper = new PhoneTestHelper(tester);
        m_helper.reset();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testEditSipSetttings() {
        m_helper.seedLine(1);
        SiteTestHelper.setScriptingEnabled(true);
        clickLink("ManagePhones");
        clickLinkWithText(SiteTestHelper.TEST_USER);
        clickLinkWithText("Registration");
        Element passwordField = getDialog().getElement("setting:auth.password");
        assertEquals("password", passwordField.getAttribute("type"));
    }
}

<|next_version|>
/*
 *
 *
 * Copyright (C) 2004 SIPfoundry Inc.
 * Licensed by SIPfoundry under the LGPL license.
 *
 * Copyright (C) 2004 Pingtel Corp.
 * Licensed to SIPfoundry under a Contributor Agreement.
 *
 * $
 */
package org.sipfoundry.sipxconfig.site.phone.polycom;

import junit.framework.Test;
import net.sourceforge.jwebunit.WebTestCase;

import org.sipfoundry.sipxconfig.site.SiteTestHelper;
import org.sipfoundry.sipxconfig.site.phone.PhoneTestHelper;
import org.w3c.dom.Element;

public class PasswordSettingTestUi extends WebTestCase {

    private PhoneTestHelper m_helper;

    public static Test suite() throws Exception {
        return SiteTestHelper.webTestSuite(PasswordSettingTestUi.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        getTestContext().setBaseUrl(SiteTestHelper.getBaseUrl());
        m_helper = new PhoneTestHelper(tester);
        m_helper.reset();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    public void testEditSipSetttings() {
        m_helper.seedLine(1);
        SiteTestHelper.setScriptingEnabled(true);
        clickLink("ManagePhones");
        clickLinkWithText(SiteTestHelper.TEST_USER);
        clickLinkWithText("Registration");
        clickLink("setting:toggle");
        Element passwordField = getDialog().getElement("setting:auth.password");
        assertEquals("password", passwordField.getAttribute("type"));
    }
}


Add back in missing auto config for galaxy integration tests.

--- src/test/java/ca/corefacility/bioinformatics/irida/annotation/GalaxyIntegrationTest.java
+++ src/test/java/ca/corefacility/bioinformatics/irida/annotation/GalaxyIntegrationTest.java
@@ -9,6 +9,7 @@

 import org.junit.jupiter.api.Tag;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;

@@ -30,6 +31,7 @@
 @ActiveProfiles("test")
 @SpringBootTest(classes = {
 		DataSourceAutoConfiguration.class,
+		HibernateJpaAutoConfiguration.class,
 		IridaApiTestFilesystemConfig.class,
 		IridaApiServicesConfig.class,
 		IridaApiGalaxyTestConfig.class })

<|original_code|>
package ca.corefacility.bioinformatics.irida.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.junit.jupiter.api.Tag;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import ca.corefacility.bioinformatics.irida.config.IridaApiGalaxyTestConfig;
import ca.corefacility.bioinformatics.irida.config.data.IridaApiTestFilesystemConfig;
import ca.corefacility.bioinformatics.irida.config.services.IridaApiServicesConfig;

/**
 * Annotation that is to be specified on Galaxy integration tests. Simplifies the configuration of tests by
 * automatically adding a number of necessary annotations.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Inherited

@Tag("IntegrationTest")
@Tag("Galaxy")
@ActiveProfiles("test")
@SpringBootTest(classes = {
		DataSourceAutoConfiguration.class,
		IridaApiTestFilesystemConfig.class,
		IridaApiServicesConfig.class,
		IridaApiGalaxyTestConfig.class })
public @interface GalaxyIntegrationTest {

}

<|edits_diff|>
--- src/test/java/ca/corefacility/bioinformatics/irida/annotation/GalaxyIntegrationTest.java
+++ src/test/java/ca/corefacility/bioinformatics/irida/annotation/GalaxyIntegrationTest.java
@@ -9,6 +9,7 @@

 import org.junit.jupiter.api.Tag;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.ActiveProfiles;

<|current_version|>
package ca.corefacility.bioinformatics.irida.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.junit.jupiter.api.Tag;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import ca.corefacility.bioinformatics.irida.config.IridaApiGalaxyTestConfig;
import ca.corefacility.bioinformatics.irida.config.data.IridaApiTestFilesystemConfig;
import ca.corefacility.bioinformatics.irida.config.services.IridaApiServicesConfig;

/**
 * Annotation that is to be specified on Galaxy integration tests. Simplifies the configuration of tests by
 * automatically adding a number of necessary annotations.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Inherited

@Tag("IntegrationTest")
@Tag("Galaxy")
@ActiveProfiles("test")
@SpringBootTest(classes = {
		DataSourceAutoConfiguration.class,
		IridaApiTestFilesystemConfig.class,
		IridaApiServicesConfig.class,
		IridaApiGalaxyTestConfig.class })
public @interface GalaxyIntegrationTest {

}

<|next_version|>
package ca.corefacility.bioinformatics.irida.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.junit.jupiter.api.Tag;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import ca.corefacility.bioinformatics.irida.config.IridaApiGalaxyTestConfig;
import ca.corefacility.bioinformatics.irida.config.data.IridaApiTestFilesystemConfig;
import ca.corefacility.bioinformatics.irida.config.services.IridaApiServicesConfig;

/**
 * Annotation that is to be specified on Galaxy integration tests. Simplifies the configuration of tests by
 * automatically adding a number of necessary annotations.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Inherited

@Tag("IntegrationTest")
@Tag("Galaxy")
@ActiveProfiles("test")
@SpringBootTest(classes = {
		DataSourceAutoConfiguration.class,
		HibernateJpaAutoConfiguration.class,
		IridaApiTestFilesystemConfig.class,
		IridaApiServicesConfig.class,
		IridaApiGalaxyTestConfig.class })
public @interface GalaxyIntegrationTest {

}


Add documentation for BinaryFILE exception

--- nassau/src/main/java/org/jvirtanen/nassau/binaryfile/BinaryFILEException.java
+++ nassau/src/main/java/org/jvirtanen/nassau/binaryfile/BinaryFILEException.java
@@ -2,8 +2,16 @@

 import org.jvirtanen.nassau.ProtocolException;

+/**
+ * Indicates a protocol error while handling the BinaryFILE file format.
+ */
 public class BinaryFILEException extends ProtocolException {

+    /**
+     * Construct an instance with the specified detail message.
+     *
+     * @param message the detail message
+     */
     public BinaryFILEException(String message) {
         super(message);
     }

<|original_code|>
package org.jvirtanen.nassau.binaryfile;

import org.jvirtanen.nassau.ProtocolException;

public class BinaryFILEException extends ProtocolException {

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

}

<|edits_diff|>
--- nassau/src/main/java/org/jvirtanen/nassau/binaryfile/BinaryFILEException.java
+++ nassau/src/main/java/org/jvirtanen/nassau/binaryfile/BinaryFILEException.java
@@ -2,6 +2,9 @@

 import org.jvirtanen.nassau.ProtocolException;

+/**
+ * Indicates a protocol error while handling the BinaryFILE file format.
+ */
 public class BinaryFILEException extends ProtocolException {

     public BinaryFILEException(String message) {
<|current_version|>
package org.jvirtanen.nassau.binaryfile;

import org.jvirtanen.nassau.ProtocolException;

/**
 * Indicates a protocol error while handling the BinaryFILE file format.
 */
public class BinaryFILEException extends ProtocolException {

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

}

<|next_version|>
package org.jvirtanen.nassau.binaryfile;

import org.jvirtanen.nassau.ProtocolException;

/**
 * Indicates a protocol error while handling the BinaryFILE file format.
 */
public class BinaryFILEException extends ProtocolException {

    /**
     * Construct an instance with the specified detail message.
     *
     * @param message the detail message
     */
    public BinaryFILEException(String message) {
        super(message);
    }

}


Add endpoint for updating own presence

Add endpoint for updating own presence

--- WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/endpoints/UsersEndpoint.java
+++ WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/endpoints/UsersEndpoint.java
@@ -12,6 +12,7 @@

 package co.phoenixlab.discord.api.endpoints;

+import co.phoenixlab.discord.api.entities.Presence;
 import co.phoenixlab.discord.api.entities.SelfUser;
 import co.phoenixlab.discord.api.request.EditProfileRequest;

@@ -25,4 +26,7 @@
     SelfUser editProfile(EditProfileRequest request)
             throws ApiException;

+    void updatePresence(Presence request)
+            throws ApiException;
+
 }

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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

}

<|edits_diff|>
--- WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/endpoints/UsersEndpoint.java
+++ WahrDiscordApi/src/main/java/co/phoenixlab/discord/api/endpoints/UsersEndpoint.java
@@ -12,6 +12,7 @@

 package co.phoenixlab.discord.api.endpoints;

+import co.phoenixlab.discord.api.entities.Presence;
 import co.phoenixlab.discord.api.entities.SelfUser;
 import co.phoenixlab.discord.api.request.EditProfileRequest;

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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.Presence;
import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

}

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

package co.phoenixlab.discord.api.endpoints;

import co.phoenixlab.discord.api.entities.Presence;
import co.phoenixlab.discord.api.entities.SelfUser;
import co.phoenixlab.discord.api.request.EditProfileRequest;

import java.awt.image.BufferedImage;

public interface UsersEndpoint {

    BufferedImage getAvatar(long userId, String avatar)
            throws ApiException;

    SelfUser editProfile(EditProfileRequest request)
            throws ApiException;

    void updatePresence(Presence request)
            throws ApiException;

}


Use the application name as the default local service id in KubernetesDiscovery.

--- spring-cloud-kubernetes-discovery/src/main/java/io/fabric8/spring/cloud/discovery/KubernetesDiscoveryProperties.java
+++ spring-cloud-kubernetes-discovery/src/main/java/io/fabric8/spring/cloud/discovery/KubernetesDiscoveryProperties.java
@@ -16,12 +16,15 @@

 package io.fabric8.spring.cloud.discovery;

+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;

 @ConfigurationProperties("spring.cloud.kubernetes.discovery")
 public class KubernetesDiscoveryProperties {

     private boolean enabled = true;
+
+    @Value("${spring.application.name:unknown}")
     private String serviceName = "unknown";

     public boolean isEnabled() {

<|original_code|>
/*
 *   Copyright (C) 2016 to the original 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 io.fabric8.spring.cloud.discovery;

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

@ConfigurationProperties("spring.cloud.kubernetes.discovery")
public class KubernetesDiscoveryProperties {

    private boolean enabled = true;
    private String serviceName = "unknown";

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getServiceName() {
        return serviceName;
    }
}

<|edits_diff|>
--- spring-cloud-kubernetes-discovery/src/main/java/io/fabric8/spring/cloud/discovery/KubernetesDiscoveryProperties.java
+++ spring-cloud-kubernetes-discovery/src/main/java/io/fabric8/spring/cloud/discovery/KubernetesDiscoveryProperties.java
@@ -16,6 +16,7 @@

 package io.fabric8.spring.cloud.discovery;

+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;

 @ConfigurationProperties("spring.cloud.kubernetes.discovery")
<|current_version|>
/*
 *   Copyright (C) 2016 to the original 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 io.fabric8.spring.cloud.discovery;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("spring.cloud.kubernetes.discovery")
public class KubernetesDiscoveryProperties {

    private boolean enabled = true;
    private String serviceName = "unknown";

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getServiceName() {
        return serviceName;
    }
}

<|next_version|>
/*
 *   Copyright (C) 2016 to the original 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 io.fabric8.spring.cloud.discovery;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties("spring.cloud.kubernetes.discovery")
public class KubernetesDiscoveryProperties {

    private boolean enabled = true;

    @Value("${spring.application.name:unknown}")
    private String serviceName = "unknown";

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getServiceName() {
        return serviceName;
    }
}


Add @Nonnull annotation to determineDefaultLocale

--- src/main/java/org/synyx/urlaubsverwaltung/user/UserSettingsAwareSessionLocaleResolver.java
+++ src/main/java/org/synyx/urlaubsverwaltung/user/UserSettingsAwareSessionLocaleResolver.java
@@ -2,6 +2,7 @@

 import org.springframework.web.servlet.i18n.SessionLocaleResolver;

+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 import java.security.Principal;
 import java.util.Locale;
@@ -14,6 +15,7 @@
         this.userSettingsService = userSettingsService;
     }

+    @Nonnull
     @Override
     protected Locale determineDefaultLocale(HttpServletRequest request) {

<|original_code|>
package org.synyx.urlaubsverwaltung.user;

import org.springframework.web.servlet.i18n.SessionLocaleResolver;

import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.Locale;

class UserSettingsAwareSessionLocaleResolver extends SessionLocaleResolver {

    private final UserSettingsService userSettingsService;

    UserSettingsAwareSessionLocaleResolver(UserSettingsService userSettingsService) {
        this.userSettingsService = userSettingsService;
    }

    @Override
    protected Locale determineDefaultLocale(HttpServletRequest request) {

        final Principal userPrincipal = request.getUserPrincipal();
        if (userPrincipal == null) {
            return request.getLocale();
        }

        final Locale locale = userSettingsService.findLocaleForUsername(userPrincipal.getName())
            .orElseGet(request::getLocale);

        setLocaleContext(request, null, () -> locale);

        return locale;
    }
}

<|edits_diff|>
--- src/main/java/org/synyx/urlaubsverwaltung/user/UserSettingsAwareSessionLocaleResolver.java
+++ src/main/java/org/synyx/urlaubsverwaltung/user/UserSettingsAwareSessionLocaleResolver.java
@@ -2,6 +2,7 @@

 import org.springframework.web.servlet.i18n.SessionLocaleResolver;

+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 import java.security.Principal;
 import java.util.Locale;
<|current_version|>
package org.synyx.urlaubsverwaltung.user;

import org.springframework.web.servlet.i18n.SessionLocaleResolver;

import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.Locale;

class UserSettingsAwareSessionLocaleResolver extends SessionLocaleResolver {

    private final UserSettingsService userSettingsService;

    UserSettingsAwareSessionLocaleResolver(UserSettingsService userSettingsService) {
        this.userSettingsService = userSettingsService;
    }

    @Override
    protected Locale determineDefaultLocale(HttpServletRequest request) {

        final Principal userPrincipal = request.getUserPrincipal();
        if (userPrincipal == null) {
            return request.getLocale();
        }

        final Locale locale = userSettingsService.findLocaleForUsername(userPrincipal.getName())
            .orElseGet(request::getLocale);

        setLocaleContext(request, null, () -> locale);

        return locale;
    }
}

<|next_version|>
package org.synyx.urlaubsverwaltung.user;

import org.springframework.web.servlet.i18n.SessionLocaleResolver;

import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
import java.util.Locale;

class UserSettingsAwareSessionLocaleResolver extends SessionLocaleResolver {

    private final UserSettingsService userSettingsService;

    UserSettingsAwareSessionLocaleResolver(UserSettingsService userSettingsService) {
        this.userSettingsService = userSettingsService;
    }

    @Nonnull
    @Override
    protected Locale determineDefaultLocale(HttpServletRequest request) {

        final Principal userPrincipal = request.getUserPrincipal();
        if (userPrincipal == null) {
            return request.getLocale();
        }

        final Locale locale = userSettingsService.findLocaleForUsername(userPrincipal.getName())
            .orElseGet(request::getLocale);

        setLocaleContext(request, null, () -> locale);

        return locale;
    }
}


Set a max length for worksheet name

Set a max length for worksheet name

--- karma-common/src/main/java/edu/isi/karma/imp/Import.java
+++ karma-common/src/main/java/edu/isi/karma/imp/Import.java
@@ -25,8 +25,12 @@
     private Worksheet worksheet;
     protected Workspace workspace;

+    public static int MAX_WORKSHEET_NAME_LEN = 100;
+
     public Import(String worksheetName, Workspace workspace, String encoding) {
         this.factory = workspace.getFactory();
+        if(worksheetName.length() > MAX_WORKSHEET_NAME_LEN)
+        	worksheetName = worksheetName.substring(0, MAX_WORKSHEET_NAME_LEN) + "...";
         this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
         this.workspace = workspace;
     }

<|original_code|>
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.isi.karma.imp;

import java.io.IOException;

import org.json.JSONException;

import edu.isi.karma.rep.RepFactory;
import edu.isi.karma.rep.Worksheet;
import edu.isi.karma.rep.Workspace;
import edu.isi.karma.webserver.KarmaException;

/**
 *
 * This abstract class in an interface to all classes with import functionality
 *
 * @author mielvandersande
 */
public abstract class Import {

    private final RepFactory factory;
    private Worksheet worksheet;
    protected Workspace workspace;

    public Import(String worksheetName, Workspace workspace, String encoding) {
        this.factory = workspace.getFactory();
        this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
        this.workspace = workspace;
    }

    public Import(RepFactory factory, Worksheet worksheet) {
        this.factory = factory;
        this.worksheet = worksheet;
    }

    public RepFactory getFactory() {
        return factory;
    }

    public Worksheet getWorksheet() {
        return worksheet;
    }

    public void createWorksheet(String worksheetName, Workspace workspace, String encoding) {
    	this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
    }

    /*
     * Generate worksheet from data
     */
    public abstract Worksheet generateWorksheet() throws JSONException, IOException, KarmaException, ClassNotFoundException;

}

<|edits_diff|>
--- karma-common/src/main/java/edu/isi/karma/imp/Import.java
+++ karma-common/src/main/java/edu/isi/karma/imp/Import.java
@@ -24,6 +24,8 @@
     private final RepFactory factory;
     private Worksheet worksheet;
     protected Workspace workspace;
+
+    public static int MAX_WORKSHEET_NAME_LEN = 100;

     public Import(String worksheetName, Workspace workspace, String encoding) {
         this.factory = workspace.getFactory();
<|current_version|>
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.isi.karma.imp;

import java.io.IOException;

import org.json.JSONException;

import edu.isi.karma.rep.RepFactory;
import edu.isi.karma.rep.Worksheet;
import edu.isi.karma.rep.Workspace;
import edu.isi.karma.webserver.KarmaException;

/**
 *
 * This abstract class in an interface to all classes with import functionality
 *
 * @author mielvandersande
 */
public abstract class Import {

    private final RepFactory factory;
    private Worksheet worksheet;
    protected Workspace workspace;

    public static int MAX_WORKSHEET_NAME_LEN = 100;

    public Import(String worksheetName, Workspace workspace, String encoding) {
        this.factory = workspace.getFactory();
        this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
        this.workspace = workspace;
    }

    public Import(RepFactory factory, Worksheet worksheet) {
        this.factory = factory;
        this.worksheet = worksheet;
    }

    public RepFactory getFactory() {
        return factory;
    }

    public Worksheet getWorksheet() {
        return worksheet;
    }

    public void createWorksheet(String worksheetName, Workspace workspace, String encoding) {
    	this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
    }

    /*
     * Generate worksheet from data
     */
    public abstract Worksheet generateWorksheet() throws JSONException, IOException, KarmaException, ClassNotFoundException;

}

<|next_version|>
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.isi.karma.imp;

import java.io.IOException;

import org.json.JSONException;

import edu.isi.karma.rep.RepFactory;
import edu.isi.karma.rep.Worksheet;
import edu.isi.karma.rep.Workspace;
import edu.isi.karma.webserver.KarmaException;

/**
 *
 * This abstract class in an interface to all classes with import functionality
 *
 * @author mielvandersande
 */
public abstract class Import {

    private final RepFactory factory;
    private Worksheet worksheet;
    protected Workspace workspace;

    public static int MAX_WORKSHEET_NAME_LEN = 100;

    public Import(String worksheetName, Workspace workspace, String encoding) {
        this.factory = workspace.getFactory();
        if(worksheetName.length() > MAX_WORKSHEET_NAME_LEN)
        	worksheetName = worksheetName.substring(0, MAX_WORKSHEET_NAME_LEN) + "...";
        this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
        this.workspace = workspace;
    }

    public Import(RepFactory factory, Worksheet worksheet) {
        this.factory = factory;
        this.worksheet = worksheet;
    }

    public RepFactory getFactory() {
        return factory;
    }

    public Worksheet getWorksheet() {
        return worksheet;
    }

    public void createWorksheet(String worksheetName, Workspace workspace, String encoding) {
    	this.worksheet = factory.createWorksheet(worksheetName, workspace, encoding);
    }

    /*
     * Generate worksheet from data
     */
    public abstract Worksheet generateWorksheet() throws JSONException, IOException, KarmaException, ClassNotFoundException;

}


Allow for destination file in mock endpoint

--- src/test/java/com/llnw/storage/client/MockEndpointFactory.java
+++ src/test/java/com/llnw/storage/client/MockEndpointFactory.java
@@ -1,6 +1,7 @@
 package com.llnw.storage.client;

 import com.google.common.collect.Lists;
+import com.google.common.io.Files;
 import com.llnw.storage.client.io.ActivityCallback;

 import javax.annotation.Nullable;
@@ -10,9 +11,18 @@
 import java.util.List;

 public class MockEndpointFactory extends EndpointFactory {
+
+    private final File destination;
+
     public MockEndpointFactory() {
+        this(null);
+    }
+
+    public MockEndpointFactory(File destination) {
         super(null, null, null);
+        this.destination = destination;
     }
+

     @Override
     public Endpoint create(boolean useFTP) {
@@ -41,6 +51,9 @@
             @Override
             public void upload(File file, String path, String name, @Nullable ActivityCallback callback)
                     throws IOException {
+                if (destination != null) {
+                    Files.copy(file, destination);
+                }
             }

             @Override

<|original_code|>
package com.llnw.storage.client;

import com.google.common.collect.Lists;
import com.llnw.storage.client.io.ActivityCallback;

import javax.annotation.Nullable;

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

public class MockEndpointFactory extends EndpointFactory {
    public MockEndpointFactory() {
        super(null, null, null);
    }

    @Override
    public Endpoint create(boolean useFTP) {
        return new Endpoint() {
            @Override
            public void deleteDirectory(String path) throws IOException {
            }

            @Override
            public void deleteFile(String path) throws IOException {
            }

            @Override
            public void close() {
            }

            @Override
            public void makeDirectory(String path) throws IOException {
            }

            @Override
            public List<String> listFiles(String path) throws IOException {
                return Lists.newArrayList();
            }

            @Override
            public void upload(File file, String path, String name, @Nullable ActivityCallback callback)
                    throws IOException {
            }

            @Override
            public void noop() throws IOException {
            }

            @Override
            public boolean exists(String path) throws IOException {
                return false;
            }
        };
    }
}

<|edits_diff|>
--- src/test/java/com/llnw/storage/client/MockEndpointFactory.java
+++ src/test/java/com/llnw/storage/client/MockEndpointFactory.java
@@ -1,6 +1,7 @@
 package com.llnw.storage.client;

 import com.google.common.collect.Lists;
+import com.google.common.io.Files;
 import com.llnw.storage.client.io.ActivityCallback;

 import javax.annotation.Nullable;
@@ -10,9 +11,18 @@
 import java.util.List;

 public class MockEndpointFactory extends EndpointFactory {
+
+    private final File destination;
+
     public MockEndpointFactory() {
+        this(null);
+    }
+
+    public MockEndpointFactory(File destination) {
         super(null, null, null);
+        this.destination = destination;
     }
+

     @Override
     public Endpoint create(boolean useFTP) {
<|current_version|>
package com.llnw.storage.client;

import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.llnw.storage.client.io.ActivityCallback;

import javax.annotation.Nullable;

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

public class MockEndpointFactory extends EndpointFactory {

    private final File destination;

    public MockEndpointFactory() {
        this(null);
    }

    public MockEndpointFactory(File destination) {
        super(null, null, null);
        this.destination = destination;
    }

    @Override
    public Endpoint create(boolean useFTP) {
        return new Endpoint() {
            @Override
            public void deleteDirectory(String path) throws IOException {
            }

            @Override
            public void deleteFile(String path) throws IOException {
            }

            @Override
            public void close() {
            }

            @Override
            public void makeDirectory(String path) throws IOException {
            }

            @Override
            public List<String> listFiles(String path) throws IOException {
                return Lists.newArrayList();
            }

            @Override
            public void upload(File file, String path, String name, @Nullable ActivityCallback callback)
                    throws IOException {
            }

            @Override
            public void noop() throws IOException {
            }

            @Override
            public boolean exists(String path) throws IOException {
                return false;
            }
        };
    }
}

<|next_version|>
package com.llnw.storage.client;

import com.google.common.collect.Lists;
import com.google.common.io.Files;
import com.llnw.storage.client.io.ActivityCallback;

import javax.annotation.Nullable;

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

public class MockEndpointFactory extends EndpointFactory {

    private final File destination;

    public MockEndpointFactory() {
        this(null);
    }

    public MockEndpointFactory(File destination) {
        super(null, null, null);
        this.destination = destination;
    }

    @Override
    public Endpoint create(boolean useFTP) {
        return new Endpoint() {
            @Override
            public void deleteDirectory(String path) throws IOException {
            }

            @Override
            public void deleteFile(String path) throws IOException {
            }

            @Override
            public void close() {
            }

            @Override
            public void makeDirectory(String path) throws IOException {
            }

            @Override
            public List<String> listFiles(String path) throws IOException {
                return Lists.newArrayList();
            }

            @Override
            public void upload(File file, String path, String name, @Nullable ActivityCallback callback)
                    throws IOException {
                if (destination != null) {
                    Files.copy(file, destination);
                }
            }

            @Override
            public void noop() throws IOException {
            }

            @Override
            public boolean exists(String path) throws IOException {
                return false;
            }
        };
    }
}


Add null check for haystack arg.

Add null check for haystack arg.

--- BaragonAgentService/src/main/java/com/hubspot/baragon/agent/handlebars/IfContainedInHelperSource.java
+++ BaragonAgentService/src/main/java/com/hubspot/baragon/agent/handlebars/IfContainedInHelperSource.java
@@ -2,12 +2,17 @@

 import java.io.IOException;
 import java.util.List;
+import java.util.Objects;

 import com.github.jknack.handlebars.Options;

 public class IfContainedInHelperSource {

   public static CharSequence ifContainedIn(List<String> haystack, String needle, Options options) throws IOException {
+    if (Objects.isNull(haystack)) {
+      return options.inverse();
+    }
+
     for (String element : haystack) {
       if (element.contains(needle)) {
         return options.fn();

<|original_code|>
package com.hubspot.baragon.agent.handlebars;

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

import com.github.jknack.handlebars.Options;

public class IfContainedInHelperSource {

  public static CharSequence ifContainedIn(List<String> haystack, String needle, Options options) throws IOException {
    for (String element : haystack) {
      if (element.contains(needle)) {
        return options.fn();
      }
    }

    return options.inverse();
  }

}

<|edits_diff|>
--- BaragonAgentService/src/main/java/com/hubspot/baragon/agent/handlebars/IfContainedInHelperSource.java
+++ BaragonAgentService/src/main/java/com/hubspot/baragon/agent/handlebars/IfContainedInHelperSource.java
@@ -2,6 +2,7 @@

 import java.io.IOException;
 import java.util.List;
+import java.util.Objects;

 import com.github.jknack.handlebars.Options;

<|current_version|>
package com.hubspot.baragon.agent.handlebars;

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

import com.github.jknack.handlebars.Options;

public class IfContainedInHelperSource {

  public static CharSequence ifContainedIn(List<String> haystack, String needle, Options options) throws IOException {
    for (String element : haystack) {
      if (element.contains(needle)) {
        return options.fn();
      }
    }

    return options.inverse();
  }

}

<|next_version|>
package com.hubspot.baragon.agent.handlebars;

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

import com.github.jknack.handlebars.Options;

public class IfContainedInHelperSource {

  public static CharSequence ifContainedIn(List<String> haystack, String needle, Options options) throws IOException {
    if (Objects.isNull(haystack)) {
      return options.inverse();
    }

    for (String element : haystack) {
      if (element.contains(needle)) {
        return options.fn();
      }
    }

    return options.inverse();
  }

}


Add Growth Push tracking code to sample

Add Growth Push tracking code to sample

--- sample/src/com/growthbeat/growthbeatsample/MainActivity.java
+++ sample/src/com/growthbeat/growthbeatsample/MainActivity.java
@@ -5,6 +5,7 @@
 import android.view.Menu;

 import com.growthbeat.Growthbeat;
+import com.growthpush.GrowthPush;
 import com.growthpush.model.Environment;

 public class MainActivity extends Activity {
@@ -16,6 +17,8 @@
 		Growthbeat.getInstance().initialize(this.getApplicationContext(), "dy6VlRMnN3juhW9L", "NuvkVhQtRDG2nrNeDzHXzZO5c6j0Xu5t");
 		Growthbeat.getInstance().initializeGrowthPush(BuildConfig.DEBUG ? Environment.development : Environment.production, "955057365401");
 		Growthbeat.getInstance().initializeGrowthReplay();
+		GrowthPush.getInstance().setDeviceTags();
+		GrowthPush.getInstance().trackEvent("Launch");
 	}

 	@Override

<|original_code|>
package com.growthbeat.growthbeatsample;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.growthbeat.Growthbeat;
import com.growthpush.model.Environment;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Growthbeat.getInstance().initialize(this.getApplicationContext(), "dy6VlRMnN3juhW9L", "NuvkVhQtRDG2nrNeDzHXzZO5c6j0Xu5t");
		Growthbeat.getInstance().initializeGrowthPush(BuildConfig.DEBUG ? Environment.development : Environment.production, "955057365401");
		Growthbeat.getInstance().initializeGrowthReplay();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}

<|edits_diff|>
--- sample/src/com/growthbeat/growthbeatsample/MainActivity.java
+++ sample/src/com/growthbeat/growthbeatsample/MainActivity.java
@@ -5,6 +5,7 @@
 import android.view.Menu;

 import com.growthbeat.Growthbeat;
+import com.growthpush.GrowthPush;
 import com.growthpush.model.Environment;

 public class MainActivity extends Activity {
<|current_version|>
package com.growthbeat.growthbeatsample;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.growthbeat.Growthbeat;
import com.growthpush.GrowthPush;
import com.growthpush.model.Environment;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Growthbeat.getInstance().initialize(this.getApplicationContext(), "dy6VlRMnN3juhW9L", "NuvkVhQtRDG2nrNeDzHXzZO5c6j0Xu5t");
		Growthbeat.getInstance().initializeGrowthPush(BuildConfig.DEBUG ? Environment.development : Environment.production, "955057365401");
		Growthbeat.getInstance().initializeGrowthReplay();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}

<|next_version|>
package com.growthbeat.growthbeatsample;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;

import com.growthbeat.Growthbeat;
import com.growthpush.GrowthPush;
import com.growthpush.model.Environment;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Growthbeat.getInstance().initialize(this.getApplicationContext(), "dy6VlRMnN3juhW9L", "NuvkVhQtRDG2nrNeDzHXzZO5c6j0Xu5t");
		Growthbeat.getInstance().initializeGrowthPush(BuildConfig.DEBUG ? Environment.development : Environment.production, "955057365401");
		Growthbeat.getInstance().initializeGrowthReplay();
		GrowthPush.getInstance().setDeviceTags();
		GrowthPush.getInstance().trackEvent("Launch");
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}


Mark test with JUnit4 runner

Mark test with JUnit4 runner

--- factory/src/it/functional/src/test/java/com/google/auto/factory/DependencyInjectionIntegrationTest.java
+++ factory/src/it/functional/src/test/java/com/google/auto/factory/DependencyInjectionIntegrationTest.java
@@ -3,11 +3,14 @@
 import static org.truth0.Truth.ASSERT;

 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;

 import com.google.inject.Guice;

 import dagger.ObjectGraph;

+@RunWith(JUnit4.class)
 public class DependencyInjectionIntegrationTest {
   @Test public void daggerInjectedFactory() {
     FactoryGeneratedFactory factoryGeneratedFactory =

<|original_code|>
package com.google.auto.factory;

import static org.truth0.Truth.ASSERT;

import org.junit.Test;

import com.google.inject.Guice;

import dagger.ObjectGraph;

public class DependencyInjectionIntegrationTest {
  @Test public void daggerInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        ObjectGraph.create(DaggerModule.class).get(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }

  @Test public void guiceInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        Guice.createInjector(new GuiceModule())
            .getInstance(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }
}

<|edits_diff|>
--- factory/src/it/functional/src/test/java/com/google/auto/factory/DependencyInjectionIntegrationTest.java
+++ factory/src/it/functional/src/test/java/com/google/auto/factory/DependencyInjectionIntegrationTest.java
@@ -3,6 +3,8 @@
 import static org.truth0.Truth.ASSERT;

 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;

 import com.google.inject.Guice;

<|current_version|>
package com.google.auto.factory;

import static org.truth0.Truth.ASSERT;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.google.inject.Guice;

import dagger.ObjectGraph;

public class DependencyInjectionIntegrationTest {
  @Test public void daggerInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        ObjectGraph.create(DaggerModule.class).get(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }

  @Test public void guiceInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        Guice.createInjector(new GuiceModule())
            .getInstance(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }
}

<|next_version|>
package com.google.auto.factory;

import static org.truth0.Truth.ASSERT;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import com.google.inject.Guice;

import dagger.ObjectGraph;

@RunWith(JUnit4.class)
public class DependencyInjectionIntegrationTest {
  @Test public void daggerInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        ObjectGraph.create(DaggerModule.class).get(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }

  @Test public void guiceInjectedFactory() {
    FactoryGeneratedFactory factoryGeneratedFactory =
        Guice.createInjector(new GuiceModule())
            .getInstance(FactoryGeneratedFactory.class);
    FactoryGenerated one = factoryGeneratedFactory.create("A");
    FactoryGenerated two = factoryGeneratedFactory.create("B");
    ASSERT.that(one.name()).isEqualTo("A");
    ASSERT.that(one.dependency()).isNotNull();
    ASSERT.that(two.name()).isEqualTo("B");
    ASSERT.that(two.dependency()).isNotNull();
    ASSERT.that(one.dependency()).isNotEqualTo(two.dependency());
  }
}


Update IntelliJ IDEA support to also recognize `*.logtalk` and `*.prolog` file extensions

--- coding/idea/src/org/logtalk/intellij/LogtalkFileTypeFactory.java
+++ coding/idea/src/org/logtalk/intellij/LogtalkFileTypeFactory.java
@@ -10,7 +10,9 @@

     @Override
     public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
+        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "logtalk");
         fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "lgt");
+        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "prolog");
         fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "pl");
         //fileTypeConsumer.consume(PrologFileType.INSTANCE, "pl");
     }

<|original_code|>
package org.logtalk.intellij;

import org.jetbrains.annotations.NotNull;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;

public class LogtalkFileTypeFactory extends FileTypeFactory {

    @Override
    public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "lgt");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "pl");
        //fileTypeConsumer.consume(PrologFileType.INSTANCE, "pl");
    }

}

<|edits_diff|>
--- coding/idea/src/org/logtalk/intellij/LogtalkFileTypeFactory.java
+++ coding/idea/src/org/logtalk/intellij/LogtalkFileTypeFactory.java
@@ -10,6 +10,7 @@

     @Override
     public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
+        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "logtalk");
         fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "lgt");
         fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "pl");
         //fileTypeConsumer.consume(PrologFileType.INSTANCE, "pl");
<|current_version|>
package org.logtalk.intellij;

import org.jetbrains.annotations.NotNull;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;

public class LogtalkFileTypeFactory extends FileTypeFactory {

    @Override
    public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "logtalk");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "lgt");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "pl");
        //fileTypeConsumer.consume(PrologFileType.INSTANCE, "pl");
    }

}

<|next_version|>
package org.logtalk.intellij;

import org.jetbrains.annotations.NotNull;

import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;

public class LogtalkFileTypeFactory extends FileTypeFactory {

    @Override
    public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "logtalk");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "lgt");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "prolog");
        fileTypeConsumer.consume(LogtalkFileType.INSTANCE, "pl");
        //fileTypeConsumer.consume(PrologFileType.INSTANCE, "pl");
    }

}


Add deployment Id as all entities have to be associated with a deployment

--- ushahidi/src/main/java/com/ushahidi/android/domain/entity/GeoJson.java
+++ ushahidi/src/main/java/com/ushahidi/android/domain/entity/GeoJson.java
@@ -27,6 +27,8 @@

     private String mGeoJson;

+    private Long mDeploymentId;
+
     public String getGeoJson() {
         return mGeoJson;
     }
@@ -39,6 +41,7 @@
     public String toString() {
         return "GeoJson{" +
                 "mID='" + _id + '\'' +
+                "mDeploymentId='" + mDeploymentId + '\'' +
                 ", geojson='" + mGeoJson + '\'' +
                 '}';
     }

<|original_code|>
/*
 * Copyright (c) 2015 Ushahidi.
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program in the file LICENSE-AGPL. If not, see
 * https://www.gnu.org/licenses/agpl-3.0.html
 */

package com.ushahidi.android.domain.entity;

import com.addhen.android.raiburari.domain.entity.Entity;

/**
 * GeoJson Entity
 *
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class GeoJson extends Entity {

    private String mGeoJson;

    public String getGeoJson() {
        return mGeoJson;
    }

    public void setGeoJson(String geoJson) {
        mGeoJson = geoJson;
    }

    @Override
    public String toString() {
        return "GeoJson{" +
                "mID='" + _id + '\'' +
                ", geojson='" + mGeoJson + '\'' +
                '}';
    }
}

<|edits_diff|>
--- ushahidi/src/main/java/com/ushahidi/android/domain/entity/GeoJson.java
+++ ushahidi/src/main/java/com/ushahidi/android/domain/entity/GeoJson.java
@@ -27,6 +27,8 @@

     private String mGeoJson;

+    private Long mDeploymentId;
+
     public String getGeoJson() {
         return mGeoJson;
     }
<|current_version|>
/*
 * Copyright (c) 2015 Ushahidi.
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program in the file LICENSE-AGPL. If not, see
 * https://www.gnu.org/licenses/agpl-3.0.html
 */

package com.ushahidi.android.domain.entity;

import com.addhen.android.raiburari.domain.entity.Entity;

/**
 * GeoJson Entity
 *
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class GeoJson extends Entity {

    private String mGeoJson;

    private Long mDeploymentId;

    public String getGeoJson() {
        return mGeoJson;
    }

    public void setGeoJson(String geoJson) {
        mGeoJson = geoJson;
    }

    @Override
    public String toString() {
        return "GeoJson{" +
                "mID='" + _id + '\'' +
                ", geojson='" + mGeoJson + '\'' +
                '}';
    }
}

<|next_version|>
/*
 * Copyright (c) 2015 Ushahidi.
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program in the file LICENSE-AGPL. If not, see
 * https://www.gnu.org/licenses/agpl-3.0.html
 */

package com.ushahidi.android.domain.entity;

import com.addhen.android.raiburari.domain.entity.Entity;

/**
 * GeoJson Entity
 *
 * @author Ushahidi Team <team@ushahidi.com>
 */
public class GeoJson extends Entity {

    private String mGeoJson;

    private Long mDeploymentId;

    public String getGeoJson() {
        return mGeoJson;
    }

    public void setGeoJson(String geoJson) {
        mGeoJson = geoJson;
    }

    @Override
    public String toString() {
        return "GeoJson{" +
                "mID='" + _id + '\'' +
                "mDeploymentId='" + mDeploymentId + '\'' +
                ", geojson='" + mGeoJson + '\'' +
                '}';
    }
}


Fix session serialization for Js

Fix session serialization for Js

--- src/main/java/com/coreoz/plume/admin/webservices/security/WebSessionAdmin.java
+++ src/main/java/com/coreoz/plume/admin/webservices/security/WebSessionAdmin.java
@@ -3,6 +3,8 @@
 import java.util.Set;

 import com.coreoz.plume.admin.jersey.WebSessionPermission;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

 import lombok.Getter;
 import lombok.Setter;
@@ -18,10 +20,12 @@
 @ToString
 public class WebSessionAdmin implements WebSessionPermission {

+	@JsonSerialize(using = ToStringSerializer.class)
 	private long idUser;
 	private String userName;
 	private String fullName;
 	private Set<String> permissions;
+	@JsonSerialize(using = ToStringSerializer.class)
 	private long expirationTime;

 }

<|original_code|>
package com.coreoz.plume.admin.webservices.security;

import java.util.Set;

import com.coreoz.plume.admin.jersey.WebSessionPermission;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * Contains secure data of a user
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WebSessionAdmin implements WebSessionPermission {

	private long idUser;
	private String userName;
	private String fullName;
	private Set<String> permissions;
	private long expirationTime;

}

<|edits_diff|>
--- src/main/java/com/coreoz/plume/admin/webservices/security/WebSessionAdmin.java
+++ src/main/java/com/coreoz/plume/admin/webservices/security/WebSessionAdmin.java
@@ -3,6 +3,8 @@
 import java.util.Set;

 import com.coreoz.plume.admin.jersey.WebSessionPermission;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

 import lombok.Getter;
 import lombok.Setter;
@@ -18,6 +20,7 @@
 @ToString
 public class WebSessionAdmin implements WebSessionPermission {

+	@JsonSerialize(using = ToStringSerializer.class)
 	private long idUser;
 	private String userName;
 	private String fullName;
<|current_version|>
package com.coreoz.plume.admin.webservices.security;

import java.util.Set;

import com.coreoz.plume.admin.jersey.WebSessionPermission;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * Contains secure data of a user
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WebSessionAdmin implements WebSessionPermission {

	@JsonSerialize(using = ToStringSerializer.class)
	private long idUser;
	private String userName;
	private String fullName;
	private Set<String> permissions;
	private long expirationTime;

}

<|next_version|>
package com.coreoz.plume.admin.webservices.security;

import java.util.Set;

import com.coreoz.plume.admin.jersey.WebSessionPermission;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * Contains secure data of a user
 */
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WebSessionAdmin implements WebSessionPermission {

	@JsonSerialize(using = ToStringSerializer.class)
	private long idUser;
	private String userName;
	private String fullName;
	private Set<String> permissions;
	@JsonSerialize(using = ToStringSerializer.class)
	private long expirationTime;

}


Test setting @Transactional on findById repository method.

--- src/main/java/org/ohdsi/webapi/cohortdefinition/CohortDefinitionRepository.java
+++ src/main/java/org/ohdsi/webapi/cohortdefinition/CohortDefinitionRepository.java
@@ -15,6 +15,7 @@
 package org.ohdsi.webapi.cohortdefinition;

 import java.io.Serializable;
+import javax.transaction.Transactional;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.EntityGraph;
@@ -31,6 +32,7 @@
   // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
   // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
   @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
+  @Transactional
   CohortDefinition findById(Integer id);

 }

<|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 org.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  CohortDefinition findById(Integer id);

}

<|edits_diff|>
--- src/main/java/org/ohdsi/webapi/cohortdefinition/CohortDefinitionRepository.java
+++ src/main/java/org/ohdsi/webapi/cohortdefinition/CohortDefinitionRepository.java
@@ -15,6 +15,7 @@
 package org.ohdsi.webapi.cohortdefinition;

 import java.io.Serializable;
+import javax.transaction.Transactional;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.EntityGraph;
<|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 org.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  CohortDefinition findById(Integer id);

}

<|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 org.ohdsi.webapi.cohortdefinition;

import java.io.Serializable;
import javax.transaction.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.Repository;

/**
 *
 * @author cknoll1
 */
public interface CohortDefinitionRepository extends CrudRepository<CohortDefinition, Integer> {
  Page<CohortDefinition> findAll(Pageable pageable);

  // Bug in hibernate, findById should use @EntityGraph, but details are not being feched. Workaround: mark details Fetch.EAGER,
  // but means findAll() will eager load definitions (what the @EntityGraph was supposed to solve)
  @EntityGraph(value = "CohortDefinition.withDetail", type = EntityGraph.EntityGraphType.LOAD)
  @Transactional
  CohortDefinition findById(Integer id);

}