Skip to content

Instantly share code, notes, and snippets.

View A-pZ's full-sized avatar

A-pZ A-pZ

  • Capybara(Oni-Tenjiku-nezumi)
  • Tokyo, shinagawa
View GitHub Profile
@A-pZ
A-pZ / console.log
Created January 2, 2016 08:26
Struts2で複数ファイルアップロードをやってみているが…
2016/01/02 17:20:23.142 [DEBUG] - UploadAction: uploadfile : D:\pleiades-4.5.1\eclipse\upload\upload_32f5b782_aa40_409b_b0a9_1d1c5375c818_00000003.tmp
2016/01/02 17:20:23.142 [DEBUG] - UploadAction: uploadfileContentType : image/jpeg, image/jpeg, image/jpeg, image/jpeg
2016/01/02 17:20:23.142 [DEBUG] - UploadAction: uploadfileFilename : Xc85e.jpg, w9tpT.jpg, ZzAwW.jpg, yYENs.jpg
2016/01/02 17:20:23.143 [WARN ] - SampleService: Not available contentType:image/jpeg, image/jpeg, image/jpeg, image/jpeg
@A-pZ
A-pZ / SpockSampleActionTest.groovy
Created January 19, 2016 15:49
これがStruts2における大きな第一歩となるかどうかはわからないが…spockを使ったテスト化に成功。
/**
*
*/
package lumi.sample.action
import lumi.sample.service.SampleService
import org.mockito.InjectMocks
import org.mockito.Mock
import org.mockito.Mockito
@A-pZ
A-pZ / struts.properties
Created April 7, 2016 02:52
Struts2のアップロード設定
struts.multipart.parser=jakarta
struts.multipart.maxSize=65535
struts.multipart.saveDir=upload
@A-pZ
A-pZ / StreamTest.java
Created August 8, 2016 01:34
ラムダ式と実質的final
package seren.example.questions;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
/**
* @author A-pZ
*/
@A-pZ
A-pZ / DistinctEntities.java
Created November 23, 2016 11:39
List<Entityクラス>から、とある重複条件のEntityクラスを取り除く(要するに実質のMap化)
public class DistinctEntities {
public List<UserEntity> distinct(List<UserEntity> entities) throws Exception {
UserEntityPredicator predicator = new UserEntityPredicator();
List<UserEntity> result =
entities.stream()
.filter(entity -> predicator.test(entity))
.collect(Collectors.toList());
@A-pZ
A-pZ / pom.xml
Last active January 31, 2017 00:51
SpringBoot1.4.4+groovy+lombokのmaven定義
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.a-pz.spring</groupId>
<artifactId>sampleweb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@A-pZ
A-pZ / eclipse-sts-groovy-4.6.2_install.md
Last active January 31, 2017 00:59
Pleiades All in one Eclipse 4.6(SR2)にSTS/lombok/groovyプラグインをいれる手順

Pleiades All in one Eclipse 4.6 -SR2 にSpringToolSuite(STS) と groovy・lombokを導入する手順

  • Pleiades All in one Eclipse 4.6 -SR2 を任意の場所に展開
  • lombok1.6.12.jarを実行し、インストールしたEclipseの実行ファイルのパスを指定する
  • Eclipse起動しているなら再起動

STSインストール(4.6版)

  • マーケットプレイスからSTSを選択→検索欄にSTSを入れる。
  • 最新版のものを選ぶ。
@A-pZ
A-pZ / HelloAction.java
Created March 16, 2017 05:01
Struts2.5のActionクラスのコンストラクタを使ってしまうと一部のProviderクラスがnullになるので…Preparableを使いましょう
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
/**
* <code>Set welcome message.</code>
*/
@A-pZ
A-pZ / DisplayListActionTest.java
Created April 4, 2017 05:44
Struts2+Spockでテストケース作成
package serendip.struts.thymeleaf.struts2_thymeleaf_sampleapp.actions;
import static org.junit.Assert.*
import org.apache.struts2.StrutsJUnit4TestCase
import com.opensymphony.xwork2.ActionProxy
import com.opensymphony.xwork2.ActionSupport
import spock.lang.Specification
Configulation:
Properties:
Property:
name: "catalina.base"
value: "/var/log/tomcat/logs"
status: "info"
Appenders:
Console:
name: "Console"
target: "SYSTEM_OUT"