This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Result execute(Input in) throws IllegalArgumentException{ | |
assertNotNull(in, "In must not be null."); | |
try{ | |
Integer productId = in.getSelected(); | |
assertNotNull(productId, "ProductId must not be null."); | |
assertInRange(productId, 1, 10, "ProductId must be in the range 1-10."); | |
Product product = dao.findById(productId); | |
assertNotNull(product, "Product doesn't exist."); | |
List<Integer> coins = in.getCoins(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright 2015 Takao Nakaguchi. | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('net.servicegrid:jp.go.nict.langrid.client.soap:1.0.5') | |
@Grab('net.servicegrid:jp.go.nict.langrid.service.management_1_2:1.0.5') | |
import jp.go.nict.langrid.client.soap.SoapClientFactory; | |
import jp.go.nict.langrid.service_1_2.foundation.MatchingCondition; | |
import jp.go.nict.langrid.service_1_2.foundation.Order; | |
import jp.go.nict.langrid.service_1_2.foundation.servicemanagement.ServiceManagementService; | |
new SoapClientFactory().create( | |
ServiceManagementService.class, | |
new URL("http://langrid.org/service_manager/services/ServiceManagement"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.langrid:jp.go.nict.langrid.client.soap:1.0.8') | |
@Grab('org.langrid:jp.go.nict.langrid.service.language_1_2:1.0.8') | |
import jp.go.nict.langrid.client.soap.SoapClientFactory; | |
import jp.go.nict.langrid.service_1_2.translation.TranslationService; | |
println new SoapClientFactory().create( | |
TranslationService.class, | |
new URL("http://langrid.org/service_manager/invoker/TranslationServiceId"), | |
"yourid", | |
"yourpass").translate("en", "ja", "hello"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P axis-rt-core | |
Index: src/main/java/org/apache/axis/utils/bytecode/ClassReader.java | |
=================================================================== | |
--- src/main/java/org/apache/axis/utils/bytecode/ClassReader.java (revision 1649462) | |
+++ src/main/java/org/apache/axis/utils/bytecode/ClassReader.java (working copy) | |
@@ -59,6 +59,10 @@ | |
private static final int CONSTANT_Double = 6; | |
private static final int CONSTANT_NameAndType = 12; | |
private static final int CONSTANT_Utf8 = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.eclipse.jetty:jetty-webapp:9.3.0.M1') | |
@Grab('net.servicegrid:jp.go.nict.langrid.servicecontainer:1.0.6') | |
import jp.go.nict.langrid.servicecontainer.handler.annotation.Service; | |
import jp.go.nict.langrid.servicecontainer.handler.jsonrpc.servlet.JsonRpcServlet; | |
import org.eclipse.jetty.server.Server; | |
import org.eclipse.jetty.webapp.WebAppContext; | |
public interface TestService{ | |
int f(int n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.arnx.jsonic.JSON; | |
import org.jsonman.Node; | |
import org.jsonman.NodeFactory; | |
import org.jsonman.NodeFinder; | |
import org.jsonman.node.MapNode; | |
import org.junit.Assert; | |
import org.junit.Test; | |
public class NodeFinderTest{ | |
@Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.fluentd.logger.FluentLogger; | |
public class FluentLoggerTest { | |
public static class Log{ | |
public Log(String name, String msg){ | |
this.name = name; | |
this.msg = msg; | |
} | |
public String getName() { | |
return name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MethodInvoker{ | |
public static Object invoke( | |
Object instance, String methodName, Object... args) | |
throws IllegalAccessException, InvocationTargetException, NoSuchMethodException{ | |
Class<?> clazz = instance.getClass(); | |
Class<?>[] argTypes = new Class<?>[args.length]; | |
for(int i = 0; i < args.length; i++){ | |
argTypes[i] = args[i].getClass(); | |
} | |
try{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Method; | |
public class InvokeSafely{ | |
public static Object invokeSafely(Object obj, String method) throws Throwable{ | |
Class<?> c = obj.getClass(); | |
Method m = c.getMethod(method); | |
try{ | |
return m.invoke(obj); | |
} catch(IllegalAccessException e){ | |
} |