package org.skyve.impl.content.ejb;

import javax.ejb.Local;
import javax.ejb.Remote;

import org.skyve.content.AttachmentContent;
import org.skyve.content.BeanContent;
import org.skyve.content.SearchResults;

@Remote
@Local
public interface EJBRemoteContentManagerServer {
	public void put(BeanContent content) throws Exception;

	/**
	 *
	 * @param content The AttachmentContent to put.
	 * @param index	whether to index of not
	 * @return	The contentId.
	 * @throws Exception
	 */
	public String put(AttachmentContent content, boolean index) throws Exception;

	public AttachmentContent get(String id) throws Exception;

	public void remove(BeanContent content) throws Exception;

	public void remove(String contentId) throws Exception;

	public SearchResults google(String search, int maxResults) throws Exception;
}

package org.skyve.impl.content.ejb;

import org.skyve.content.AttachmentContent;
import org.skyve.content.BeanContent;
import org.skyve.content.SearchResults;

public interface EJBRemoteContentManagerServer {
	public void put(BeanContent content) throws Exception;

	/**
	 *
	 * @param content The AttachmentContent to put.
	 * @param index	whether to index of not
	 * @return	The contentId.
	 * @throws Exception
	 */
	public String put(AttachmentContent content, boolean index) throws Exception;

	public AttachmentContent get(String id) throws Exception;

	public void remove(BeanContent content) throws Exception;

	public void remove(String contentId) throws Exception;

	public SearchResults google(String search, int maxResults) throws Exception;
}

Remove @Remote and @Local off of the content interface to allow the session bean definition in the target system to specify.


// Copyright (c) 2011 Microsoft Corporation.  All rights reserved.
package tlc2.tool.fp;

import java.rmi.RemoteException;

/**
 * The sole purpose of this class is to broaden the visibility of
 * {@link DiskFPSet}#index for uni tests
 */
@SuppressWarnings("serial")
public class DummyDiskFPSet extends HeapBasedDiskFPSet {

	public DummyDiskFPSet(long maxRealMemInBytes) throws RemoteException {
		super(maxRealMemInBytes / FPSet.LongSize);
	}

	public void setIndex(long[] anIndex) {
		this.index = anIndex;
	}
}

// Copyright (c) 2011 Microsoft Corporation.  All rights reserved.
package tlc2.tool.fp;

import java.rmi.RemoteException;

/**
 * The sole purpose of this class is to broaden the visibility of
 * {@link DiskFPSet}#index for uni tests
 */
@SuppressWarnings("serial")
public class DummyDiskFPSet extends LSBDiskFPSet {

	public DummyDiskFPSet(long maxRealMemInBytes) throws RemoteException {
		super(maxRealMemInBytes / FPSet.LongSize);
	}

	public void setIndex(long[] anIndex) {
		this.index = anIndex;
	}
}

Change parent class to more specific LSBDiskFPSet because tests require LSBFlusher logic


//
// Ascii.java
//

/** Outputs the readable ASCII table from 32 to 127. */
public class Ascii {

  public static void main(String[] args) {
    for (int i=32; i<128; i++) {
      String s = "" + i;
      if (i < 100) s = " " + s;
      if (i < 10) s = " " + s;
      System.out.print(s + " " + (char) i + "\t");
      if (i % 10 == 1) System.out.println();
    }
    System.out.println();
  }

}

//
// Ascii.java
//

/** Outputs the readable ASCII table from 32 to 127. */
public class Ascii {

  public static void main(String[] args) {
    int max = 255;
    if (args.length > 0) max = Integer.parseInt(args[0]);
    for (int i=32; i<=max; i++) {
      String s = "" + i;
      if (i < 100) s = " " + s;
      if (i < 10) s = " " + s;
      System.out.print(s + " " + (char) i + "\t");
      if (i % 10 == 1) System.out.println();
    }
    System.out.println();
  }

}

Add option to specify maximum character to list in the table; default maximum to 255 instead of 127.


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

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

public class ExceptionTest {

    @RegisterExtension
    IgnoreIOExceptionExtension ignoreIOExceptionExtension = new IgnoreIOExceptionExtension();

    @Test
    public void firstTest() throws IOException {
        throw new IOException("IO Exception");
    }

    @Test
    public void secondTest() throws IOException {
        throw new IOException("My IO Exception");
    }

}

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

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

public class ExceptionTest {

    @RegisterExtension
    static IgnoreIOExceptionExtension ignoreIOExceptionExtension = new IgnoreIOExceptionExtension();

    @Test
    public void firstTest() throws IOException {
        throw new IOException("IO Exception");
    }

    @Test
    public void secondTest() throws IOException {
        throw new IOException("My IO Exception");
    }

}

Revert "Remove static when using @RegisterExtension"

This reverts commit b7f7cf7efe5f941f2702181a603147b00c5a7337.


package org.metawatch.manager;

import org.metawatch.manager.MetaWatchService.Preferences;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootCompletedReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent)
	{
		 if(Preferences.autoConnect) {
			 context.startService(new Intent(context, MetaWatchService.class));
			 if (Preferences.logging) Log.v(MetaWatch.TAG, "Service loaded at start");
		 }

	}

}

package org.metawatch.manager;

import org.metawatch.manager.MetaWatchService.Preferences;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootCompletedReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent)
	{
		MetaWatchService.loadPreferences(context);
		if(Preferences.autoConnect) {
			context.startService(new Intent(context, MetaWatchService.class));
			if (Preferences.logging) Log.v(MetaWatch.TAG, "Service loaded at start");
		}
	}

}

Load preferences before checking them

Load preferences before checking them


package com.github.paweladamski.httpclientmock;

import static com.github.paweladamski.httpclientmock.matchers.HttpResponseMatchers.hasStatus;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.hamcrest.Matchers;
import org.junit.Test;

public class HttpClientMockTest {

  @Test
  public void should_run_requestInterceptors() throws IOException {
    HttpClientMock httpClientMock = new HttpClientMock();
    httpClientMock.addRequestInterceptor((request,context)->request.addHeader("foo","bar"));
    httpClientMock.onGet().withHeader("foo","bar").doReturn("ok");

    HttpResponse ok = httpClientMock.execute(new HttpGet("http://localhost"));
    assertThat(ok, hasStatus(200));
  }

  @Test
  public void should_run_responseInterceptors() throws IOException {
    HttpClientMock httpClientMock = new HttpClientMock();
    httpClientMock.addResponseInterceptor((request,context)->request.addHeader("foo","bar"));
    httpClientMock.onGet().doReturn("ok");

    HttpResponse ok = httpClientMock.execute(new HttpGet("http://localhost"));
    assertThat(ok.getFirstHeader("foo").getValue(), equalTo("bar"));
  }

}

package com.github.paweladamski.httpclientmock;

import static com.github.paweladamski.httpclientmock.matchers.HttpResponseMatchers.hasStatus;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.hamcrest.Matchers;
import org.junit.Test;

public class HttpClientMockTest {

  @Test
  public void should_run_requestInterceptors() throws IOException {
    HttpClientMock httpClientMock = new HttpClientMock();
    httpClientMock.addRequestInterceptor((request,context)->request.addHeader("foo","bar"));
    httpClientMock.onGet().withHeader("foo","bar").doReturn("ok");

    HttpResponse ok = httpClientMock.execute(new HttpGet("http://localhost"));
    assertThat(ok, hasStatus(200));
  }

  @Test
  public void should_run_responseInterceptors() throws IOException {
    HttpClientMock httpClientMock = new HttpClientMock();
    httpClientMock.addResponseInterceptor((request,context)->request.addHeader("foo","bar"));
    httpClientMock.onGet().doReturn("ok");

    HttpResponse ok = httpClientMock.execute(new HttpGet("http://localhost"));
    assertThat(ok.getFirstHeader("foo").getValue(), equalTo("bar2"));
  }

}

Add failing test to check if workflow is working


package org.ngrinder;

import org.junit.Test;

public class NGrinderControllerStarterTest {
	@Test
	public void test1() throws Exception {

		NGrinderControllerStarter.main(new String[]
				{
				}
		);
	}

	@Test
	public void testEasyClusterConfiguration() {
		NGrinderControllerStarter.ClusterMode.easy.parseArgs(new String[]{

				"-cluster-port=2022"
		});
	}
}

package org.ngrinder;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class NGrinderControllerStarterTest {
	@Test
	public void test1() throws Exception {

		NGrinderControllerStarter.main(new String[]
				{
				}
		);
	}

	@Test
	public void testEasyClusterConfiguration() {
		NGrinderControllerStarter.ClusterMode.easy.parseArgs(new String[]{

				"-cluster-port=2022"
		});
	}
}

Set ignore the starter test

[NGRINDER-710] Set ignore the starter test


package leetcode;

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

/**
 * https://leetcode.com/problems/count-of-smaller-numbers-after-self/
 */
public class Problem315 {
    public List<Integer> countSmaller(int[] nums) {
        List<Integer> result = new ArrayList<>();
        // TODO:
        return result;
    }

    public static void main(String[] args) {
        Problem315 prob = new Problem315();
        System.out.println(prob.countSmaller(new int[]{5, 2, 6, 1})); // [2, 1, 1, 0]
    }
}

package leetcode;

import java.util.Arrays;
import java.util.List;

/**
 * https://leetcode.com/problems/count-of-smaller-numbers-after-self/
 */
public class Problem315 {
    public List<Integer> countSmaller(int[] nums) {
        int[] tmp = nums.clone();
        Arrays.sort(tmp);
        for (int i = 0; i < nums.length; i++) {
            nums[i] = Arrays.binarySearch(tmp, nums[i]) + 1;
        }
        int[] bit = new int[nums.length + 1];
        Integer[] ans = new Integer[nums.length];
        for (int i = nums.length - 1; i >= 0; i--) {
            ans[i] = query(bit, nums[i] - 1);
            add(bit, nums[i], 1);
        }
        return Arrays.asList(ans);
    }

    private void add(int[] bit, int i, int val) {
        for (; i < bit.length; i += i & -i) {
            bit[i] += val;
        }
    }

    private int query(int[] bit, int i) {
        int ans = 0;
        for (; i > 0; i -= i & -i) {
            ans += bit[i];
        }
        return ans;
    }
}

Put solution for problem 315

Put solution for problem 315


package com.github.solairerove.woodstock.job;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class MyBean implements CommandLineRunner {

    public void run(String... args) {
        System.out.println("Hello from test job");
    }
}

package com.github.solairerove.woodstock.job;

import com.github.solairerove.woodstock.domain.Unit;
import com.github.solairerove.woodstock.repository.UnitRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class MyBean implements CommandLineRunner {

    private final UnitRepository repository;

    @Autowired
    public MyBean(UnitRepository repository) {
        this.repository = repository;
    }

    public void run(String... args) {
        Unit unit = new Unit();
        unit.setLabel("");
        unit.setAvatar("");
        unit.setDescription("");

        System.out.println(repository.save(unit));
    }
}

Write simple job with adding unit domain


package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;

import static org.junit.Assert.assertEquals;

public class ReadLenientTest {
    @Test
    public void testLenient() {
        doTest(Bytes.allocateDirect(64));
        doTest(Bytes.elasticHeapByteBuffer(64));
        doTest(Bytes.from(""));
    }

    private void doTest(Bytes bytes) {
        bytes.lenient(true);
        ByteBuffer bb = ByteBuffer.allocateDirect(32);
        bytes.read(bb);
        assertEquals(0, bb.position());

        assertEquals(BigDecimal.ZERO, bytes.readBigDecimal());
        assertEquals(BigInteger.ZERO, bytes.readBigInteger());
        assertEquals(false, bytes.readBoolean());
        assertEquals(null, bytes.read8bit());
        assertEquals(null, bytes.readUtf8());
        assertEquals(0, bytes.readByte());
        assertEquals(-1, bytes.readUnsignedByte()); // note this behaviour is need to find the end of a stream.
        assertEquals(0, bytes.readShort());
        assertEquals(0, bytes.readUnsignedShort());
        assertEquals(0, bytes.readInt());
        assertEquals(0, bytes.readUnsignedInt());
        assertEquals(0.0, bytes.readFloat(), 0.0);
        assertEquals(0.0, bytes.readDouble(), 0.0);
    }
}

package net.openhft.chronicle.bytes;

import org.junit.Test;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;

import static org.junit.Assert.assertEquals;

public class ReadLenientTest {
    @Test
    public void testLenient() {
        doTest(Bytes.allocateDirect(64));
        doTest(Bytes.elasticHeapByteBuffer(64));
        doTest(Bytes.from(""));
    }

    private void doTest(Bytes bytes) {
        bytes.lenient(true);
        ByteBuffer bb = ByteBuffer.allocateDirect(32);
        bytes.read(bb);
        assertEquals(0, bb.position());

        assertEquals(BigDecimal.ZERO, bytes.readBigDecimal());
        assertEquals(BigInteger.ZERO, bytes.readBigInteger());
        assertEquals(false, bytes.readBoolean());
        assertEquals(null, bytes.read8bit());
        assertEquals(null, bytes.readUtf8());
        assertEquals(0, bytes.readByte());
        assertEquals(-1, bytes.readUnsignedByte()); // note this behaviour is need to find the end of a stream.
        assertEquals(0, bytes.readShort());
        assertEquals(0, bytes.readUnsignedShort());
        assertEquals(0, bytes.readInt());
        assertEquals(0, bytes.readUnsignedInt());
        assertEquals(0.0, bytes.readFloat(), 0.0);
        assertEquals(0.0, bytes.readDouble(), 0.0);

        bytes.release();
    }
}

Add support for lenient reading where reading too much is full of zeros.


package org.ops4j.pax.web.service.internal.model;

import javax.servlet.Filter;

public class FilterModel extends BasicModel
{

    private final Filter m_filter;
    private final String[] m_urlPatterns;
    private final String[] m_servletNames;

    public FilterModel( final Filter filter,
                               final String[] urlPatterns,
                               final String[] servletNames,
                               final ContextModel contextModel )
    {
        super( contextModel );

        if( urlPatterns == null && servletNames == null )
        {
            throw new IllegalArgumentException(
                "Registered filter must have at least one url pattern or servlet mapping"
            );
        }

        m_filter = filter;
        m_urlPatterns = urlPatterns;
        m_servletNames = servletNames;
    }

    public Filter getFilter()
    {
        return m_filter;
    }

    public String[] getUrlPatterns()
    {
        return m_urlPatterns;
    }

    public String[] getServletNames()
    {
        return m_servletNames;
    }

}

Reformat code and optimize imports.

Reformat code and optimize imports.


package io.github.aquerr.eaglefactions.listeners;

import io.github.aquerr.eaglefactions.logic.FactionLogic;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.filter.cause.Root;
import org.spongepowered.api.event.message.MessageChannelEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.TextRepresentable;
import org.spongepowered.api.text.format.TextColors;

public class ChatMessageListener
{
    @Listener
    public void onChatMessage(MessageChannelEvent.Chat event, @Root Player player)
    {
        if(FactionLogic.getFactionName(player.getUniqueId()) != null)
        {
            String message = event.getRawMessage().toPlain();

            String factionTag = FactionLogic.getFactionTag(FactionLogic.getFactionName(player.getUniqueId()));
            if(factionTag != null)
            {
                TextRepresentable header = Text.of("[", TextColors.GREEN, factionTag, TextColors.WHITE, "]" + player.getName() + ": ");
                TextRepresentable textRepresentable = Text.of(message);

                event.setMessage(header,textRepresentable);
            }
        }

        return;
    }
}

package io.github.aquerr.eaglefactions.listeners;

import io.github.aquerr.eaglefactions.logic.FactionLogic;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.filter.cause.Root;
import org.spongepowered.api.event.message.MessageChannelEvent;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.TextRepresentable;
import org.spongepowered.api.text.format.TextColors;

public class ChatMessageListener
{
    @Listener
    public void onChatMessage(MessageChannelEvent.Chat event, @Root Player player)
    {
        if(FactionLogic.getFactionName(player.getUniqueId()) != null)
        {
            String message = event.getMessage().toPlain();

            String fullMessage[] = message.split(":");

            String head = fullMessage[0];
            String body = fullMessage[1];

            head = head.replace(player.getName(), "");

            String factionTag = FactionLogic.getFactionTag(FactionLogic.getFactionName(player.getUniqueId()));
            if(factionTag != null)
            {
                TextRepresentable header = Text.of(head + "[", TextColors.GREEN, factionTag, TextColors.RESET, "]" + player.getName() + ":");
                TextRepresentable textRepresentable = Text.of(body);

                event.setMessage(header,textRepresentable);
            }
        }

        return;
    }
}

Improve display of faction tags

Improve display of faction tags


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

public final class JmsSessionInfo implements JmsResource {

    protected final JmsSessionId sessionId;

    public JmsSessionInfo(JmsConnectionInfo connectionMeta, long sessionId) {
        this.sessionId = new JmsSessionId(connectionMeta.getConnectionId(), sessionId);
    }

    public JmsSessionInfo(JmsSessionId sessionId) {
        this.sessionId = sessionId;
    }

    public JmsSessionId getSessionId() {
        return sessionId;
    }

    @Override
    public void visit(JmsResourceVistor vistor) throws Exception {
        vistor.processSessionInfo(this);
    }
}

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

public final class JmsSessionInfo implements JmsResource {

    private final JmsSessionId sessionId;
    private int acknowledgementMode;

    public JmsSessionInfo(JmsConnectionInfo connectionMeta, long sessionId) {
        this.sessionId = new JmsSessionId(connectionMeta.getConnectionId(), sessionId);
    }

    public JmsSessionInfo(JmsSessionId sessionId) {
        this.sessionId = sessionId;
    }

    public JmsSessionId getSessionId() {
        return sessionId;
    }

    @Override
    public void visit(JmsResourceVistor vistor) throws Exception {
        vistor.processSessionInfo(this);
    }

    public int getAcknowledgementMode() {
        return acknowledgementMode;
    }

    public void setAcknowledgementMode(int acknowledgementMode) {
        this.acknowledgementMode = acknowledgementMode;
    }
}

Add session ack mode property to info.

Add session ack mode property to info.


package main;

/**
 * Created by nick on 10/22/15.
 */
public class Main {

    public static void main(String[] args){

    }
}

package main;

import ui.RGBWindow;

/**
 * Created by nick on 10/22/15.
 */
public class Main {

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

Create RGBWindow when app starts

Create RGBWindow when app starts


/*
 * Aerospike Client - Java Library
 *
 * Copyright 2012 by Aerospike, Inc. All rights reserved.
 *
 * Availability of this source code to partners and customers includes
 * redistribution rights covered by individual contract. Please check your
 * contract for exact rights and responsibilities.
 */
package com.aerospike.client.command;

public final class ParticleType {
	// Server particle types. Unsupported types are commented out.
	public static final int NULL = 0;
	public static final int INTEGER = 1;
	//public static final int BIGNUM = 2;
	public static final int STRING = 3;
	public static final int BLOB = 4;
	//public static final int TIMESTAMP = 5;
	//public static final int DIGEST = 6;
	public static final int JBLOB = 7;
	//public static final int CSHARP_BLOB = 8;
	//public static final int PYTHON_BLOB = 9;
	//public static final int RUBY_BLOB = 10;
	//public static final int PHP_BLOB = 11;
	//public static final int ERLANG_BLOB = 12;
	//public static final int SEGMENT_POINTER = 13;

	// TODO Support RTA and 3.0 together.
	//public static final int LUA_BLOB = 14;
	public static final int MAP = 15;
	public static final int LIST = 16;
}

/*
 * Aerospike Client - Java Library
 *
 * Copyright 2012 by Aerospike, Inc. All rights reserved.
 *
 * Availability of this source code to partners and customers includes
 * redistribution rights covered by individual contract. Please check your
 * contract for exact rights and responsibilities.
 */
package com.aerospike.client.command;

public final class ParticleType {
	// Server particle types. Unsupported types are commented out.
	public static final int NULL = 0;
	public static final int INTEGER = 1;
	//public static final int BIGNUM = 2;
	public static final int STRING = 3;
	public static final int BLOB = 4;
	//public static final int TIMESTAMP = 5;
	//public static final int DIGEST = 6;
	public static final int JBLOB = 7;
	//public static final int CSHARP_BLOB = 8;
	//public static final int PYTHON_BLOB = 9;
	//public static final int RUBY_BLOB = 10;
	//public static final int PHP_BLOB = 11;
	//public static final int ERLANG_BLOB = 12;
	//public static final int SEGMENT_POINTER = 13;
	//public static final int RTA_LIST = 14;
	//public static final int RTA_DICT = 15;
	//public static final int RTA_APPEND_DICT = 16;
	//public static final int RTA_APPEND_LIST = 17;
	//public static final int LUA_BLOB = 18;
	public static final int MAP = 19;
	public static final int LIST = 20;
}

Change particle type ids for list and map.


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

import org.apache.camel.component.xslt.XsltComponent;
import org.apache.camel.component.xslt.XsltEndpoint;
import org.apache.camel.spi.annotations.Component;

/**
 * The XJ Component is for performing xml to json and back transformations of messages
 */
@Component("xj")
public class XJComponent extends XsltComponent {

    public XJComponent() {
    }

    protected XsltEndpoint createXsltEndpoint(String uri) {
        return new XJEndpoint(uri, this);
    }
}

Fix link to xj component documentation

Fix link to xj component documentation


package mil.nga.mapcache.preferences;

import android.os.Bundle;
import android.view.MenuItem;

import androidx.appcompat.app.AppCompatActivity;

import mil.nga.mapcache.R;

public class BasemapSettingsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_preferences);
        getSupportActionBar().setTitle("Saved Tile URLs");
        // Adds back arrow button to action bar
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new TileUrlFragment()).commit();
    }

    /**
     * Add back arrow button listener
     * @param item
     * @return
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}

package mil.nga.mapcache.preferences;

import android.os.Bundle;
import android.view.MenuItem;

import androidx.appcompat.app.AppCompatActivity;

import mil.nga.mapcache.R;

public class BasemapSettingsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_preferences);
        getSupportActionBar().setTitle("Base maps");
        // Adds back arrow button to action bar
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new TileUrlFragment()).commit();
    }

    /**
     * Add back arrow button listener
     * @param item
     * @return
     */
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}

Change title to Base maps

Change title to Base maps


// Copyright (C) 2010 The Android Open Source Project
//
// 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.gerrit.client.patches;

import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.changes.ChangeScreen;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwtexpui.globalkey.client.KeyCommand;

class UpToChangeCommand extends KeyCommand {
  private final PatchSet.Id patchSetId;

  UpToChangeCommand(PatchSet.Id patchSetId, int mask, int key) {
    super(mask, key, PatchUtil.C.upToChange());
    this.patchSetId = patchSetId;
  }

  @Override
  public void onKeyPress(final KeyPressEvent event) {
    Gerrit.display(PageLinks.toChange(patchSetId), new ChangeScreen(patchSetId));
  }
}

// Copyright (C) 2010 The Android Open Source Project
//
// 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.gerrit.client.patches;

import com.google.gerrit.client.Gerrit;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwtexpui.globalkey.client.KeyCommand;

class UpToChangeCommand extends KeyCommand {
  private final PatchSet.Id patchSetId;

  UpToChangeCommand(PatchSet.Id patchSetId, int mask, int key) {
    super(mask, key, PatchUtil.C.upToChange());
    this.patchSetId = patchSetId;
  }

  @Override
  public void onKeyPress(final KeyPressEvent event) {
    Gerrit.display(PageLinks.toChange(patchSetId));
  }
}

Fix 'u' to jump to user's preferred change screen

Honor the user preference and jump to the preferred screen type
when going up from an old style PatchScreen. The old style is
still used for unified diffs of binary files.

Change-Id: I92c4f95ef4a0e5e9de5196f614af62474ef96c05


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

import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.BlazeVersionInfo;
import com.google.devtools.build.lib.runtime.BlazeModule;
import com.google.devtools.build.lib.util.Clock;
import com.google.devtools.common.options.OptionsProvider;

import java.util.UUID;
import java.util.logging.LogManager;
import java.util.logging.Logger;

/**
 * Shutdown log output when Bazel runs in batch mode
 */
public class BazelShutdownLoggerModule extends BlazeModule {
  private Logger globalLogger;

  @Override
  public void blazeStartup(OptionsProvider startupOptions, BlazeVersionInfo versionInfo,
      UUID instanceId, BlazeDirectories directories, Clock clock) {
    LogManager.getLogManager().reset();
    globalLogger = Logger.getGlobal();
    globalLogger.setLevel(java.util.logging.Level.OFF);
  }
}

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

import com.google.devtools.build.lib.runtime.BlazeModule;
import com.google.devtools.common.options.OptionsProvider;

import java.util.logging.LogManager;
import java.util.logging.Logger;

/**
 * Shutdown log output when Bazel runs in batch mode
 */
public class BazelShutdownLoggerModule extends BlazeModule {
  private Logger globalLogger;

  @Override
  public void globalInit(OptionsProvider startupOptions) {
    LogManager.getLogManager().reset();
    globalLogger = Logger.getGlobal();
    globalLogger.setLevel(java.util.logging.Level.OFF);
  }
}

Use serverInit or globalInit where possible.

--
MOS_MIGRATED_REVID=126813515


package net.floodlightcontroller.core.module;

public class FloodlightModuleException extends Exception {
	private static final long serialVersionUID = 1L;

	public FloodlightModuleException(String error) {
		super(error);
	}
}

package net.floodlightcontroller.core.module;

public class FloodlightModuleException extends Exception {
	private static final long serialVersionUID = 1L;

	public FloodlightModuleException(String error) {
		super(error);
	}

    public FloodlightModuleException() {
        super();
    }

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

    public FloodlightModuleException(Throwable cause) {
        super(cause);
    }
}

Add RPC mechanism and a basic protocol for node communication


package com.ice.av.sample.entity;

import java.util.Date;

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

public class Info {

    @SuppressWarnings("unused")
	private static final Logger log = LoggerFactory.getLogger(Info.class);

    private String info = "This is a test info...";

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public Date getTimestamp() {
		return new Date();
	}

	public void setTimestamp(Date timestamp) {
	}

	@Override
	public String toString() {
		return "Info [info=" + info + "]";
	}

}

package com.ice.av.sample.entity;

import java.util.Date;

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

public class Info {

    @SuppressWarnings("unused")
	private static final Logger log = LoggerFactory.getLogger(Info.class);

    private String info = "This is a test info...";

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public String getTimestamp() {
		return new Date().toString();
	}

	public void setTimestamp(String timestamp) {
	}

	@Override
	public String toString() {
		return "Info [info=" + info + "]";
	}

}

Change the Date format to String

Change the Date format to String


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

package org.openmhealth.dsu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.lang.annotation.*;

/**
 * A specialisation of the {@link Controller} annotation that controls the version number of the DSU API.
 *
 * @author Emerson Farrugia
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@RequestMapping("/v2.0.M1")
public @interface ApiController {

}

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

package org.openmhealth.dsu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.lang.annotation.*;

/**
 * A specialisation of the {@link Controller} annotation that controls the version number of the DSU API.
 *
 * @author Emerson Farrugia
 */
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@RequestMapping("/v1.0.M1")
public @interface ApiController {

}

Update the controller to reflect the 1.0.M1 API version.


package com.bignerdranch.android.criminalintent;

import java.util.Date;
import java.util.UUID;

public class Crime {
    private UUID mId;
    private String mTitle;
    private Date mDate;
    private boolean mSolved;

    public Crime() {
        this(UUID.randomUUID());
    }

    public Crime(UUID id) {
        mId = id;
        mDate = new Date();
    }

    // Accesors

    public UUID getId() {
        return mId;
    }

    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        mTitle = title;
    }

    public boolean isSolved() {
        return mSolved;
    }

    public void setSolved(boolean solved) {
        mSolved = solved;
    }

    public Date getDate() {
        return mDate;
    }

    public void setDate(Date date) {
        mDate = date;
    }
}

package com.bignerdranch.android.criminalintent;

import java.util.Date;
import java.util.UUID;

public class Crime {
    private UUID mId;
    private String mTitle;
    private Date mDate;
    private boolean mSolved;
    private String mSuspect;

    public Crime() {
        this(UUID.randomUUID());
    }

    public Crime(UUID id) {
        mId = id;
        mDate = new Date();
    }

    // Accesors

    public UUID getId() {
        return mId;
    }

    public String getTitle() {
        return mTitle;
    }

    public void setTitle(String title) {
        mTitle = title;
    }

    public boolean isSolved() {
        return mSolved;
    }

    public void setSolved(boolean solved) {
        mSolved = solved;
    }

    public Date getDate() {
        return mDate;
    }

    public void setDate(Date date) {
        mDate = date;
    }

    public String getSuspect() {
        return mSuspect;
    }

    public void setSuspect(String suspect) {
        mSuspect = suspect;
    }
}

Update the model to include the suspect

Update the model to include the suspect


/*
 * 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 com.mpalourdio.springboottemplate.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class ServiceWithProperties {

    private final String valueFromConfig;

    public ServiceWithProperties(@Value("${admin.username}") final String valueFromConfig) {
        this.valueFromConfig = valueFromConfig;
    }

    public String getValueFromConfig() {
        return valueFromConfig;
    }
}

/*
 * 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 com.mpalourdio.springboottemplate.service;

import com.mpalourdio.springboottemplate.exception.AnotherCustomException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class ServiceWithProperties {

    private final String valueFromConfig;

    public ServiceWithProperties(@Value("${admin.username}") final String valueFromConfig) {
        this.valueFromConfig = valueFromConfig;
    }

    public String getValueFromConfig() {
        return valueFromConfig;
    }

    public void throwException() throws AnotherCustomException {
        throw new AnotherCustomException("gosh");
    }
}

Use an exception without @ResponseStatus


package at.ac.tuwien.inso.controller.lecturer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.validation.Valid;

import at.ac.tuwien.inso.entity.Grade;
import at.ac.tuwien.inso.service.GradeService;

@Controller
@RequestMapping(value = "/lecturer/addGrade")
public class LecturerAddGradeController {

    @Autowired
    private GradeService gradeService;

    @GetMapping
    public String getPage(@RequestParam("courseId") Long courseId,
                          @RequestParam("studentId") Long studentId,
                          Model model) {
        model.addAttribute("grade",
                gradeService.getDefaultGradeForStudentAndCourse(studentId, courseId));
        return "lecturer/addGrade";
    }

    @PostMapping
    public String saveGrade(@Valid @ModelAttribute("grade") Grade grade,
                            RedirectAttributes redirectAttributes) {
        grade = gradeService.saveNewGradeForStudentAndCourse(grade);
        redirectAttributes.addFlashAttribute("addedGrade", grade);
        return "redirect:/lecturer/courses";
    }

}

package at.ac.tuwien.inso.controller.lecturer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.validation.Valid;

import at.ac.tuwien.inso.entity.Grade;
import at.ac.tuwien.inso.service.GradeService;

@Controller
@RequestMapping(value = "/lecturer/addGrade")
public class LecturerAddGradeController {

    @Autowired
    private GradeService gradeService;

    @GetMapping
    public String getPage(@RequestParam("courseId") Long courseId,
                          @RequestParam("studentId") Long studentId,
                          Model model) {
        model.addAttribute("gradeAuthorizationDTO",
                gradeService.getDefaultGradeAuthorizationDTOForStudentAndCourse(studentId, courseId));
        model.addAttribute("markOptions", gradeService.getMarkOptions());
        return "lecturer/addGrade";
    }

    @PostMapping
    public String saveGrade(@Valid @ModelAttribute("gradeAuthorizationDTO")
                                        GradeAuthorizationDTO gradeAuthorizationDTO,
                            RedirectAttributes redirectAttributes) {
        Grade grade = gradeService.saveNewGradeForStudentAndCourse(gradeAuthorizationDTO);
        redirectAttributes.addFlashAttribute("addedGrade", grade);
        return "redirect:/lecturer/courses";
    }

}

Refactor AddGradeController to work with two factor authentification


package org.simpleframework.xml.core;

import junit.framework.TestCase;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

public class ConstructorInjectionWithByteCodeTest extends TestCase {

   private static final String SOURCE =
   "<exampleByteCode age='30'>\n"+
   "   <name>John Doe</name>\n"+
   "</exampleByteCode>";

   @Root
   public static class ExampleByteCode {
      @Element
      private String name;
      @Attribute
      private int age;
      public ExampleByteCode(@Element String name, @Attribute int age) {
         this.name = name;
         this.age = age;
      }
      public String getName() {
         return name;
      }
      public int getAge() {
         return age;
      }
   }

   public void testByteCode() throws Exception {
      Persister persister = new Persister();
      ExampleByteCode example = persister.read(ExampleByteCode.class, SOURCE);

      assertEquals(example.getName(), "John Doe");
      assertEquals(example.getAge(), 30);
   }

}

package org.simpleframework.xml.core;

import junit.framework.TestCase;

import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

public class ConstructorInjectionWithByteCodeTest extends TestCase {

   private static final String SOURCE =
   "<exampleByteCode age='30'>\n"+
   "   <name>John Doe</name>\n"+
   "</exampleByteCode>";

   @Root
   public static class ExampleByteCode {
      @Element
      private String name;
      @Attribute
      private int age;
      public ExampleByteCode(@Element String name, @Attribute int age) {
         this.name = name;
         this.age = age;
      }
      public String getName() {
         return name;
      }
      public int getAge() {
         return age;
      }
   }

   public void testByteCode() throws Exception {
     // Persister persister = new Persister();
     // ExampleByteCode example = persister.read(ExampleByteCode.class, SOURCE);

     // assertEquals(example.getName(), "John Doe");
     // assertEquals(example.getAge(), 30);
   }

}

Comment out the byte code reflection

Comment out the byte code reflection


package com.akiban.cserver;

/**
 * Constants derived from MySQL include/my_base.h
 * Add new MySQL error codes here, as needed.
 *
 * @author peter
 *
 */
public interface MySQLErrorConstants {

	public final static short HA_ERR_KEY_NOT_FOUND = 120;
	public final static short HA_ERR_FOUND_DUPP_KEY = 121;
	public final static short HA_ERR_INTERNAL_ERROR = 122;
	public final static short HA_ERR_RECORD_CHANGED = 123;
	public final static short HA_ERR_RECORD_DELETED = 134;
	public final static short HA_ERR_NO_REFERENCED_ROW = 151;
	public final static short HA_ERR_ROW_IS_REFERENCED = 152;
	public final static short HA_ERR_NO_SUCH_TABLE = 155;
}

package com.akiban.cserver;

/**
 * Constants derived from MySQL include/my_base.h
 * Add new MySQL error codes here, as needed.
 *
 * @author peter
 *
 */
public interface MySQLErrorConstants {

	public final static short HA_ERR_KEY_NOT_FOUND = 120;
	public final static short HA_ERR_FOUND_DUPP_KEY = 121;
	public final static short HA_ERR_INTERNAL_ERROR = 122;
	public final static short HA_ERR_RECORD_CHANGED = 123;
	public final static short HA_ERR_RECORD_DELETED = 134;
	public final static short HA_ERR_UNSUPPORTED = 138;
	public final static short HA_ERR_NO_REFERENCED_ROW = 151;
	public final static short HA_ERR_ROW_IS_REFERENCED = 152;
	public final static short HA_ERR_NO_SUCH_TABLE = 155;
}

Add a HA_ERR_UNSUPPORTED error to return if functionality isn't supported, rather than the generic UNSUPPORTED.


package de.linkvt.bachelor.config;

import de.linkvt.bachelor.web.converter.OntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converter.RdfXmlOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converter.TurtleOntologyHttpMessageConverter;

import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Configures the web module.
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
  @Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.ignoreAcceptHeader(true)
        .mediaType("rdf", MediaType.TEXT_XML)
        .mediaType("xml", MediaType.TEXT_XML)
        .mediaType("ttl", MediaType.TEXT_PLAIN);
  }

  @Bean
  public HttpMessageConverters customConverters() {
    OntologyHttpMessageConverter turtleConverter = new TurtleOntologyHttpMessageConverter();
    OntologyHttpMessageConverter rdfConverter = new RdfXmlOntologyHttpMessageConverter();
    return new HttpMessageConverters(turtleConverter, rdfConverter);
  }
}

package de.linkvt.bachelor.config;

import de.linkvt.bachelor.web.converter.OntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converter.RdfXmlOntologyHttpMessageConverter;
import de.linkvt.bachelor.web.converter.TurtleOntologyHttpMessageConverter;

import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Configures the web module.
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
  @Override
  public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
    configurer.ignoreAcceptHeader(true)
        .mediaType("owl", MediaType.TEXT_XML)
        .mediaType("rdf", MediaType.TEXT_XML)
        .mediaType("xml", MediaType.TEXT_XML)
        .mediaType("ttl", MediaType.TEXT_PLAIN);
  }

  @Bean
  public HttpMessageConverters customConverters() {
    OntologyHttpMessageConverter turtleConverter = new TurtleOntologyHttpMessageConverter();
    OntologyHttpMessageConverter rdfConverter = new RdfXmlOntologyHttpMessageConverter();
    return new HttpMessageConverters(turtleConverter, rdfConverter);
  }
}

Add .owl extension for rdf conversion

Add .owl extension for rdf conversion


package org.graphwalker.gradle.plugin.task;

import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskAction;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

/**
 * @author Nils Olsson
 */
public class Clean extends TaskBase {

    private final File outputDirectory = new File(getProject().getProjectDir(), "graphwalker");

    @Override
    public Task configure() {
        onlyIf(new Spec<Task>() {
            @Override
            public boolean isSatisfiedBy(Task task) {
                return outputDirectory.exists();
            }
        });
        return this;
    }

    @TaskAction
    public void clean() {
        Path directory = outputDirectory.toPath();
        if (Files.exists(directory)) {
            try {
                Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
                    @Override
                    public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException {
                        Files.delete(file);
                        return FileVisitResult.CONTINUE;
                    }
                    @Override
                    public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
                        Files.delete(dir);
                        return FileVisitResult.CONTINUE;
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

package org.graphwalker.gradle.plugin.task;

import org.gradle.api.Task;
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskAction;

import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;

/**
 * @author Nils Olsson
 */
public class Clean extends TaskBase {

    private final File outputDirectory = new File(getProject().getProjectDir(), "graphwalker");

    @Override
    public Task configure() {
        getOutputs().upToDateWhen(new Spec<Task>() {
            @Override
            public boolean isSatisfiedBy(Task element) {
                return !outputDirectory.exists();
            }
        });
        return this;
    }

    @TaskAction
    public void clean() {
        Path directory = outputDirectory.toPath();
        if (Files.exists(directory)) {
            try {
                Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
                    @Override
                    public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) throws IOException {
                        Files.delete(file);
                        return FileVisitResult.CONTINUE;
                    }
                    @Override
                    public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
                        Files.delete(dir);
                        return FileVisitResult.CONTINUE;
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Change the way gradle detects if task is needed to run


package cfvbaibai.cardfantasy.engine.skill;

import cfvbaibai.cardfantasy.GameUI;
import cfvbaibai.cardfantasy.data.Skill;
import cfvbaibai.cardfantasy.data.SkillTag;
import cfvbaibai.cardfantasy.engine.CardInfo;
import cfvbaibai.cardfantasy.engine.HeroDieSignal;
import cfvbaibai.cardfantasy.engine.OnAttackBlockingResult;
import cfvbaibai.cardfantasy.engine.SkillResolver;
import cfvbaibai.cardfantasy.engine.SkillUseInfo;

public class ReflectionArmor {
    public static void apply(Skill cardSkill, SkillResolver resolver, CardInfo attacker, CardInfo defender, Skill attackSkill, int attackDamage)
            throws HeroDieSignal {
        if (attackDamage <= 0) {
            return;
        }
        if (attacker == null || attacker.isDead()) {
            return;
        }
        GameUI ui = resolver.getStage().getUI();
        ui.useSkill(defender, attacker, cardSkill, true);
        OnAttackBlockingResult result = resolver.resolveAttackBlockingSkills(defender, attacker, cardSkill, 1);
        if (!result.isAttackable()) {
            return;
        }
        Return.returnCard(resolver, cardSkill, defender, attacker);
    }
}

package cfvbaibai.cardfantasy.engine.skill;

import cfvbaibai.cardfantasy.GameUI;
import cfvbaibai.cardfantasy.data.Skill;
import cfvbaibai.cardfantasy.data.SkillTag;
import cfvbaibai.cardfantasy.engine.CardInfo;
import cfvbaibai.cardfantasy.engine.HeroDieSignal;
import cfvbaibai.cardfantasy.engine.OnAttackBlockingResult;
import cfvbaibai.cardfantasy.engine.SkillResolver;
import cfvbaibai.cardfantasy.engine.SkillUseInfo;

public class ReflectionArmor {
    public static void apply(Skill cardSkill, SkillResolver resolver, CardInfo attacker, CardInfo defender, Skill attackSkill, int attackDamage)
            throws HeroDieSignal {
        if (attackDamage <= 0) {
            return;
        }
        if (attacker == null || attacker.isDead()) {
            return;
        }
        GameUI ui = resolver.getStage().getUI();
        ui.useSkill(defender, attacker, cardSkill, true);
        OnAttackBlockingResult result = resolver.resolveAttackBlockingSkills(defender, attacker, cardSkill, 1);
        if (!result.isAttackable()) {
            return;
        }
        for (SkillUseInfo attackerSkillUseInfo : attacker.getAllUsableSkillsIgnoreSilence()) {
            if (attackerSkillUseInfo.getType().containsTag(SkillTag.不动)) {
                if (Immobility.isSkillBlocked(resolver, attackerSkillUseInfo.getSkill(), cardSkill, defender, attacker)) {
                    return;
                }
            }
        }
        Return.returnCard(resolver, cardSkill, defender, attacker);
    }
}

Fix issue that 不动 is not functioning to 反射装甲 when silenced


import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

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

@RunWith(MockitoJUnitRunner.class)
public class TennisGameTest {

    @InjectMocks
    private TennisGame tennisGame;

    @Mock
    private TennisGameScore tennisGameScore;

    @Before
    public void setUp() {
        initTennisGameScore();
    }

    @Test
    public void should_federer_wins_point_when_it_has_an_even_number() {
        assertThat(tennisGame.isFedererWinPoint(2)).isTrue();
    }

    private void initTennisGameScore() {
        tennisGameScore.init();
        tennisGameScore.addPoint(0, 1, "Nadal");
        tennisGameScore.addPoint(0, 2, "Nadal");
        tennisGameScore.addPoint(0, 3, "Nadal");
        tennisGameScore.addPoint(0, 4, "Nadal");
    }

}

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

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

@RunWith(MockitoJUnitRunner.class)
public class TennisGameTest {

    @InjectMocks
    private TennisGame tennisGame;

    @Mock
    private TennisGameScore tennisGameScore;

    @Before
    public void setUp() {
        initTennisGameScore();
    }

    @Test
    public void should_federer_wins_point_when_it_has_an_even_number() {
        assertThat(tennisGame.isFedererWinPoint(2)).isTrue();
    }

    @Test
    public void should_nadal_wins_point_when_it_has_an_odd_number() {
        assertThat(tennisGame.isFedererWinPoint(1)).isFalse();
    }

    private void initTennisGameScore() {
        tennisGameScore.init();
        tennisGameScore.addPoint(0, 1, "Nadal");
        tennisGameScore.addPoint(0, 2, "Nadal");
        tennisGameScore.addPoint(0, 3, "Nadal");
        tennisGameScore.addPoint(0, 4, "Nadal");
    }

}

Test on winning point for Nadal

Test on winning point for Nadal


package com.jlgm.mmdr.lib;

public class MMDRConstants {
	public static final String MODID = "jlgm_MMDR";
	public static final String NAME = "Minecraft Modding Done Right";
	public static final String VERSION = "0.1a";
	public static final String ACCEPTEDMINECRAFTVERSIONS = "[1.10]";

	public static final String CLIENT_PROXY = "com.jlgm.mmdr.main.ClientProxy";
	public static final String SERVER_PROXY = "com.jlgm.mmdr.main.ServerProxy";
}

package com.jlgm.mmdr.lib;

public class MMDRConstants {
	//The name "behind the scenes"
	public static final String MODID = "jlgm_MMDR";
	//The public name
	public static final String NAME = "Minecraft Modding Done Right";
	//The version of the mod
	public static final String VERSION = "0.1a";
	//The Minecraft version this mod is focused to work with
	public static final String ACCEPTEDMINECRAFTVERSIONS = "[1.10]";

	//The package route of the proxys
	public static final String CLIENT_PROXY = "com.jlgm.mmdr.main.ClientProxy";
	public static final String SERVER_PROXY = "com.jlgm.mmdr.main.ServerProxy";
}

Add commentary to the constants class

Add commentary to the constants class


package net.somethingdreadful.MAL;

import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;

public class AboutActivity extends SherlockActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);

        setTitle(R.string.title_activity_about);
        ActionBar bar = getSupportActionBar();
        bar.setDisplayHomeAsUpEnabled(true);

        TextView animaMalContent = (TextView) findViewById(R.id.contributor_anima_name);
        TextView motokochanMalContent = (TextView) findViewById(R.id.contributor_motokochan_name);
        TextView apkawaMalContent = (TextView) findViewById(R.id.contributor_apkawa_name);
        TextView acknowledgementsContent = (TextView) findViewById(R.id.acknowledgements_card_content);

        animaMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        motokochanMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        apkawaMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        acknowledgementsContent.setMovementMethod(LinkMovementMethod.getInstance());

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
        }

        return true;
    }

}

package net.somethingdreadful.MAL;

import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;

public class AboutActivity extends SherlockActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_about);

        setTitle(R.string.title_activity_about);
        ActionBar bar = getSupportActionBar();
        bar.setDisplayHomeAsUpEnabled(true);

        TextView animaMalContent = (TextView) findViewById(R.id.contributor_anima_name);
        TextView motokochanMalContent = (TextView) findViewById(R.id.contributor_motokochan_name);
        TextView apkawaMalContent = (TextView) findViewById(R.id.contributor_apkawa_name);
        TextView acknowledgementsContent = (TextView) findViewById(R.id.acknowledgements_card_content);
        TextView communityContent = (TextView) findViewById(R.id.community_card_content);

        animaMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        motokochanMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        apkawaMalContent.setMovementMethod(LinkMovementMethod.getInstance());
        communityContent.setMovementMethod(LinkMovementMethod.getInstance());
        acknowledgementsContent.setMovementMethod(LinkMovementMethod.getInstance());

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                finish();
        }

        return true;
    }

}

Fix link not opening browser (about)

Fix link not opening browser (about)


package com.cjburkey.claimchunk.service.prereq.claim;

import com.cjburkey.claimchunk.Config;
import com.cjburkey.claimchunk.Utils;
import com.cjburkey.claimchunk.worldguard.WorldGuardHandler;
import java.util.Optional;

public class WorldGuardPrereq implements IClaimPrereq {

    @Override
    public int getWeight() {
        return 100;
    }

    @Override
    public boolean getPassed(PrereqClaimData data) {
        boolean allowedToClaimWG = WorldGuardHandler.isAllowedClaim(data.chunk);
        boolean worldAllowsClaims = !Config.getList("chunks", "disabledWorlds").contains(data.chunk.getWorld().getName());
        boolean adminOverride = Config.getBool("worldguard", "allowAdminOverride");
        @SuppressWarnings("OptionalGetWithoutIsPresent")
        boolean hasAdmin = Utils.hasAdmin(data.player.get());

        return (worldAllowsClaims || allowedToClaimWG) && (hasAdmin && adminOverride);
    }

    @Override
    public Optional<String> getErrorMessage(PrereqClaimData data) {
        return Optional.of(data.claimChunk.getMessages().claimLocationBlock);
    }

}

package com.cjburkey.claimchunk.service.prereq.claim;

import com.cjburkey.claimchunk.Config;
import com.cjburkey.claimchunk.Utils;
import com.cjburkey.claimchunk.worldguard.WorldGuardHandler;
import java.util.Optional;

public class WorldGuardPrereq implements IClaimPrereq {

    @Override
    public int getWeight() {
        return 100;
    }

    @Override
    public boolean getPassed(PrereqClaimData data) {
        boolean allowedToClaimWG = WorldGuardHandler.isAllowedClaim(data.chunk);
        boolean worldAllowsClaims = !Config.getList("chunks", "disabledWorlds").contains(data.chunk.getWorld().getName());
        boolean adminOverride = Config.getBool("worldguard", "allowAdminOverride");
        @SuppressWarnings("OptionalGetWithoutIsPresent")
        boolean hasAdmin = Utils.hasAdmin(data.player.get());

        // This can be simplified but it works and I'm feeling lazy
        // I promise I'll get around to it
        return !(!(worldAllowsClaims || (hasAdmin && adminOverride)) || !(allowedToClaimWG || (hasAdmin && adminOverride)));
    }

    @Override
    public Optional<String> getErrorMessage(PrereqClaimData data) {
        return Optional.of(data.claimChunk.getMessages().claimLocationBlock);
    }

}

Fix players unable to claim chunks

Fix players unable to claim chunks


/*
 * Copyright 2016, Frederik Boster
 *
 * 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 de.syquel.bushytail.controller;

import org.apache.olingo.server.api.uri.UriParameter;

import java.util.List;

/**
 * Interface for all ODataControllers. Provides CRUD Operations.
 *
 * @author Clemens Bartz
 * @author Frederik Boster
 * @since 1.0
 *
 * @param <T> Entity which is handled by the controller.
 */
public interface IBushyTailController<T> {

    T read(List<UriParameter> keyPredicates);

    void create(T entity);

}

/*
 * Copyright 2016, Frederik Boster
 *
 * 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 de.syquel.bushytail.controller;

import org.apache.olingo.server.api.uri.UriParameter;

import java.util.List;

/**
 * Interface for all ODataControllers. Provides CRUD Operations.
 *
 * @author Clemens Bartz
 * @author Frederik Boster
 * @since 1.0
 *
 * @param <T> Entity which is handled by the controller.
 */
public interface IBushyTailController<T> {

    /**
     * Read an entity.
     * @param keyPredicates the search criterias
     * @return the entity
     */
    T read(List<UriParameter> keyPredicates);

    /**
     * Create the entity.
     * @param entity the entity
     */
    void create(T entity);

}

Add documentation to controller methods.


package fr.unice.polytech.isa.tcf;

import arquillian.AbstractTCFTest;
import fr.unice.polytech.isa.tcf.entities.Cookies;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.ejb.EJB;
import java.util.Set;
import static org.junit.Assert.*;

@RunWith(Arquillian.class)
public class CatalogueTest extends AbstractTCFTest {

	@EJB
	CatalogueExploration catalogue;

	@Test
	public void preMadeRecipesAreAVailable() {
		Set<Cookies> premade = catalogue.listPreMadeRecipes();
		assertEquals(3, premade.size());
	}

	@Test
	public void regexpExploration() {
		assertEquals(0, catalogue.exploreCatalogue("unknown").size());
		assertEquals(2, catalogue.exploreCatalogue("CHOCO").size());
		assertEquals(1, catalogue.exploreCatalogue(Cookies.DARK_TEMPTATION.name()).size());
	}

}

package fr.unice.polytech.isa.tcf;

import arquillian.AbstractTCFTest;
import fr.unice.polytech.isa.tcf.entities.Cookies;
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.ejb.EJB;
import java.util.Set;
import static org.junit.Assert.*;

@RunWith(Arquillian.class)
public class CatalogueTest extends AbstractTCFTest {

	@EJB
	CatalogueExploration catalogue;

	@Test
	public void preMadeRecipesAreAVailable() {
		Set<Cookies> premade = catalogue.listPreMadeRecipes();
		assertEquals(3, premade.size());

		// Antoine
		assertEquals(1,2);
	}

	@Test
	public void regexpExploration() {
		assertEquals(0, catalogue.exploreCatalogue("unknown").size());
		assertEquals(2, catalogue.exploreCatalogue("CHOCO").size());
		assertEquals(1, catalogue.exploreCatalogue(Cookies.DARK_TEMPTATION.name()).size());
	}

}

Add error in test catalogue

[Try] Add error in test catalogue


package es.craftsmanship.toledo.katangapp.activities;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.Toast;

/**
 * @author Cristóbal Hermida
 */
public class ShowStopsActivity extends AppCompatActivity {

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

        setContentView(R.layout.activity_show_stops);

        Intent i = getIntent();
        String stops = i.getStringExtra("stopslist");

        Toast toast = Toast.makeText(
            getApplicationContext(), "Se ha recibido correctamente", Toast.LENGTH_SHORT);

        toast.show();
    }

}

package es.craftsmanship.toledo.katangapp.activities;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.Toast;

/**
 * @author Cristóbal Hermida
 */
public class ShowStopsActivity extends AppCompatActivity {

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

        setContentView(R.layout.activity_show_stops);

        Intent i = getIntent();
        String stops = i.getStringExtra("stopslist");

        Toast toast = Toast.makeText(getApplicationContext(), stops, Toast.LENGTH_SHORT);

        toast.show();
    }

}

Use the stops list in the toast result

Use the stops list in the toast result


package imagej.plugin.gui.swing;

import imagej.plugin.Plugin;
import imagej.plugin.PluginModule;
import imagej.plugin.gui.AbstractInputHarvester;
import imagej.plugin.gui.InputPanel;
import imagej.plugin.process.PluginPreprocessor;

import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 * SwingInputHarvester is a plugin preprocessor that collects input parameter
 * values from the user using a {@link SwingInputPanel} dialog box.
 */
@Plugin(type = PluginPreprocessor.class)
public class SwingInputHarvester extends AbstractInputHarvester {

	@Override
	public InputPanel createInputPanel() {
		return new SwingInputPanel();
	}

	@Override
	public boolean showDialog(InputPanel inputPanel, PluginModule<?> module) {
		final JOptionPane optionPane = new JOptionPane(null);
		optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
		final JDialog dialog = optionPane.createDialog(module.getInfo().getLabel());
		final JPanel mainPane = (JPanel) optionPane.getComponent(0);
		final JPanel widgetPane = (JPanel) mainPane.getComponent(0);
		widgetPane.add((SwingInputPanel) inputPanel);
		dialog.setModal(true);
		dialog.pack();
		dialog.setVisible(true);
		final Integer rval = (Integer) optionPane.getValue();
		return rval != null && rval == JOptionPane.OK_OPTION;
	}

}

package imagej.plugin.gui.swing;

import imagej.plugin.Plugin;
import imagej.plugin.PluginModule;
import imagej.plugin.gui.AbstractInputHarvester;
import imagej.plugin.gui.InputPanel;
import imagej.plugin.process.PluginPreprocessor;

import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 * SwingInputHarvester is a plugin preprocessor that collects input parameter
 * values from the user using a {@link SwingInputPanel} dialog box.
 */
@Plugin(type = PluginPreprocessor.class)
public class SwingInputHarvester extends AbstractInputHarvester {

	@Override
	public InputPanel createInputPanel() {
		return new SwingInputPanel();
	}

	@Override
	public boolean showDialog(final InputPanel inputPanel,
		final PluginModule<?> module)
	{
		final JOptionPane optionPane = new JOptionPane(null);
		optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
		final JDialog dialog = optionPane.createDialog(module.getInfo().getLabel());
		final JPanel mainPane = (JPanel) optionPane.getComponent(0);
		final JPanel widgetPane = (JPanel) mainPane.getComponent(0);
		widgetPane.add((SwingInputPanel) inputPanel);
		dialog.setModal(true);
		dialog.pack();
		dialog.setVisible(true);
		final Integer rval = (Integer) optionPane.getValue();
		return rval != null && rval == JOptionPane.OK_OPTION;
	}

}

Mark method arguments as final.

Mark method arguments as final.

This used to be revision r2235.


/*
 *
 * Copyright (c) 2006-2020, Speedment, 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.speedment.test.connector.support;

import com.speedment.runtime.config.Dbms;
import com.speedment.runtime.config.DbmsUtil;

import java.util.HashMap;
import java.util.Map;

public final class Dummies {

    private Dummies() {
    }

    public static Dbms dbms() {
        final Map<String, Object> data = new HashMap<>();
        data.put(DbmsUtil.IP_ADDRESS, "localhost");
        data.put(DbmsUtil.PORT, 3066);
        data.put(DbmsUtil.USERNAME, "username");

        return Dbms.create(null, data);
    }
}

/*
 *
 * Copyright (c) 2006-2020, Speedment, 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.speedment.test.connector.support;

import com.speedment.runtime.config.Dbms;
import com.speedment.runtime.config.DbmsUtil;
import com.speedment.runtime.config.trait.HasNameUtil;

import java.util.HashMap;
import java.util.Map;

public final class Dummies {

    private Dummies() {
    }

    public static Dbms dbms() {
        final Map<String, Object> data = new HashMap<>();
        data.put(DbmsUtil.IP_ADDRESS, "localhost");
        data.put(DbmsUtil.PORT, 3066);
        data.put(DbmsUtil.USERNAME, "username");
        data.put(HasNameUtil.NAME, "name");

        return Dbms.create(null, data);
    }
}

Add name property to dummy dbms

Add name property to dummy dbms


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

import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.PaxExam;

@RunWith(PaxExam.class)
public class CamelConsulTest extends BaseKarafTest {

    public static final String COMPONENT = extractName(CamelConsulTest.class);

    @Test
    public void test() throws Exception {
        testComponent(COMPONENT);
    }

}

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

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.PaxExam;

// TODO: camel-consul does not work in OSGi
@RunWith(PaxExam.class)
@Ignore("camel-consul does not work in OSGi")
public class CamelConsulTest extends BaseKarafTest {

    public static final String COMPONENT = extractName(CamelConsulTest.class);

    @Test
    public void test() throws Exception {
        testComponent(COMPONENT);
    }

}

CAMEL-12430: Disable camel-consul test on karaf as it does not work


// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.proxy;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * @author hmusum
 * @since 5.1.9
 */
public class DelayedResponsesTest {

    @Test
    public void basic() throws InterruptedException {
        ConfigTester tester = new ConfigTester();
        DelayedResponses responses = new DelayedResponses(new ConfigProxyStatistics());
        DelayedResponse delayedResponse = new DelayedResponse(tester.createRequest("foo", "id", "bar"));
        responses.add(delayedResponse);

        assertThat(responses.size(), is(1));
        assertThat(responses.responses().take(), is(delayedResponse));
        assertThat(responses.size(), is(0));

        responses.add(delayedResponse);
        assertThat(responses.size(), is(1));
        responses.remove(delayedResponse);
        assertThat(responses.size(), is(0));
    }

}

// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.proxy;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * @author hmusum
 * @since 5.1.9
 */
public class DelayedResponsesTest {

    @Test
    public void basic() throws InterruptedException {
        ConfigTester tester = new ConfigTester();
        DelayedResponses responses = new DelayedResponses(new ConfigProxyStatistics());
        long returnTime = System.currentTimeMillis() + 10;
        DelayedResponse delayedResponse = new DelayedResponse(tester.createRequest("foo", "id", "bar"), returnTime);
        responses.add(delayedResponse);

        assertThat(responses.size(), is(1));
        assertThat(responses.responses().take(), is(delayedResponse));
        assertThat(responses.size(), is(0));

        responses.add(delayedResponse);
        assertThat(responses.size(), is(1));
        responses.remove(delayedResponse);
        assertThat(responses.size(), is(0));
    }

}

Reduce unit test run time with ~10 seconds


// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler;

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

import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;

public class LogReader {

    long earliestLogThreshold;
    long latestLogThreshold;

    protected JSONObject readLogs(String logDirectory, long earliestLogThreshold, long latestLogThreshold) throws IOException, JSONException {
        this.earliestLogThreshold = earliestLogThreshold;
        this.latestLogThreshold = latestLogThreshold;
        JSONObject json = new JSONObject();
        File root = new File(logDirectory);
        traverse_folder(root, json, "");
        return json;
    }

    private void traverse_folder(File root, JSONObject json, String filename) throws IOException, JSONException {
        File[] files = root.listFiles();
        for(File child : files) {
            long logTime = Files.readAttributes(child.toPath(), BasicFileAttributes.class).creationTime().toMillis();
            if(child.isFile() && earliestLogThreshold < logTime && logTime < latestLogThreshold) {
                json.put(filename + child.getName(), DatatypeConverter.printBase64Binary(Files.readAllBytes(child.toPath())));
            }
            else if (!child.isFile()){
                traverse_folder(child, json, filename + child.getName() + "-");
            }
        }
    }

}

// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.handler;

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

import java.util.Base64;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.BasicFileAttributes;

public class LogReader {

    long earliestLogThreshold;
    long latestLogThreshold;

    protected JSONObject readLogs(String logDirectory, long earliestLogThreshold, long latestLogThreshold) throws IOException, JSONException {
        this.earliestLogThreshold = earliestLogThreshold;
        this.latestLogThreshold = latestLogThreshold;
        JSONObject json = new JSONObject();
        File root = new File(logDirectory);
        traverse_folder(root, json, "");
        return json;
    }

    private void traverse_folder(File root, JSONObject json, String filename) throws IOException, JSONException {
        File[] files = root.listFiles();
        for(File child : files) {
            long logTime = Files.readAttributes(child.toPath(), BasicFileAttributes.class).creationTime().toMillis();
            if(child.isFile() && earliestLogThreshold < logTime && logTime < latestLogThreshold) {
                json.put(filename + child.getName(), Base64.getEncoder().encodeToString(Files.readAllBytes(child.toPath())));
            }
            else if (!child.isFile()){
                traverse_folder(child, json, filename + child.getName() + "-");
            }
        }
    }

}

Convert to base 64 using standard library


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

package com.google.copybara;

import java.nio.file.Path;
import java.nio.file.PathMatcher;

/**
 * An exception that indicates a file that was to be written to a destination is not actually
 * included in {@code destination_files}, indicating a bad configuration.
 */
public class NotADestinationFileException extends RepoException {

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

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

package com.google.copybara;

import java.nio.file.Path;
import java.nio.file.PathMatcher;

/**
 * An exception that indicates a file that was to be written to a destination is not actually
 * included in {@code destination_files}, indicating a bad configuration.
 */
public class NotADestinationFileException extends ValidationException {

  NotADestinationFileException(String message) {
    super(message);
  }
}

Use ValidationException for destination_files error

Throw VE when an unexpected file appears in the destination that is
not matched by the destination_files glob.

This is always a user error so we shouldn't use RepoException for
this.

Change-Id: I7d233a2729d91be92984f9904c8e07b57331d8c8


package com.raoulvdberge.refinedstorage.integration.jei;

import net.minecraftforge.fml.common.Loader;

public final class IntegrationJEI {
    public static boolean isLoaded() {
        return Loader.isModLoaded("JEI");
    }
}

package com.raoulvdberge.refinedstorage.integration.jei;

import net.minecraftforge.fml.common.Loader;

public final class IntegrationJEI {
    public static boolean isLoaded() {
        return Loader.isModLoaded("jei");
    }
}

Fix JEI integration not working

Fix JEI integration not working


package mathsquared.resultswizard2;

import javax.swing.JDialog;

/**
 * Runs the GUI by which an event administrator can input or edit {@link EventResults}.
 *
 * @author MathSquared
 *
 */
public class EventResultsEditorDialog extends JDialog {

    /**
     * Create the dialog.
     */
    public EventResultsEditorDialog () {
        setBounds(100, 100, 450, 300);

    }

}

package mathsquared.resultswizard2;

import javax.swing.JDialog;

/**
 * Runs the GUI by which an event administrator can input or edit {@link EventResults}.
 *
 * @author MathSquared
 *
 */
public class EventResultsEditorDialog extends JDialog {

    /**
     * Create the dialog.
     */
    public EventResultsEditorDialog () {
        setTitle("Edit Event Results");
        setBounds(100, 100, 450, 300);

    }

}

Add a title to ERED

Add a title to ERED


package fr.neamar.kiss;

import fr.neamar.kiss.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class MainActivityTest {

    @Test
    public void testSomething() throws Exception {
        // TODO-add more tests...
        assertTrue(Robolectric.setupActivity(MainActivity.class) != null);
    }
}

package fr.neamar.kiss;

import fr.neamar.kiss.BuildConfig;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import static org.junit.Assert.assertTrue;

@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 22)
public class MainActivityTest {

    @Test
    public void testSomething() throws Exception {
        // TODO-add more tests...
        assertTrue(Robolectric.setupActivity(MainActivity.class) != null);
    }
}

Set sdk version to that in manifest

Set sdk version to that in manifest


package org.mousephenotype.cda.loads.cdaloader;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mousephenotype.cda.db.pojo.OntologyTerm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.validation.constraints.NotNull;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {TestConfigLoaders.class} )
@TestPropertySource(locations = {"file:${user.home}/configfiles/${profile}/test.properties"})
public class OntologyParserTest {

    private OntologyParser ontologyParser;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @NotNull
    @Value("${owlPath}")
    protected String owlPath;

    @Before
    public void setUp() throws Exception {

    	String path = owlPath + "/mp.owl";
    	String prefix = "MA";
    	ontologyParser = new OntologyParser(path, prefix);
    }

    @Test
    public void testgetTerms() {

    	List<OntologyTerm> terms = ontologyParser.getTerms();
    	Assert.assertTrue(terms.size() > 1000);

    }
}

package org.mousephenotype.cda.loads.cdaloader;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mousephenotype.cda.db.pojo.OntologyTerm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.validation.constraints.NotNull;
import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = {TestConfigLoaders.class} )
@TestPropertySource(locations = {"file:${user.home}/configfiles/${profile}/test.properties"})
public class OntologyParserTest {

    private OntologyParser ontologyParser;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @NotNull
    @Value("${owlPath}")
    protected String owlPath;

    @Before
    public void setUp() throws Exception {

Sy    	String path = owlPath + "/ma.owl";
    	String prefix = "MA";
    	ontologyParser = new OntologyParser(path, prefix);
    }

    @Test
    public void testgetTerms() {

    	List<OntologyTerm> terms = ontologyParser.getTerms();
    	Assert.assertTrue(terms.size() > 1000);

    }
}

Use ma.owl with MA test, not mp file.

Use ma.owl with MA test, not mp file.


package uk.ac.ebi.quickgo.ontology;

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

import java.time.Duration;
import java.time.LocalTime;

/**
 * Holds values related to the operation of the Ontology REST service.
 * <p>
 * Created by Tony on 04-Apr-17.
 */
@Component
@ConfigurationProperties(prefix = "ontology.cache.control.time")
public class OntologyRestProperties {

    private static final int MINUTES = 0;
    private LocalTime startTime;
    private LocalTime endTime;
    private long midnightToEndCacheTime;

    public void setStart(int hours) {
        startTime = LocalTime.of(hours, MINUTES);
    }

    public void setEnd(int hours) {
        endTime = LocalTime.of(hours, MINUTES);
        this.midnightToEndCacheTime = Duration.between(LocalTime.MIDNIGHT, endTime).getSeconds();
    }

    public LocalTime getStartTime() {
        return startTime;
    }

    public LocalTime getEndTime() {
        return endTime;
    }

    public long midnightToEndCacheTime() {
        return midnightToEndCacheTime;
    }
}

package uk.ac.ebi.quickgo.ontology;

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

import java.time.Duration;
import java.time.LocalTime;

/**
 * Holds values related to the operation of the Ontology REST service.
 * <p>
 * Created by Tony on 04-Apr-17.
 */
@Component
@ConfigurationProperties(prefix = "ontology.cache.control.time")
public class OntologyRestProperties {

    private static final int MINUTES = 0;
    private static final int DEFAULT_START_HOURS = 18;
    private static final int DEFAULT_END_HOURS = 17;
    private LocalTime startTime = LocalTime.of(DEFAULT_START_HOURS, MINUTES);
    private LocalTime endTime = LocalTime.of(DEFAULT_END_HOURS, MINUTES);
    private long midnightToEndCacheTime;

    public void setStart(int hours) {
        startTime = LocalTime.of(hours, MINUTES);
    }

    public void setEnd(int hours) {
        endTime = LocalTime.of(hours, MINUTES);
        this.midnightToEndCacheTime = Duration.between(LocalTime.MIDNIGHT, endTime).getSeconds();
    }

    public LocalTime getStartTime() {
        return startTime;
    }

    public LocalTime getEndTime() {
        return endTime;
    }

    public long midnightToEndCacheTime() {
        return midnightToEndCacheTime;
    }
}

Add defaults for cache control start and end times.