text
stringlengths
10
2.72M
package io.netty.example.time.aio; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.CompletionHandler; import java.text.SimpleDateFormat; import java.util.Date; public class ReadCompletionHandler implements CompletionHandler<Integer, ByteBuffer> { private AsynchronousSocketChannel channel; public ReadCompletionHandler(AsynchronousSocketChannel channel) { if(this.channel==null){ this.channel = channel; } } @Override public void completed(Integer result, ByteBuffer attachment) { attachment.flip(); byte[] body = new byte[attachment.remaining()]; attachment.get(body); try { String req = new String(body,"UTF-8"); System.out.println("The time server receive order :" + req); SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String now = f.format(new Date(System.currentTimeMillis())); String currentTime = "QUERY TIME ORDER".equals(req)?now:"BAD ORDER"; doWrite(currentTime); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } private void doWrite(String currentTime){ if(currentTime!=null&&currentTime.trim().length()>0){ byte[] bytes = currentTime.getBytes(); ByteBuffer writeBuffer = ByteBuffer.allocate(bytes.length); writeBuffer.put(bytes); writeBuffer.flip(); channel.write(writeBuffer, writeBuffer, new CompletionHandler<Integer, ByteBuffer>() { @Override public void completed(Integer result, ByteBuffer attachment) { if(attachment.hasRemaining()){ channel.write(attachment, attachment, this); } } @Override public void failed(Throwable exc, ByteBuffer attachment) { try { channel.close(); } catch (IOException e) { e.printStackTrace(); } } }); } } @Override public void failed(Throwable exc, ByteBuffer attachment) { try { this.channel.close(); } catch (IOException e) { e.printStackTrace(); } } }
/* * Copyright (C) 2013 Square, 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.squareup.rack.servlet; import com.google.common.base.CharMatcher; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.squareup.rack.RackEnvironment; import com.squareup.rack.RackErrors; import com.squareup.rack.RackInput; import com.squareup.rack.RackLogger; import com.squareup.rack.io.TempfileBufferedInputStream; import java.io.IOException; import java.util.Enumeration; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static com.google.common.base.Strings.nullToEmpty; import static com.google.common.base.Throwables.propagate; import static com.google.common.collect.Iterators.forEnumeration; import static com.squareup.rack.RackEnvironment.CONTENT_LENGTH; import static com.squareup.rack.RackEnvironment.CONTENT_TYPE; import static com.squareup.rack.RackEnvironment.HTTP_HEADER_PREFIX; import static com.squareup.rack.RackEnvironment.MINECART_HTTP_SERVLET_REQUEST; import static com.squareup.rack.RackEnvironment.PATH_INFO; import static com.squareup.rack.RackEnvironment.QUERY_STRING; import static com.squareup.rack.RackEnvironment.RACK_ERRORS; import static com.squareup.rack.RackEnvironment.RACK_HIJACK; import static com.squareup.rack.RackEnvironment.RACK_INPUT; import static com.squareup.rack.RackEnvironment.RACK_LOGGER; import static com.squareup.rack.RackEnvironment.RACK_MULTIPROCESS; import static com.squareup.rack.RackEnvironment.RACK_MULTITHREAD; import static com.squareup.rack.RackEnvironment.RACK_RUN_ONCE; import static com.squareup.rack.RackEnvironment.RACK_URL_SCHEME; import static com.squareup.rack.RackEnvironment.RACK_VERSION; import static com.squareup.rack.RackEnvironment.REQUEST_METHOD; import static com.squareup.rack.RackEnvironment.SCRIPT_NAME; import static com.squareup.rack.RackEnvironment.SERVER_NAME; import static com.squareup.rack.RackEnvironment.SERVER_PORT; /** * <p>Transforms an {@link HttpServletRequest} into a {@link RackEnvironment}.</p> * * <p>Conforms to version 1.2 of the Rack specification</p>. * * @see <a href="http://rack.rubyforge.org/doc/SPEC.html">The Rack Specification</a> * @see <a href="https://tools.ietf.org/html/rfc3875#section-4.1.18">RFC 3875, section 4.1.18</a> * @see <a href="http://blog.phusion.nl/2013/01/23/the-new-rack-socket-hijacking-api/">The Rack * socket hijacking API</a> */ public class RackEnvironmentBuilder { // We conform to version 1.2 of the Rack specification. // Note that this number is completely different than the gem version of rack (lowercase): // for example, the rack-1.5.2 gem ships with handlers that conform to version 1.2 of the Rack // specification. private static final List<Integer> VERSION_1_2 = ImmutableList.of(1, 2); private static final Logger RACK_ERRORS_LOGGER = LoggerFactory.getLogger(RackErrors.class); private static final Logger RACK_LOGGER_LOGGER = LoggerFactory.getLogger(RackLogger.class); private static final Joiner COMMA = Joiner.on(','); private static final CharMatcher DASH = CharMatcher.is('-'); public RackEnvironment build(HttpServletRequest request) { ImmutableMap.Builder<String, Object> content = ImmutableMap.builder(); content.put(REQUEST_METHOD, request.getMethod()); content.put(SCRIPT_NAME, request.getServletPath()); content.put(PATH_INFO, nullToEmpty(request.getPathInfo())); content.put(QUERY_STRING, nullToEmpty(request.getQueryString())); content.put(SERVER_NAME, request.getServerName()); content.put(SERVER_PORT, String.valueOf(request.getServerPort())); content.put(RACK_VERSION, VERSION_1_2); content.put(RACK_URL_SCHEME, request.getScheme().toLowerCase()); content.put(RACK_INPUT, rackInput(request)); content.put(RACK_ERRORS, new RackErrors(RACK_ERRORS_LOGGER)); content.put(RACK_LOGGER, new RackLogger(RACK_LOGGER_LOGGER)); content.put(RACK_MULTITHREAD, true); content.put(RACK_MULTIPROCESS, true); content.put(RACK_RUN_ONCE, false); content.put(RACK_HIJACK, false); // Extra things we add that aren't in the Rack specification: content.put(MINECART_HTTP_SERVLET_REQUEST, request); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String name = headerNames.nextElement(); content.put(rackHttpHeaderKey(name), COMMA.join(forEnumeration(request.getHeaders(name)))); } // This will include attributes like javax.servlet.request.X509Certificate Enumeration<String> attributeNames = request.getAttributeNames(); while (attributeNames.hasMoreElements()) { String name = attributeNames.nextElement(); content.put(name, request.getAttribute(name)); } return new RackEnvironment(content.build()); } private RackInput rackInput(HttpServletRequest request) { try { return new RackInput(new TempfileBufferedInputStream(request.getInputStream())); } catch (IOException e) { throw propagate(e); } } private String rackHttpHeaderKey(String headerName) { String transformed = DASH.replaceFrom(headerName.toUpperCase(), "_"); if (transformed.equals(CONTENT_LENGTH) || transformed.equals(CONTENT_TYPE)) { return transformed; } else { return HTTP_HEADER_PREFIX + transformed; } } }
package pixel.bus.gui.renderer; import pixel.bus.model.Vehicle; import javax.swing.*; import javax.swing.table.TableCellRenderer; import java.awt.*; /** * Created by vanley on 18/06/2017. */ public class VehicleProgressCellRenderer extends JProgressBar implements TableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Vehicle v = (Vehicle) value; setStringPainted(true); setString(v.getCapacityEstimation() + "/" + v.getCapacity()); setValue(v.getCapacityEstimation() * 100 / v.getCapacity()); return this; } }
package proCat.security; import io.jsonwebtoken.Claims; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import org.springframework.web.filter.GenericFilterBean; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import static io.jsonwebtoken.lang.Strings.hasText; @Component public class JwtFilter extends GenericFilterBean { private final JwtSupplier jwtSupplier; @Autowired public JwtFilter(JwtSupplier jwtSupplier) { this.jwtSupplier = jwtSupplier; } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { String actualToken = getTokenFromRequest((HttpServletRequest) servletRequest); if (actualToken != null && jwtSupplier.isTokenValid(actualToken)) { Claims claims = jwtSupplier.getClaimsFromToken(actualToken); UserDetails customUserDetails = JwtUser.fromClaimsToCustomUserDetails(claims); Authentication authentication = new PreAuthenticatedAuthenticationToken( customUserDetails, null, customUserDetails.getAuthorities() ); SecurityContextHolder.getContext().setAuthentication(authentication); } filterChain.doFilter(servletRequest, servletResponse); } public String getTokenFromRequest(HttpServletRequest httpServletRequest) { String token = httpServletRequest.getHeader(HttpHeaders.AUTHORIZATION); if (hasText(token) && token.startsWith("Bearer ")) { return token.substring(7); } return null; } public String getSubjectFromToken(HttpServletRequest httpServletRequest){ return jwtSupplier.getClaimsFromToken(getTokenFromRequest(httpServletRequest)).getSubject(); } }
package com.nuuedscore.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.nuuedscore.domain.Site; import com.nuuedscore.service.impl.SiteService; import lombok.extern.slf4j.Slf4j; /** * Site Front Controller * * @author PATavares * @since Feb 2021 * */ @Slf4j @RestController @RequestMapping("/site") public class SiteController extends BaseController { @Autowired SiteService siteService; /** * Get all * * @return all the Site */ @GetMapping("/") public ResponseEntity<List<Site>> all() { return new ResponseEntity<List<Site>>((List<Site>) siteService.findAll(), HttpStatus.OK); } }
public class Portfolio { private static int capital = 10000; private static double deltaThreshold = 1000; public static void main(String[] args) { //Initalize all stocks with volumes. Volumes are based on an equal distribution of capital Stock A = new Stock(); A.volume = (int) Math.floor(capital/5/A.getPrice()); Stock B = new Stock(); B.volume = (int) Math.floor(capital/5/B.getPrice()); Stock C = new Stock(); C.volume = (int) Math.floor(capital/5/C.getPrice()); Stock D = new Stock(); D.volume = (int) Math.floor(capital/5/D.getPrice()); Stock E = new Stock(); E.volume = (int) Math.floor(capital/5/E.getPrice()); //Initialize portfolio delta and option position init(A,B,C,D,E); //Using changing price to determine when to rebalance timeChange(A,B,C,D,E); } //Calculating the days changes private static void timeChange(Stock A, Stock B, Stock C, Stock D, Stock E) { //double deltaThreshold = 0.0; for(int i=0; i<10; i++){ //Hold onto old price A.oldPrice=A.price; B.oldPrice=B.price; C.oldPrice=C.price; D.oldPrice=D.price; E.oldPrice=E.price; //Calculate new price (for now this replaces actual stock data) double ran = Math.random(); if(ran>0.5){ A.price-=5; B.price+=1; C.price-=1; D.price+=5; E.price+=1; } else{ A.price+=1; B.price-=3; C.price+=1; D.price-=6; E.price-=1; } /** * Need to figure out how to determine delta so it won't change portfolio as often */ //System.out.println(deltaThreshold); double option = 0.0; double delta = determineDelta(A, B, C, D, E); option = determineOption(delta); //System.out.println(deltaThreshold); if(delta+option > deltaThreshold){ redistributePortfolio(A,B,C,D,E); showPortfolio(A,B,C,D,E,delta,option); } deltaThreshold = delta; //showPortfolio(A,B,C,D,E,delta,option); } } private static void redistributePortfolio(Stock a, Stock b, Stock c, Stock d, Stock e) { if(a.price>a.oldPrice) a.volume+=a.bundle; else a.volume-=a.bundle; if(b.price>b.oldPrice) b.volume+=b.bundle; else b.volume-=b.bundle; if(c.price>c.oldPrice) c.volume+=c.bundle; else c.volume-=c.bundle; if(d.price>d.oldPrice) d.volume+=d.bundle; else d.volume-=d.bundle; if(e.price>e.oldPrice) e.volume+=e.bundle; else e.volume-=e.bundle; } //Initial setup of portfolio delta and underlining option private static void init(Stock A, Stock B, Stock C, Stock D, Stock E) { double delta = determineDelta(A,B,C,D,E); double option = determineOption(delta); showPortfolio(A,B,C,D,E,delta,option); } //Show portfolio with price and volume including delta nad option private static void showPortfolio(Stock a, Stock b, Stock c, Stock d, Stock e,double delta, double option) { String str = "The price of stock A is " + a.getPrice() +" with " + a.volume +" shares,\nthe price of stock B is " + b.getPrice() +" with " + b.volume + " shares,\nthe price of stock C is " + c.getPrice() +" with " + c.volume + " shares,\nthe price of stock D is " + d.getPrice() +" with " + d.volume +" shares,\nthe price of stock E is " + e.getPrice() + " with " + e.volume+ " shares \nwith delta "+ delta + " and option " + option + "."; System.out.println(str); } private static double determineOption(double delta) { double option = 0.0; //if(Math.abs(delta) > Math.abs(deltaThreshold)){ option = -delta/2; //} return option; } public static double determineDelta(Stock a, Stock b, Stock c, Stock d, Stock e){ double delta = a.getPrice()*a.volume*(1-a.getRisk())+b.getPrice()*b.volume*(1-b.getRisk())+c.getPrice()*c.volume*(1-c.getRisk()) +d.getPrice()*d.volume*(1-d.getRisk())+e.getPrice()*e.volume*(1-e.getRisk()); //System.out.println("The delta is " + delta); return Math.floor(delta); } }
package com.jp.notice.mapper; import java.util.List; import org.springframework.stereotype.Component; import com.jp.notice.po.NoticePo; @Component("noticeMapper") public interface NoticeMapper { public int addNoticePo(NoticePo po); public int deleteNoticeById(NoticePo po); public List<NoticePo> getNoticeList(NoticePo po); public int updateNoticePoById(NoticePo po); public int getCount(NoticePo po); }
package com.smxknife.java2.thread.interrupt; import java.util.concurrent.TimeUnit; /** * @author smxknife * 2019/9/19 */ public class ThreadInterruptBlockedDisable implements Runnable { @Override public void run() { while (!Thread.currentThread().isInterrupted()) { /** * 通过下面三组输出可以发现,调用interrupt之后,并没有改变当前线程的状态,所以也可以理解了为什么while的循环条件可以一直为真 */ System.out.println("通过下面三组输出可以发现,调用interrupt之后,并没有改变当前线程的状态,所以也可以理解了为什么while的循环条件可以一直为真"); System.out.println("isInterrupted ? " + Thread.currentThread().isInterrupted()); System.out.println("state: " + Thread.currentThread().getState().name()); System.out.println("isActive ? " + Thread.currentThread().isAlive()); System.out.println(Thread.currentThread().getName() + " | is running" ); try { TimeUnit.SECONDS.sleep(3); // 线程会阻塞在这里 } catch (InterruptedException e) { System.out.println("在阻塞处接收到中断请求"); e.printStackTrace(); } } } }
package android.com.provider.pushNotification; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.com.provider.activities.ActivityOpenApportunity; import android.com.provider.applicationUtils.App; import android.com.provider.models.OpenApportunity; import android.com.provider15_nov_2018.R; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.support.v4.app.NotificationCompat; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; import com.orhanobut.hawk.Hawk; import java.util.ArrayList; import java.util.Map; import java.util.Objects; import java.util.Random; import static android.com.provider.applicationUtils.App.listOfValues; // https://stackoverflow.com/questions/40181654/firebase-fcm-open-activity-and-pass-data-on-notification-click-android // MARK : SHAHZEB public class MyFirebaseMessagingService extends FirebaseMessagingService{ @Override public void onNewToken(String s) { super.onNewToken(s); System.out.println("MyFirebaseInstanceIDService.onTokenRefresh " + s); } @Override public void onMessageReceived(RemoteMessage remoteMessage) { Hawk.init(this).build(); System.out.println("MyFirebaseMessagingService.onMessageReceived " + remoteMessage.getFrom()); // Check if message contains a data payload. if (remoteMessage.getData().size() > 0) { listOfValues.add(new OpenApportunity(remoteMessage.getData().get("title"), remoteMessage.getData().get("Service"), remoteMessage.getData().get("address"), remoteMessage.getData().get("Date"), remoteMessage.getData().get("Time"), remoteMessage.getData().get("job_id"), remoteMessage.getData().get("customer_id"))); sendNotification(listOfValues); ((App) getApplicationContext()).getRxBus().send(new OpenApportunity(remoteMessage.getData().get("title"), remoteMessage.getData().get("Service"), remoteMessage.getData().get("address"), remoteMessage.getData().get("Date"), remoteMessage.getData().get("Time"), remoteMessage.getData().get("job_id"), remoteMessage.getData().get("customer_id"))); } // Check if message contains a notification payload. else if (remoteMessage.getNotification() != null){ } } private void sendNotification(ArrayList<OpenApportunity> listOfValues) { Intent intent = new Intent(this, ActivityOpenApportunity.class); intent.putExtra("arraylist", listOfValues); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,PendingIntent.FLAG_ONE_SHOT); String channelId = "idddd"; // MARK : FETCHING NOTIFICATION ID // long timenew = new Date().getTime(); // String tmpStr = String.valueOf(timenew); // String last4Str = tmpStr.substring(tmpStr.length() - 5); // int notificationId = Integer.valueOf(last4Str); Random random = new Random(); int m = random.nextInt(9999 - 1000) + 1000; Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(MyFirebaseMessagingService.this) .setSmallIcon(R.drawable.notification_icon) .setContentTitle("Provider") .setContentText("New Jobs") .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Objects.requireNonNull(notificationManager).notify(m /* ID of notification */, notificationBuilder.build()); } private void sendNotification(String title, String service, String zipcode, String date, String time, String job_id, String customer_id) { Intent intent = new Intent(this, ActivityOpenApportunity.class). putExtra("title", title). putExtra("Service", service). putExtra("address", zipcode). putExtra("Date", date). putExtra("Time", time). putExtra("job_id", job_id). putExtra("customer_id", customer_id); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); String channelId = "idddd"; // MARK : FETCHING NOTIFICATION ID // long timenew = new Date().getTime(); // String tmpStr = String.valueOf(timenew); // String last4Str = tmpStr.substring(tmpStr.length() - 5); // int notificationId = Integer.valueOf(last4Str); Random random = new Random(); int m = random.nextInt(9999 - 1000) + 1000; Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(MyFirebaseMessagingService.this) .setSmallIcon(R.drawable.notification_icon) .setContentTitle(title) .setContentText("New Jobs") .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Objects.requireNonNull(notificationManager).notify(m /* ID of notification */, notificationBuilder.build()); } private void startInForeground(Map<String, String> data) { PendingIntent contentIntent = PendingIntent.getActivity( getApplicationContext(), 0, new Intent(), // add this PendingIntent.FLAG_UPDATE_CURRENT); // Intent notificationIntent = new Intent(this, WorkoutActivity.class); //PendingIntent pendingIntent=PendingIntent.getActivity(this,0,notificationIntent,0); NotificationCompat.Builder builder = new NotificationCompat.Builder(this, AppConstants.NOTIFICATION_CHANNEL_ID_CURRENT_LOCATION) .setSmallIcon(R.drawable.notification_icon) .setContentTitle(data.get("Provider")) .setContentText(data.get("New Jobs")) .setPriority(Notification.PRIORITY_DEFAULT) //.setContentText("HELLO") //.setTicker("TICKER") .setContentIntent(contentIntent); NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= 26) { NotificationChannel channel = new NotificationChannel(AppConstants.NOTIFICATION_CHANNEL_ID_CURRENT_LOCATION, AppConstants.NOTIFICATION_CHANNEL_NAME_CURRENT_LOCATION, NotificationManager.IMPORTANCE_DEFAULT); channel.setDescription(AppConstants.NOTIFICATION_CHANNEL_DESC_CURRENT_LOCATION); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.createNotificationChannel(channel); } mNotificationManager.notify(1, builder.build()); } }
package com.tencent.mm.plugin.wenote.model.a; import java.io.Serializable; public final class p implements Serializable { public boolean qpf = false; public long qpg = -1; public long qph = -1; public boolean qpi = false; public String qpj = ""; public String qpk = ""; public int qpl = 0; public int qpm = 0; public final String bZi() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("topIsOpenFromSession=").append(this.qpf).append(" topLocalId=").append(this.qpg).append(" topMsgId=").append(this.qph).append(" topTitle=").append(this.qpj).append(" topNoteXml=").append(this.qpk).append(" topLastPosition=").append(this.qpl).append(" topLastOffset=").append(this.qpm); return stringBuilder.toString(); } }
package presentacion.controlador.command.CommandMaterial; import java.util.Collection; import negocio.factorias.FactorySA; import negocio.material.SAMaterial; import presentacion.contexto.Contexto; import presentacion.controlador.command.Command; import presentacion.eventos.EventosMaterial; import negocio.material.TransferMaterial; public class ListarMaterial implements Command { @Override public Contexto execute(Object objeto) { final SAMaterial sa = FactorySA.getInstance().createSAMaterial(); String mensaje; Contexto contexto; try { Collection<TransferMaterial> listaMateriales = sa.listarMaterial(); contexto = new Contexto(EventosMaterial.LISTAR_MATERIALES_OK, listaMateriales); } catch (final Exception e) { mensaje = e.getMessage(); contexto = new Contexto(EventosMaterial.LISTAR_MATERIALES_KO, mensaje); } return contexto; } }
package com.epam.restaurant.entity; import org.junit.Assert; import org.junit.Test; import java.util.Date; import static org.junit.Assert.*; /** * Created by Вероника on 16.03.2016. */ public class NewsTest { private News news = new News("name",new Date(),"content","image"); @Test public void testGetName() throws Exception { assertEquals("name", news.getName()); } @Test public void testSetName() throws Exception { News news = new News(); news.setName("name"); assertEquals("name", news.getName()); } @Test public void testGetDate() throws Exception { assertEquals(new Date(), news.getDate()); } @Test public void testSetDate() throws Exception { News news = new News(); news.setDate(new Date()); assertEquals(new Date(), news.getDate()); } @Test public void testGetContent() throws Exception { assertEquals("content", news.getContent()); } @Test public void testSetContent() throws Exception { News news = new News(); news.setContent("content"); assertEquals("content",news.getContent()); } @Test public void testGetImage() throws Exception { assertEquals("image",news.getImage()); } @Test public void testSetImage() throws Exception { News news = new News(); news.setImage("image"); assertEquals("image",news.getImage()); } @Test public void testEquals() throws Exception { News n1 = new News(); News n2 = new News(); Assert.assertTrue(n1.equals(n2) && n2.equals(n1)); } @Test public void testHashCode() throws Exception { News n1 = new News(); News n2 = new News(); Assert.assertEquals(n1, n2); Assert.assertTrue( n1.hashCode()==n2.hashCode() ); } }
package com.demo.domain; public class SpecialPower { private String description; private Rate rate; public SpecialPower() { } public SpecialPower(String desription, Rate rate) { this.setDescription(desription); this.setRate(rate); } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Rate getRate() { return rate; } public void setRate(Rate rate) { this.rate = rate; } }
package jdbc; import java.sql.*; import java.util.*; import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; import jdbc.tempMemberVO; public class tempMemberDAO { private final String JDBC_DRIVER="oracle.jdbc.driver.OracleDriver"; private final String JDBC_URL="jdbc:oracle:thin:@localhost:1521:orcl"; private final String USER="scott"; private final String PASS="tiger"; public tempMemberDAO() { try { Class.forName(JDBC_DRIVER); }catch (Exception e) { System.out.println("Error : JDBC 드라이버 로딩 실패!!!!!"); } } private Connection getConnection() { Connection con = null; try { Context init = new InitialContext(); DataSource ds = (DataSource)init.lookup("java:comp/env/jdbc/mydb"); con = ds.getConnection(); }catch(Exception e) { System.out.println("Conection 생성 실패~~~"); } return con; } public Vector<tempMemberVO> getMemberList() { Connection con = null; Statement stmt = null; ResultSet rs = null; Vector<tempMemberVO> vecList = new Vector<tempMemberVO>(); try { // con = DriverManager.getConnection(JDBC_URL, USER, PASS); con = getConnection(); String strQuery ="select * from tempMember"; stmt = con.createStatement(); rs = stmt.executeQuery(strQuery); while(rs.next()) { tempMemberVO vo = new tempMemberVO(); vo.setId(rs.getString("id")); vo.setPasswd(rs.getString("passwd")); vo.setName(rs.getString("name")); vo.setMem_num1(rs.getString("mem_num1")); vo.setMem_num2(rs.getString("mem_num2")); vo.setEmail(rs.getString("e_mail")); vo.setPhone(rs.getString("phone")); vo.setZipcode(rs.getString("zipcode")); vo.setAddress(rs.getString("address")); vo.setJob(rs.getString("job")); vecList.add(vo); } }catch(Exception ex) { System.out.println("Exception :"+ex); }finally { if(rs != null) try {rs.close();}catch(SQLException se) {}; if(stmt != null) try {stmt.close();}catch(SQLException se) {}; if(con != null) try {con.close();}catch(SQLException se) {}; } return vecList; } }
package org.foobarspam.cotxox.conductores; import java.util.ArrayList; public class Conductor { //Propiedades private String nombre = " "; private String modelo = " "; private String matricula = " "; private double valoracionMedia = 0d; private ArrayList<Byte> valoraciones = new ArrayList<Byte>(); private boolean ocupado = false; //Constructor por defecto public Conductor(){ } //Constructor como se pide en main public Conductor( String nombre){ this.nombre = nombre; } public String getModelo() { return modelo; } public void setModelo(String modelo) { this.modelo = modelo; } public ArrayList<Byte> getValoraciones() { return valoraciones; } public void setValoraciones(ArrayList<Byte> valoraciones) { this.valoraciones = valoraciones; } public String getMatricula() { return matricula; } public void setMatricula(String matricula) { this.matricula = matricula; } public void setValoracion(byte valoracion) { valoraciones.add(valoracion); } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public double getValoracion() { double valoracionFinal = 0.0d; for( int i=0; i<getValoraciones().size(); i++) { valoracionFinal+=getValoraciones().get(i); } return valoracionFinal / getValoraciones().size(); } public boolean isOcupado() { return this.ocupado; } public void setOcupado(boolean ocupado) { this.ocupado = ocupado; } }
package com.ck.hello.nestrefreshlib.View.RefreshViews.HeadWrap; import android.content.Context; import android.view.ViewGroup; import android.widget.LinearLayout; /** * Created by vange on 2017/9/1. */ public interface WrapInterface { LinearLayout getHeaderLayout(); LinearLayout getFootLayout(); Context getContext(); }
package com.example.spring; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface MySpringApplication { }
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.Collection; import java.util.HashSet; import org.junit.Test; public class StudentTests { @Test(timeout = 500) public void basicDisjointTestSameSet() { HashSet<String> set = new HashSet<String>(); set.add("a"); set.add("b"); set.add("c"); set.add("d"); DisjointSets<String> disjointSet = new DisjointSets<String>(set); assertTrue(disjointSet.sameSet("a", "a")); } @Test(timeout = 500) public void disjointMergeWithSimilarElements() { HashSet<String> set = new HashSet<String>(); set.add("a"); set.add("b"); set.add("c"); set.add("d"); DisjointSets<String> disjointSet = new DisjointSets<String>(set); disjointSet.merge("a", "b"); disjointSet.merge("a", "c"); disjointSet.merge("c", "d"); assertTrue(disjointSet.sameSet("a", "b")); assertTrue(disjointSet.sameSet("a", "c")); assertTrue(disjointSet.sameSet("a", "d")); } @Test(timeout = 500) public void linearKruskals() { Graph linearGraph = new Graph("4 1 2 1 2 3 1 3 4 1 4 5 1"); int mstSize = 4; int mstTotalWeight = 4; int resultWeight = 0; Collection<Edge> resultMST = MST.kruskals(linearGraph); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); assertEquals(mstSize, resultMST.size()); for (Edge e : resultMST) { resultWeight = resultWeight + e.getWeight(); } assertEquals(mstTotalWeight, resultWeight); } @Test(timeout = 500) public void circularKruskals() { Graph circularGraph = new Graph("5 1 2 1 2 3 1 3 4 1 4 5 1 5 1 2"); Graph linearGraph = new Graph("4 1 2 1 2 3 1 3 4 1 4 5 1"); int mstSize = 4; int mstTotalWeight = 4; int resultWeight = 0; Collection<Edge> resultMST = MST.kruskals(circularGraph); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); assertEquals(mstSize, resultMST.size()); for (Edge e : resultMST) { resultWeight = resultWeight + e.getWeight(); } assertEquals(mstTotalWeight, resultWeight); } @Test(timeout = 500) public void linearPrims() { Graph linearGraph = new Graph("4 1 2 1 2 3 1 3 4 1 4 5 1"); int mstSize = 4; int mstTotalWeight = 4; int resultWeight = 0; Collection<Edge> resultMST = MST.prims(linearGraph, 1); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(linearGraph, 2); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(linearGraph, 3); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(linearGraph, 4); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(linearGraph, 5); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); assertEquals(mstSize, resultMST.size()); for (Edge e : resultMST) { resultWeight = resultWeight + e.getWeight(); } assertEquals(mstTotalWeight, resultWeight); } @Test(timeout = 500) public void circularPrims() { Graph circularGraph = new Graph("5 1 2 1 2 3 1 3 4 1 4 5 1 5 1 2"); Graph linearGraph = new Graph("4 1 2 1 2 3 1 3 4 1 4 5 1"); int mstSize = 4; int mstTotalWeight = 4; int resultWeight = 0; Collection<Edge> resultMST = MST.prims(circularGraph, 1); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(circularGraph, 1); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(circularGraph, 2); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(circularGraph, 3); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(circularGraph, 4); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); resultMST = MST.prims(circularGraph, 5); assertTrue(linearGraph.getEdgeList().containsAll(resultMST)); assertEquals(mstSize, resultMST.size()); for (Edge e : resultMST) { resultWeight = resultWeight + e.getWeight(); } assertEquals(mstTotalWeight, resultWeight); } }
package com.example.emp.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.example.emp.entity.Employee; import com.example.emp.exceptions.EmployeeNotFoundException; import com.example.emp.repository.EmployeeRepository; @Service public class EmployeeService { @Autowired EmployeeRepository repo; public List<Employee> getAllEmps() { return repo.findAll(); } public void addemp(Employee emp) { repo.save(emp); } public void deleteEmp(int id) { Employee emp = repo.findById(id).orElse(null); if (emp == null) { throw new EmployeeNotFoundException("employeeId " + id + " not avilable to delete"); } repo.deleteById(id); } public Employee getEmpByid(int id) { Employee emp = repo.findById(id).orElse(null); if (emp == null) { throw new EmployeeNotFoundException("employeeId " + id + " not avilable to get"); } return emp; } }
package in.hocg.database; import org.springframework.stereotype.Component; /** * (๑`灬´๑) * Created by hocgin on 十一月28 028. * 数据库预处理器 */ @Component public interface Seeder { void run(); }
package org.dimigo.basic; public class Operator { public static void main(String[] args) { int S1a = 9, S1b = 10; double S1h = 5.8; int S2a = 9; double S2h = 5.4; double S1, S2; S1 = (S1a + S1b)*S1h/2; S2 = S2a*S2h; System.out.println("<< 도형 넓이 비교 >>"); System.out.println("사다리꼴 넓이 : " + S1); System.out.println("평행사변형 넓이 : " + S2 + "\n"); double result; result = S1 > S2 ? S1 - S2 : S2 - S1; if ( S1 > S2 ) { System.out.println("사다리꼴이 평행사변형 보다 " + result + "더 큽니다."); } else if ( S1 < S2 ) { System.out.println("평행사변형이 사다리꼴 보다 " + result + "더 큽니다."); } else { System.out.println("사다리꼴과 평행사변형의 넓이가 같습니다."); } } }
package com.example.myapplication; import android.annotation.SuppressLint; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.os.Binder; import android.os.IBinder; import android.os.Message; import android.util.Log; import android.widget.Toast; import com.example.myapplication.Entry.Song; import com.example.myapplication.Util.MyTime; import java.io.IOException; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Objects; import static com.example.myapplication.MainActivity.MainHandler.SEEKBAR_RESET; import static com.example.myapplication.MainActivity.MainHandler.SONG_NEXT; import static com.example.myapplication.MainActivity.MainHandler.SONG_PAUSE; import static com.example.myapplication.MainActivity.MainHandler.SONG_PREV; import static com.example.myapplication.MainActivity.MainHandler.SONG_RESUME; public class MusicService extends Service { private static final String TAG = MusicService.class.getSimpleName(); private MediaPlayer player; @SuppressLint("UseSparseArrays") private HashMap<Integer, ArrayList<Song>> lists = new HashMap<>(2); private int index = 0; private int sId = 0; private MainActivity.MainHandler handler; public MusicService() { } @Override public void onCreate() { Log.d(TAG, "onCreate: MusicService"); lists.put(0,new ArrayList<>()); lists.put(1,new ArrayList<>()); super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand: "); lists.put(0, intent.getParcelableArrayListExtra("songList")); lists.put(1, intent.getParcelableArrayListExtra("starList")); return super.onStartCommand(intent, flags, startId); } public void nextSong() { if (player.isPlaying()) player.pause(); index = (index + 1) % lists.get(sId).size(); play(sId,index); Message msg = Message.obtain(); msg.what = SONG_NEXT; msg.arg1 = index; handler.sendMessage(msg); } public void prevSong() { if (player.isPlaying()) player.pause(); index--; if (index == -1) { index = lists.get(sId).size() - 1; } play(sId,index); Message msg = Message.obtain(); msg.what = SONG_PREV; msg.arg1 = index; handler.sendMessage(msg); } //指定歌曲播放 public void play(int id, int i) { player.pause(); player.reset(); if (i < 0 | id < 0 | id > 1) { Log.e(TAG, "play: i < 0 or sId is not in {1,0}", new IndexOutOfBoundsException()); return; } if (i > Objects.requireNonNull(lists.get(id)).size() -1) return; Log.d(TAG, "play: " + lists.get(id).get(i).toString()); String song = lists.get(id).get(i).getPath().toString(); try { player.setDataSource(song); player.prepareAsync(); sId = id; // player.setOnCompletionListener(player -> nextSong()); Message msg = Message.obtain(); msg.arg1 = i; msg.what = SEEKBAR_RESET; handler.sendMessage(msg); index = i; } catch (IOException e) { Toast.makeText(getApplicationContext(), lists.get(id).get(i).getTitle() + "文件不可用", Toast.LENGTH_SHORT).show(); lists.get(id).remove(i); play(id,i % lists.get(id).size()); Log.e(TAG, "play: ", e); } } //播放暂停 public void play() { if (handler == null) { Log.e(TAG, "play: service", new Exception("HandlerNotFound")); return; } if (player.isPlaying()) { player.pause(); handler.sendEmptyMessage(SONG_PAUSE); Log.d(TAG, "play: pause"); return; } player.start(); handler.sendEmptyMessage(SONG_RESUME); Log.d(TAG, "play: resume"); } public void seekTo(int progress) { player.seekTo(progress); Log.d(TAG, "seekTo: " + MyTime.formatTime(progress)); } //收藏 public void starSong(Song song) { if (song == null) return; lists.get(1).add(song); Log.d(TAG, "starSong: "); } public int getDuration() { Log.d(TAG, "getDuration: " + MyTime.formatTime(player.getDuration())); return player.getDuration(); } public int getProgress() { return player.getCurrentPosition(); } public int getDataCount(int id) { Log.d(TAG, "getDataCount: " + lists.get(id).size()); return lists.get(id).size(); } public void addSong(int id, Song newSong) { lists.get(id).add(newSong); } public void setHandler(MainActivity.MainHandler handler) { this.handler = handler; } //初始化player public void initPlayer(){ try { player = new MediaPlayer(); player.setLooping(true); player.setOnPreparedListener(player -> { Message msg = Message.obtain(); msg.what = SEEKBAR_RESET; msg.arg1 = index; player.start(); handler.sendMessage(msg); }); player.setOnErrorListener((MediaPlayer mp, int what, int extra) -> { return false; }); if (lists.get(0).size() > 0) { player.setDataSource(lists.get(0).get(0).getPath().toString()); player.prepareAsync(); } } catch (IOException e) { e.printStackTrace(); } } @Override public IBinder onBind(Intent intent) { return new LocalBinder(); } class LocalBinder extends Binder { MusicService getService() { return MusicService.this; } } public Map.Entry getIdAndIndex() { Map.Entry e = new Map.Entry() { @Override public Object getKey() { return sId; } @Override public Object getValue() { return index; } @Override public Object setValue(Object value) { return null; } }; return e; } @Override public void onDestroy() { player.reset(); player.release(); super.onDestroy(); } }
package com.lqs.hrm.service.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.lqs.hrm.entity.Roles; import com.lqs.hrm.entity.RolesExample; import com.lqs.hrm.mapper.RolesMapper; import com.lqs.hrm.service.RolesService; /** * 角色Service接口实现类 * @author luckyliuqs * */ @Service public class RolesServiceImpl implements RolesService{ @Autowired private RolesMapper rolesMapper; @Override public Roles get(Integer roleId) { return rolesMapper.selectByPrimaryKey(roleId); } @Override public int add(Roles roles) { return rolesMapper.insertSelective(roles); } @Override public int update(Roles roles) { return rolesMapper.updateByPrimaryKey(roles); } /** * 获取所有角色信息 */ @Override public List<Roles> listByNo() { RolesExample example = new RolesExample(); example.or().andRoleIdIsNotNull(); return rolesMapper.selectByExample(example); } }
package com.rx.rxmvvmlib.core.audio; /** * Created by ZhouMeng on 2018/9/5. * 录音对象的状态 */ public enum AudioStatus { //未开始 STATUS_NO_READY, //预备 STATUS_READY, //录音 STATUS_START, //暂停 STATUS_PAUSE, //停止 STATUS_STOP }
package com.ekniernairb.dicejobsearcher.staticClasses; /** * Class to keep track of useful information project-wide. */ public class Api_Data { public static int mCurrentPage; public static int mFirstDocument; public static int mLastDocument; // total records in API query. public static int mCount; }
package com.xvr.serviceBook.entity; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.Setter; import javax.persistence.*; @Getter @Setter @RequiredArgsConstructor @Entity @Table(name = "equipment_type") public class TypeEquipment { @Id @Column(name = "id", nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(name="type") private String type; @OneToOne(fetch = FetchType.LAZY, mappedBy = "typeEquipment") private Equipment equipment; }
package com.uwetrottmann.trakt5.entities; import java.util.List; public class ListReorderResponse { public Integer updated; public List<Long> skipped_ids; }
package lab01.tdd; public class MultipleOfStrategy implements SelectStrategy{ final private int divisor; public MultipleOfStrategy(final int divisor) { this.divisor = divisor; } @Override public boolean apply(int element) { return element % divisor == 0; } }
package com.box.androidsdk.content.requests; import com.box.androidsdk.content.models.BoxObject; import java.io.Serializable; /** * This class acts as a wrapper for holding onto the response or exceptions returned from the result of a BoxRequest. * @param <E> The BoxObject that was generated from a response to a BoxRequest. */ public class BoxResponse<E extends BoxObject> implements Serializable { protected final E mResult; protected final Exception mException; protected final BoxRequest mRequest; // BoxResponse should never be instantiated by themselves and instead should be created from a BoxHttpResponse /** * * @param result the BoxObject generated from handling BoxHttpResponse if any. * @param ex the exception thrown from a handling a BoxHttpResponse if any. * @param request the original request that generated the BoxHttpResponse sourcing the result or exception. */ public BoxResponse(E result, Exception ex, BoxRequest request) { mResult = result; mException = ex; mRequest = request; } /** * * @return the BoxObject parsed from a given server response. */ public E getResult() { return mResult; } /** * * @return the exception thrown from a given server response. */ public Exception getException() { return mException; } /** * * @return the request used to generate the response or exception backing this object. */ public BoxRequest getRequest() { return mRequest; } /** * * @return true if this object was not created from an exception, false otherwise. */ public boolean isSuccess() { return mException == null; } }
import java.io.*; import java.net.URL; import javax.sound.sampled.*; class Sound { String[] FILES = {"sounds/Bottle.aiff", "sounds/Morse.aiff", "sounds/Pop.aiff", "sounds/Tink.aiff", "sounds/tap1.wav", "sounds/tap2.wav", "sounds/tap3.wav", "sounds/tap4.wav", "sounds/tap5.wav", "sounds/tap6.wav", "sounds/tap7.wav", "sounds/tap8.wav", "sounds/tap9.wav", "sounds/tap10.wav", "sounds/tap11.wav", "sounds/tap12.wav", }; Clip clip; Sound(int index) { try { URL url = this.getClass().getClassLoader().getResource(FILES[index]); AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(url); clip = AudioSystem.getClip(); clip.open(audioInputStream); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (LineUnavailableException e) { e.printStackTrace(); } } void play() { if (clip.isRunning()) clip.stop(); // Stop the player if it is still running clip.setFramePosition(0); // rewind to the beginning clip.start(); // Start playing } }
package edu.mum.cs.cs544.exercises.b; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import edu.mum.cs.cs544.exercises.a.Product; @Entity public class Book extends Product { private String title ; public Book() { } public Book(String title, String description) { super("Book", description); this.title = title; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }
package org.maven.ide.eclipse.swtvalidation; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.swt.custom.CCombo; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Widget; import org.netbeans.validation.api.Validator; import org.netbeans.validation.api.ValidatorUtils; import org.netbeans.validation.api.ui.GroupValidator; import org.netbeans.validation.api.ui.ValidationGroup; import org.netbeans.validation.api.ui.ValidationListener; import org.netbeans.validation.api.ui.ValidationListenerFactory; import org.netbeans.validation.api.ui.ValidationStrategy; import org.netbeans.validation.api.ui.ValidationUI; import org.netbeans.validation.api.ui.swing.SwingComponentDecorationFactory; /** * {@link ValidationGroup} subclass specialized for handling Swing components. This subclass has {@code add}-methods for * adding GUI-components for common Swing cases. There are also a method for getting the * {@link SwingComponentDecorationFactory} used by this SwingValidationGroup to create decorations for the separate * GUI-components added to the group. A custom {@code SwingComponentDecorationFactory} can be specified when creating * the {@code SwingValidationGroup}. * <p> * For components this library supports out-of-the-box such as <code>JTextField</code>s or <code>JComboBox</code>es, * simply call one of the <code>add()</code> methods with your component and validators. For validating your own * components or ones this class doesn't have methods for, you implement {@link ValidationListener}s, and add them to * the {@code ValidationGroup} using the the method * {@link ValidationGroup#add(org.netbeans.validation.api.ui.ValidationItem)} */ public final class SwtValidationGroup extends ValidationGroup { private final SwtComponentDecorationFactory decorator; private SwtValidationGroup( GroupValidator additionalGroupValidation, SwtComponentDecorationFactory decorator, ValidationUI... ui ) { super( additionalGroupValidation, ui ); if ( ui == null ) { throw new NullPointerException(); } this.decorator = ( decorator != null ? decorator : SwtComponentDecorationFactory.getDefault() ); } public static SwtValidationGroup create( ValidationUI... ui ) { assert Display.getCurrent() != null : "Must be called on event thread"; return new SwtValidationGroup( null, null, ui ); } /** * Creates a {@code SWTValidationGroup}. Will use a {@code SwtComponentDecorationFactory} returned by * {@link SwtComponentDecorationFactory#get()} to modify the appearance of subsequently added components (to show * that there is a problem with a component's content). To instead use a custom {@code * SwingComponentDecorationFactory}, call * {@link #create(org.netbeans.validation.api.ui.GroupValidator, SwtComponentDecorationFactory, org.netbeans.validation.api.ui.ValidationUI[]) } * * @param ui Zero or more {@code ValidationUI}:s. Will be used by the {@code SWTValidationGroup} to show the leading * problem (if any) */ public static SwtValidationGroup create( GroupValidator additionalGroupValidation, ValidationUI... ui ) { assert Display.getCurrent() != null : "Must be called on event thread"; return new SwtValidationGroup( additionalGroupValidation, null, ui ); } /** * Creates a {@code SWTValidationGroup}. * * @param additionalGroupValidation may be null * @param ui Zero or more {@code ValidationUI}:s. Will all be used by the {@code SWTValidationGroup} to show the * leading problem (if any) * @param decorator A decorator to be used to modify the appearance of subsequently added components (to show that * there is a problem with a component's content). */ public static SwtValidationGroup create( GroupValidator additionalGroupValidation, SwtComponentDecorationFactory decorator, ValidationUI... ui ) { assert Display.getCurrent() != null : "Must be called on event thread"; return new SwtValidationGroup( additionalGroupValidation, decorator, ui ); } /** * Gets the currently set component decorator used to modify components appearance (to show that there is a problem * with a component's content). * * @return decorator A decorator. May not be null. */ final SwtComponentDecorationFactory getComponentDecorationFactory() { return decorator; } @Override protected final <T> ValidationUI decorationFor( T comp ) { ValidationUI dec = comp instanceof Widget ? this.getComponentDecorationFactory().decorationFor( (Widget) comp ) : ValidationUI.NO_OP; return dec; } /** * Add a text component to be validated using the passed validators. * <p> * When a problem occurs, the created ValidationListener will use a {@link ValidationUI} created by this {@code * ValidationGroup} to decorate the component. * <p> * <b>Note:</b> All methods in this class must be called from the AWT Event Dispatch thread, or assertion errors * will be thrown. Manipulating components on other threads is not safe. * <p> * Swing {@code Document}s (the model used by JTextComponent) are thread-safe, and can be modified from other * threads. In the case that a text component validator receives an event on another thread, validation will be * scheduled for later, <i>on</i> the event thread. * * @param comp A text component such as a <code>JTextField</code> * @param validators One or more Validators */ public final void add( Text comp, Validator<String>... validators ) { assert Display.getCurrent() != null : "Must be called on event thread"; assert validators.length > 0 : "Empty validator array"; Validator<String> merged = ValidatorUtils.merge( validators ); ValidationListener<Text> vl = ValidationListenerFactory.createValidationListener( comp, ValidationStrategy.DEFAULT, this.getComponentDecorationFactory().decorationFor( comp ), merged ); this.addItem( vl, false ); } /** * Add a combo box to be validated using the passed validators * <p> * When a problem occurs, the created {@link ValidationListener} will use a {@link ValidationUI} created by this * {@code ValidationGroup} to decorate the component. * <p> * <b>Note:</b> All methods in this class must be called from the AWT Event Dispatch thread, or assertion errors * will be thrown. Manipulating components on other threads is not safe. * * @param box A combo box component * @param validators One or more Validators */ public final void add( Combo box, Validator<String>... validators ) { assert Display.getCurrent() != null : "Must be called on event thread"; ValidationListener<Combo> vl = ValidationListenerFactory.createValidationListener( box, ValidationStrategy.DEFAULT, this.getComponentDecorationFactory().decorationFor( box ), ValidatorUtils.<String> merge( validators ) ); this.addItem( vl, false ); } public final void add( CCombo box, Validator<String>... validators ) { assert Display.getCurrent() != null : "Must be called on event thread"; ValidationListener<CCombo> vl = ValidationListenerFactory.createValidationListener( box, ValidationStrategy.DEFAULT, this.getComponentDecorationFactory().decorationFor( box ), ValidatorUtils.<String> merge( validators ) ); this.addItem( vl, false ); } public final void add( ISelectionProvider selectionProvider, Validator<ISelection>... validators ) { assert Display.getCurrent() != null : "Must be called on event thread"; ValidationListener<ISelectionProvider> vl = ValidationListenerFactory.createValidationListener( selectionProvider, ValidationStrategy.DEFAULT, ValidationUI.NO_OP, ValidatorUtils.<ISelection> merge( validators ) ); this.addItem( vl, false ); } // TODO // /** // * Add a JList to be validated using the passed validators // * // * <p> When a problem occurs, the created {@link ValidationListener} will // * use a {@link ValidationUI} created by this {@code ValidationGroup} to decorate // * the component. // * // * <p> <b>Note:</b> All methods in this class must be called from // * the AWT Event Dispatch thread, or assertion errors will be // * thrown. Manipulating components on other threads is not safe. // * // * @param list A JList component // * @param validators One or more Validators // */ // @SuppressWarnings("unchecked") // public final void add(List list, Validator<Integer[]>... validators) { // assert Display.getCurrent() != null : "Must be called on event thread"; // this.add (ValidationListenerFactory.createValidationListener(list, ValidationStrategy.DEFAULT, // this.getComponentDecorationFactory().decorationFor(list), ValidatorUtils.merge(validators))); // } // TODO // /** // * Add a validator of button models - typically to see if any are selected. // * // * <p> <b>Note:</b> All methods in this class must be called from // * the AWT Event Dispatch thread, or assertion errors will be // * thrown. Manipulating components on other threads is not safe. // * // * @param buttons The buttons // * @param validators A number of Validators // */ // @SuppressWarnings("unchecked") // public final void add(final Button[] buttons, Validator<Integer[]>... validators) { // assert Display.getCurrent() != null : "Must be called on event thread"; // this.add (ValidationListenerFactory.createValidationListener(buttons, ValidationStrategy.DEFAULT, // ValidationUI.NO_OP, ValidatorUtils.merge(validators))); // } // TODO // /** // * Create a label which will show the current problem if any, which // * can be added to a panel that uses validation // * // * @return A JLabel // */ // public final Label createProblemLabel() { // assert Display.getCurrent() != null : "Must be called on event thread"; // final MultilineLabel result = new MultilineLabel(); // addUI(result.createUI()); // return result; // } // // /** // * Create a Popup which can be shown over a component to display what the // * problem is. The resulting popup will be word-wrapped and effort will be // * made to ensure it fits on-screen in the case of lengthy error messages. // * // * @param problem The problem to show // * @param target The target component // * @param relativeLocation The coordinates where the popup should appear, // * <i>in the coordinate space of the target component, not the screen</i>. // * @return A popup. Generally, use the returned popup once and get a new // * one if you want to show a message again. The returned popup will take // * care of hiding itself on component hierarchy changes. // */ // static Popup createProblemPopup (Problem problem, Component target, Point relativeLocation) { // return MultilineLabelUI.showPopup(problem, target, relativeLocation.x, relativeLocation.y); // } /** * Client property which can be set to provide a component's name for use in validation messages. If not set, the * component's <code>getName()</code> method is used. */ private static final String CLIENT_PROP_NAME = "_name"; /** * Get a string name for a component using the following strategy: * <ol> * <li>Check <code>jc.getClientProperty(CLIENT_PROP_NAME)</code></li> * <li>If that returned null, call <code>jc.getName()</code> * </ol> * * @param jc The component * @return its name, if any, or null */ public static String nameForComponent( Widget jc ) { String result = (String) jc.getData( CLIENT_PROP_NAME ); if ( result == null ) { result = jc.toString(); } return result; } public static void setComponentName( Widget comp, String localizedName ) { comp.setData( CLIENT_PROP_NAME, localizedName ); } }
/* * Copyright 2006 Ameer Antar. * * 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.antfarmer.ejce; import java.nio.charset.Charset; import java.security.GeneralSecurityException; import java.security.Key; import org.antfarmer.ejce.parameter.AlgorithmParameters; /** * Interface for encrypting/decrypting byte arrays. * * @author Ameer Antar * @version 1.0 * @param <T> the concrete type of this Encryptor object. */ public interface EncryptorInterface<T extends EncryptorInterface<T>> { /** * Initializes the encryptor. AlgorithmParameters must be set before calling this method. * * @throws GeneralSecurityException GeneralSecurityException */ void initialize() throws GeneralSecurityException; /** * Encrypts the byte array. * * @param bytes the byte array to be encrypted * @return the encrypted byte array * @throws GeneralSecurityException GeneralSecurityException */ byte[] encrypt(byte[] bytes) throws GeneralSecurityException; /** * Encrypts the byte array using the given <code>Key</code>. * * @param bytes the byte array to be encrypted * @param encKey the encryption key * @return the encrypted byte array * @throws GeneralSecurityException GeneralSecurityException */ byte[] encrypt(byte[] bytes, Key encKey) throws GeneralSecurityException; /** * Decrypts the byte array. * * @param bytes the byte array to be decrypted * @return the decrypted byte array * @throws GeneralSecurityException GeneralSecurityException */ byte[] decrypt(byte[] bytes) throws GeneralSecurityException; /** * Decrypts the byte array using the given <code>Key</code>. * * @param bytes the byte array to be decrypted * @param decKey the decryption key * @return the decrypted byte array * @throws GeneralSecurityException GeneralSecurityException */ byte[] decrypt(byte[] bytes, Key decKey) throws GeneralSecurityException; /** * Sets the algorithm parameters used for initialization. * * @param parameters the algorithm parameters * @return this encryptor */ T setAlgorithmParameters(AlgorithmParameters<?> parameters); /** * Gets the algorithm parameters used for initialization. * * @return the algorithm parameters used for initialization */ AlgorithmParameters<?> getAlgorithmParameters(); /** * Indicates whether or not the encryptor has been initialized. * * @return true if the encryptor has been initialized, false otherwise */ boolean isInitialized(); /** * Returns the charset used by the encryptor. * @return the charset used by the encryptor */ Charset getCharset(); }
import java.util.HashMap; import java.util.ArrayList; import java.util.List; import java.util.Collection; /** * Class Location - a Location in an adventure game. * * This class is part of the "SportyZombies" application. * "SportyZombies" is a very simple, text based adventure game. * * A "Location" represents one location in the scenery of the game. It is * connected to other Locations via exits. The exits are stored in a Map. * Each map entry consists of an exit name and the Location the exit leads to. * * @author David Panagiotopulos and Luis Hankel * @version 2018.01.15 */ public class Location { private HashMap<String, Location> exits; private String description; private ArrayList <Item> items; /** * Create a Location described "description". Initially, it has * no exits. "description" is something like "a kitchen" or * "an open court yard". * @param description The Location's description. */ public Location(String description) { this.description = description; exits = new HashMap<>(); items = new ArrayList <>(); } public void addItem (Item item) { items.add(item); } public void addItems (List<Item> item) { items.addAll(item); } /** * Add an exit to the Location. */ public void addExit(String name, Location exit) { exits.put(name, exit); } /** * @return The description of the Location. */ public String getDescription() { return description; } /** * Gets the long description of the Location. It consists of the description * plus a list of all exits. * @return The long description of the Location. */ public String getLongDescription() { return "You are " + getDescription() + "\n" + getExits(); } /** * Gets a list of all exits available for this Location. * @return The exits available. */ public String getExits(){ String allExits = "Exits: "; for(String name : exits.keySet()){ allExits += name + ", "; } allExits = allExits.replaceAll(", $",""); return allExits; } public Item getItem(String itemName) { for (Item item : items) { if (item.getName().equalsIgnoreCase(itemName)) { return item; } } return null; } public String getItems(){ String labelItems = "Items: "; for(Item item: items){ labelItems += item.getName()+ "|"; } for(Item item: items){ labelItems += "\n"+item.getDescription() ; } return labelItems; } public boolean containsItem(String itemName){ for(Item item: items){ if(item.getName().equalsIgnoreCase(itemName)) return true; } return false; } public Item removeItem(String itemName){ Item foundItem = null; for(Item item: items){ if(item.getName().equalsIgnoreCase(itemName)){ foundItem = item; items.remove(item); break; } } return foundItem; } /** * Gets the Location an exit leads to. * @return The Location the exit leads to. */ public Location getExit(String exit){ return exits.get(exit); } /** * Gets a collection containing all exit locations. * @return The values from the exits HashMap. */ public Collection<Location> getExitLocations() { return exits.values(); } }
package com.yuecheng.yue.provider; import android.content.Context; import android.text.Spannable; import android.view.View; import android.view.ViewGroup; import com.yuecheng.yue.message.AddFriendsMessage; import io.rong.imkit.model.ProviderTag; import io.rong.imkit.model.UIMessage; import io.rong.imkit.widget.provider.IContainerItemProvider; /** * Created by Administrator on 2018/1/29. */ @ProviderTag(messageContent = AddFriendsMessage.class) public class AddFriendMessageItemProvider extends IContainerItemProvider.MessageProvider<AddFriendsMessage> { @Override public void bindView(View view, int i, AddFriendsMessage addFriendsMessage, UIMessage uiMessage) { } @Override public Spannable getContentSummary(AddFriendsMessage addFriendsMessage) { return null; } @Override public void onItemClick(View view, int i, AddFriendsMessage addFriendsMessage, UIMessage uiMessage) { } @Override public View newView(Context context, ViewGroup viewGroup) { return null; } }
package Database; public class Main { public static void main(String[] args) { Database bd = new Database();; try{ bd.add(new User("gg","easy")); bd.add(new User("", "rekt")); }catch(DatabaseCorruptedException e){ System.out.println(e.getMessage()); } } }
package com.ttan.jdk8; /** * @Description: * @author ttan * @time 2019Äê12ÔÂ18ÈÕ ÏÂÎç3:57:05 */ public interface Interface1 extends Interface2,Interface3{ public void test1(); public static void staticFunc(){ System.out.println("Interface1"); } }
package com.codegym.repository.dichvu; import com.codegym.model.dichvu.DichVu; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; public interface DichVuRepository extends JpaRepository<DichVu,String> { Page<DichVu> findByIdDichVuContainingOrTenDichVuContaining(String keyword, String keyword2, Pageable pageable); }
package org.apache.commons.net.nntp; import java.util.Calendar; public final class NewGroupsOrNewsQuery { private final String __date; private final String __time; private StringBuffer __distributions; private StringBuffer __newsgroups; private final boolean __isGMT; public NewGroupsOrNewsQuery(Calendar date, boolean gmt) { this.__distributions = null; this.__newsgroups = null; this.__isGMT = gmt; StringBuilder buffer = new StringBuilder(); int num = date.get(1); String str = Integer.toString(num); num = str.length(); if (num >= 2) { buffer.append(str.substring(num - 2)); } else { buffer.append("00"); } num = date.get(2) + 1; str = Integer.toString(num); num = str.length(); if (num == 1) { buffer.append('0'); buffer.append(str); } else if (num == 2) { buffer.append(str); } else { buffer.append("01"); } num = date.get(5); str = Integer.toString(num); num = str.length(); if (num == 1) { buffer.append('0'); buffer.append(str); } else if (num == 2) { buffer.append(str); } else { buffer.append("01"); } this.__date = buffer.toString(); buffer.setLength(0); num = date.get(11); str = Integer.toString(num); num = str.length(); if (num == 1) { buffer.append('0'); buffer.append(str); } else if (num == 2) { buffer.append(str); } else { buffer.append("00"); } num = date.get(12); str = Integer.toString(num); num = str.length(); if (num == 1) { buffer.append('0'); buffer.append(str); } else if (num == 2) { buffer.append(str); } else { buffer.append("00"); } num = date.get(13); str = Integer.toString(num); num = str.length(); if (num == 1) { buffer.append('0'); buffer.append(str); } else if (num == 2) { buffer.append(str); } else { buffer.append("00"); } this.__time = buffer.toString(); } public void addNewsgroup(String newsgroup) { if (this.__newsgroups != null) { this.__newsgroups.append(','); } else { this.__newsgroups = new StringBuffer(); } this.__newsgroups.append(newsgroup); } public void omitNewsgroup(String newsgroup) { addNewsgroup("!" + newsgroup); } public void addDistribution(String distribution) { if (this.__distributions != null) { this.__distributions.append(','); } else { this.__distributions = new StringBuffer(); } this.__distributions.append(distribution); } public String getDate() { return this.__date; } public String getTime() { return this.__time; } public boolean isGMT() { return this.__isGMT; } public String getDistributions() { return (this.__distributions == null) ? null : this.__distributions.toString(); } public String getNewsgroups() { return (this.__newsgroups == null) ? null : this.__newsgroups.toString(); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\org\apache\commons\net\nntp\NewGroupsOrNewsQuery.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
package baway.com.liujianan20170227; import java.util.ArrayList; /** * Created by 刘嘉男 * on 2017/2/27 * 描述: */ public class Bean { public ArrayList<Data> data; }
package com.ibeiliao.pay.admin.controller.pay.form; import org.hibernate.validator.constraints.NotBlank; import java.io.Serializable; /** * 查询支付记录的条件 * @author linyi 2016/8/2. */ public class QueryPayRecordForm implements Serializable { private static final long serialVersionUID = 1L; /** * 买家帐号 */ private String buyerAccount; /** * 卖家ID */ private String sellerId; /** * 查询的时间范围 */ @NotBlank(message = "时间范围不能为空") private String createTimeRange; /** * 状态 */ private short status; private int page; private int pageSize; public String getBuyerAccount() { return buyerAccount; } public void setBuyerAccount(String buyerAccount) { this.buyerAccount = buyerAccount; } public String getSellerId() { return sellerId; } public void setSellerId(String sellerId) { this.sellerId = sellerId; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public short getStatus() { return status; } public void setStatus(short status) { this.status = status; } public String getCreateTimeRange() { return createTimeRange; } public void setCreateTimeRange(String createTimeRange) { this.createTimeRange = createTimeRange; } }
package sortomatic; import java.util.ArrayList; public class Estante { private double lenEstante; private ArrayList<Articulo> listaArticulos; public double getLenEstante() { return lenEstante; } public void setLenEstante(double lenEstante) { this.lenEstante = lenEstante; } public ArrayList<Articulo> getListaArticulos() { return listaArticulos; } public void setListaArticulos(ArrayList<Articulo> listaArticulos) { this.listaArticulos = listaArticulos; } public Estante(double longitud){ lenEstante= longitud; } public static void ordenarArticulos(){ } public void agregarArticulo(){ } @Override public String toString(){ String texto = ""; for (int i=0; i<listaArticulos.size();i++){ } return texto; } }
package com.testing.class6; //判断String[] args默认参数大小 public class StringHomeWork { public static void main(String[] args) { try { String s1=args[0]; String s2=args[1]; try { int i1=Integer.parseInt(s1); int i2=Integer.parseInt(s2); if (i1>i2){ System.out.println("参数1大于参数2!"); }else if(i1==i2){ System.out.println("参数1等于参数2!"); }else { System.out.println("参数1小于参数2!"); } } catch (NumberFormatException e) { // e.printStackTrace(); System.out.println("请输入两个类型为int的参数!"); } } catch (Exception e) { // e.printStackTrace(); System.out.println("请输入两个参数!"); } } }
package com.example.demo.Result; import java.io.Serializable; public class ServerResult<T> implements Serializable { private static final long serialVersionUID = 7393154872520762719L; private T data; private String message; private int code; public ServerResult() { } public ServerResult(T data, String message, int code) { this.data = data; this.message = message; this.code = code; } //自定义返回结果 public static <T> ServerResult<T> result(T data, String message, int code){ return new ServerResult<>(data, message, code); } //成功 public static <T> ServerResult<T> success(T data){ return new ServerResult<>(data, "success", 0); } //失败 public static <T> ServerResult<T> failure(T data){ return new ServerResult<>(data, "failure", -1); } public T getData() { return data; } public void setData(T data) { this.data = data; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public int getCode() { return code; } public void setCode(int code) { this.code = code; } }
package com.example.android.inventoryapp_stage1; import android.app.LoaderManager; import android.content.ContentUris; import android.content.ContentValues; import android.content.CursorLoader; import android.content.Intent; import android.content.Loader; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.ListView; import com.example.android.inventoryapp_stage1.data.StoreContract; import com.example.android.inventoryapp_stage1.data.StoreDbHelper; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.COLUMN_PRODUCT_NAME; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.COLUMN_PRICE; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.COLUMN_QUANTITY; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.COLUMN_SUPPLIER; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.COLUMN_SUPPLIER_PHONE; import static com.example.android.inventoryapp_stage1.data.StoreContract.StoreEntry.TABLE_NAME; public class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor> { /** * Identifier for the pet data loader */ private static final int STORE_LOADER = 0; /** * Adapter for the ListView */ StoreCursorAdapter mCursorAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Setup FAB to open EditorActivity Button addBook = (Button) findViewById(R.id.button_add_a_book); addBook.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, EditorActivity.class); startActivity(intent); } }); ListView storeListView = (ListView) findViewById(R.id.list); // Find and set empty view on the ListView, so that it only shows when the list has 0 items. View emptyView = findViewById(R.id.text_empty_view); storeListView.setEmptyView(emptyView); mCursorAdapter = new StoreCursorAdapter(this, null); storeListView.setAdapter(mCursorAdapter); storeListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(MainActivity.this, ItemActivity.class); Uri currentBookUri = ContentUris.withAppendedId(StoreContract.StoreEntry.CONTENT_URI, id); // Set the URI on the data field of the intent intent.setData(currentBookUri); // Launch the {@link EditorActivity} to display the data for the current pet. startActivity(intent); } }); // Kick off the loader getLoaderManager().initLoader(STORE_LOADER, null, this); } @Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { // Define a projection that specifies the columns from the table we care about. String[] projection = {StoreContract.StoreEntry._ID, StoreContract.StoreEntry.COLUMN_PRODUCT_NAME, StoreContract.StoreEntry.COLUMN_PRICE, StoreContract.StoreEntry.COLUMN_QUANTITY}; // This loader will execute the ContentProvider's query method on a background thread return new CursorLoader(this, // Parent activity context StoreContract.StoreEntry.CONTENT_URI, // Provider content URI to query projection, // Columns to include in the resulting Cursor null, // No selection clause null, // No selection arguments null); // Default sort order } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Update {@link StoreCursorAdapter} with this new cursor containing updated pet data mCursorAdapter.swapCursor(data); } @Override public void onLoaderReset(Loader<Cursor> loader) { // Callback called when the data needs to be deleted mCursorAdapter.swapCursor(null); } }
package de.fraunhofer.fokus.ants.jipfix; import de.fraunhofer.fokus.ants.jipfix.data.*; import com.thoughtworks.xstream.*; public class ExampleCollector implements IPFIXCollectorListener { XStream xstream=new XStream(); /** * called when a new source is detected * @param s source */ public void sourceCollected(IPFIXSNode s) { System.out.println("--[[ SOURCE DETECTED ]]--"); System.out.println(xstream.toXML(s)); System.out.println("-------------------------"); } /** * called when a new message begins * @param hdr IPFIX header */ public void messageCollected(IPFIXHeader hdr) { System.out.println("--[[ INCOMING MESSAGE ]]--"); System.out.println(xstream.toXML(hdr)); System.out.println("--------------------------"); } /** * called when a new template record is received * @param s source * @param t template */ public void templateRecordCollected(IPFIXSNode s, IPFIXTNode t) { System.out.println("--[[ NEW TEMPLATE RECEIVED ]]--"); System.out.println("Source ID: "+s.odid); System.out.println(xstream.toXML(t)); System.out.println("-------------------------------"); } /** * called when a new data record is received * @param s source * @param t template * @param data data record */ public void dataRecordCollected(IPFIXSNode s, IPFIXTNode t, IPFIXDataRecord data) { System.out.println("--[[ NEW DATA RECORD ]]--"); System.out.println("Source ID: "+s.odid); System.out.println("Template ID: "+t.ipfixt.tid); System.out.println(xstream.toXML(data)); System.out.println("-------------------------"); } /** * called before the collector closes down */ public void cleanupCollector() { System.out.println("--[[ COLLECTOR CLOSING ]]--"); } }
package com.souptik.estore.orderservice.saga; import org.axonframework.commandhandling.CommandCallback; import org.axonframework.commandhandling.CommandMessage; import org.axonframework.commandhandling.CommandResultMessage; import org.axonframework.commandhandling.gateway.CommandGateway; import org.axonframework.modelling.saga.EndSaga; import org.axonframework.modelling.saga.SagaEventHandler; import org.axonframework.modelling.saga.StartSaga; import org.axonframework.spring.stereotype.Saga; import org.springframework.beans.factory.annotation.Autowired; import com.souptik.estore.orderservice.core.events.OrderCreatedEvent; import com.souptik.estore.shared.commands.ReserveProductCommand; @Saga public class OrderSaga { @Autowired private transient CommandGateway commandGateway; // saga object is serialized so make the commandGateway transient @StartSaga @SagaEventHandler(associationProperty = "orderId") public void handle(OrderCreatedEvent orderCreatedEvent) { ReserveProductCommand reserveProductCommand = ReserveProductCommand.builder() .productId(orderCreatedEvent.getProductId()) .orderId(orderCreatedEvent.getOrderId()) .quantity(orderCreatedEvent.getQuantity()) .userId(orderCreatedEvent.getUserId()).build(); commandGateway.send(reserveProductCommand, new CommandCallback<ReserveProductCommand, Object>() { @Override public void onResult(CommandMessage<? extends ReserveProductCommand> commandMessage, CommandResultMessage<? extends Object> commandResultMessage) { if (commandResultMessage.isExceptional()) { // start compensating rollback } } }); } @SagaEventHandler(associationProperty = "productId") public void handle(ProductReservedEvent productReservedEvent) { } @SagaEventHandler(associationProperty = "paymentId") public void handle(PaymentProcessedEvent paymentProcessedEvent) { } @EndSaga @SagaEventHandler(associationProperty = "orderId") public void handle(OrderProcessedEvent orderProcessedEvent) { } }
package com.tencent.mm.plugin.gallery.ui; import android.content.Intent; import com.tencent.mm.plugin.gallery.model.b.b; import com.tencent.mm.plugin.gallery.model.c; import com.tencent.mm.sdk.platformtools.ag; class ImagePreviewUI$11 implements b { final /* synthetic */ Intent heh; final /* synthetic */ ImagePreviewUI jEa; ImagePreviewUI$11(ImagePreviewUI imagePreviewUI, Intent intent) { this.jEa = imagePreviewUI; this.heh = intent; } public final void CR(String str) { new ag(this.jEa.getMainLooper()).post(new 1(this)); com.tencent.mm.plugin.gallery.model.b bVar = c.aRe().jAe; if (bVar.dHo != null && bVar.dHo.contains(this)) { bVar.dHo.remove(this); } } }
package rs.jug.rx.qconsf2014.netflix; import java.nio.charset.Charset; import java.util.HashMap; import java.util.List; import java.util.Map; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.reactivex.netty.protocol.http.server.HttpServerRequest; import io.reactivex.netty.protocol.http.server.HttpServerResponse; import io.reactivex.netty.protocol.http.sse.ServerSentEvent; import rs.jug.rx.qconsf2014.netflix.gateway.Rating; import rs.jug.rx.qconsf2014.netflix.gateway.VideoMetadata; import rs.jug.rx.qconsf2014.netflix.gateway.VideoServiceGateway; import rx.Observable; public class ReactiveHttpRequestHandler { private VideoServiceGateway videoServiceGateway = new VideoServiceGateway(); public Observable<Void> handle(HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) { // first request User object return getUser(userId(request)).flatMap(user -> { // then fetch personal catalog Observable<Map<String, Object>> catalog = getPersonalizedCatalog(user).flatMap(catalogList -> { return catalogList.videos().<Map<String, Object>>flatMap(video -> { Observable<Rating> rating = videoServiceGateway.rating(video); Observable<VideoMetadata> metadata = videoServiceGateway.metadata(video); return Observable.zip(rating, metadata, (r, m) -> { return combineVideoData(video, r, m); }); }); }); // and fetch social data in parallel Observable<Map<String, Object>> social = getSocialData(user).map(s -> { return s.getDataAsMap(); }); // merge the results return Observable.merge(social, catalog); }).flatMap(data -> { // output as SSE as we get back the data (no waiting until all is done) return response.writeAndFlush(new ServerSentEvent(toByteBuffer(data)).content()); }); } private List<String> userId(HttpServerRequest<ByteBuf> request) { return request.getQueryParameters().get("userId"); } private Map<String, Object>combineVideoData(String video, Rating rating, VideoMetadata metadata){ Map<String, Object> videoDetails = new HashMap<>(); videoDetails.put(video, new VideoDetails(video, rating, metadata)); return videoDetails; } private ByteBuf toByteBuffer(Map<String, Object> data) { return Unpooled.copiedBuffer(data.toString() + "\n", Charset.forName("UTF-8")); } private Observable<SocialData> getSocialData(String user) { return Observable.just(new SocialData()); } private Observable<String> getUser(List<String> list){ return Observable.just("frances_bagual"); } private Observable<Catalog> getPersonalizedCatalog(String list){ return Observable.just(new Catalog()); } }
package com.fleet.util; import com.google.zxing.*; import com.google.zxing.client.j2se.BufferedImageLuminanceSource; import com.google.zxing.client.j2se.MatrixToImageWriter; import com.google.zxing.common.BitMatrix; import com.google.zxing.common.HybridBinarizer; import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.OutputStream; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; /** * 条形码工具类 */ public class BarCodeUtil { private static final String CHARSET = "utf-8"; private static final String FORMAT_NAME = "JPG"; // 条形码宽度 public static int BARCODE_WIDTH = 300; // 条形码高度 public static int BARCODE_HEIGHT = 70; /** * 生成条形码 * * @param contents 内容(只能用数字、字母、符号) * @param destPath 目标路径 * @throws Exception */ public static void encode(String contents, String destPath, String fileName) throws Exception { mkdirs(destPath); BufferedImage bufferedImage = BarCodeUtil.bufferedImage(contents); File dest = new File(destPath + "/" + fileName); if (dest.exists() && dest.isFile()) { dest.delete(); } ImageIO.write(bufferedImage, FORMAT_NAME, dest); } /** * 生成条形码 * * @param contents 内容(只能用数字、字母、符号) * @param os 输出流 * @throws Exception */ public static void encode(String contents, OutputStream os) throws Exception { BufferedImage bufferedImage = BarCodeUtil.bufferedImage(contents); ImageIO.write(bufferedImage, FORMAT_NAME, os); } /** * 解析条形码 * * @param file 条形码图片 * @throws Exception */ public static String decode(File file) throws Exception { BufferedImage bufferedImage = ImageIO.read(file); if (bufferedImage == null) { return null; } BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(bufferedImage); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Hashtable<DecodeHintType, Object> hints = new Hashtable<>(); hints.put(DecodeHintType.CHARACTER_SET, CHARSET); Result result = new MultiFormatReader().decode(bitmap, hints); if (result == null) { return null; } return result.getText(); } /** * 解析条形码 * * @param path 条形码图片地址 * @throws Exception */ public static String decode(String path) throws Exception { return BarCodeUtil.decode(new File(path)); } /** * 创建目录 * * @param destPath 目标路径 */ public static void mkdirs(String destPath) { File file = new File(destPath); if (!file.exists() && !file.isDirectory()) { file.mkdirs(); } } private static BufferedImage bufferedImage(String contents) throws Exception { Map<EncodeHintType, Object> hints = new HashMap<>(); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); hints.put(EncodeHintType.CHARACTER_SET, CHARSET); hints.put(EncodeHintType.MARGIN, 10); BitMatrix bitMatrix = new MultiFormatWriter().encode(contents, BarcodeFormat.CODE_128, BARCODE_WIDTH, BARCODE_HEIGHT, hints); return MatrixToImageWriter.toBufferedImage(bitMatrix); } }
package com.tencent.mm.plugin.luckymoney.f2f.ui; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.Rect; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.View; import java.util.ArrayList; import java.util.List; public class LuckyAvatarParticleView extends View { public static DisplayMetrics ewi; private long duration; private Paint fBa = new Paint(); private ValueAnimator gGc; private int kNA; private int kNB; private int kNt; private int kNu; private List<Rect> kNv = new ArrayList(); private List<Integer> kNw = new ArrayList(); private List<Integer> kNx = new ArrayList(); private int kNy; private int kNz; static /* synthetic */ void a(LuckyAvatarParticleView luckyAvatarParticleView, int i) { Rect rect = (Rect) luckyAvatarParticleView.kNv.get(i); int width = rect.width(); if (Math.abs(luckyAvatarParticleView.kNt - rect.left) <= ((Integer) luckyAvatarParticleView.kNw.get(i)).intValue()) { rect.left = luckyAvatarParticleView.kNt; } else if (luckyAvatarParticleView.kNt > rect.left) { rect.left = ((Integer) luckyAvatarParticleView.kNw.get(i)).intValue() + rect.left; } else if (luckyAvatarParticleView.kNt < rect.left) { rect.left -= ((Integer) luckyAvatarParticleView.kNw.get(i)).intValue(); } rect.right = rect.left + width; if (Math.abs(luckyAvatarParticleView.kNu - rect.top) <= ((Integer) luckyAvatarParticleView.kNx.get(i)).intValue()) { rect.top = luckyAvatarParticleView.kNu; } else if (luckyAvatarParticleView.kNu > rect.top) { rect.top = ((Integer) luckyAvatarParticleView.kNx.get(i)).intValue() + rect.top; } else if (luckyAvatarParticleView.kNu < rect.top) { rect.top -= ((Integer) luckyAvatarParticleView.kNx.get(i)).intValue(); } rect.bottom = rect.top + width; } static /* synthetic */ void d(LuckyAvatarParticleView luckyAvatarParticleView) { int i; int random; int i2 = 20; for (i = 0; i < 20; i++) { random = (int) (Math.random() * ((double) luckyAvatarParticleView.getHeight())); int randomRectWidth = luckyAvatarParticleView.getRandomRectWidth(); luckyAvatarParticleView.kNv.add(new Rect(0, random, randomRectWidth, random + randomRectWidth)); randomRectWidth = luckyAvatarParticleView.getRandomVelocity(); luckyAvatarParticleView.kNw.add(Integer.valueOf(randomRectWidth)); random = (int) (((double) ((((float) Math.abs(random - luckyAvatarParticleView.kNu)) * (((float) randomRectWidth) * 1.0f)) / ((float) Math.abs(luckyAvatarParticleView.kNt)))) + 0.5d); if (random == 0) { random = 1; } luckyAvatarParticleView.kNx.add(Integer.valueOf(random)); } while (i2 < 40) { random = (int) (Math.random() * ((double) luckyAvatarParticleView.getHeight())); i = luckyAvatarParticleView.getRandomRectWidth(); luckyAvatarParticleView.kNv.add(new Rect(ewi.widthPixels, random, ewi.widthPixels + i, i + random)); i = luckyAvatarParticleView.getRandomVelocity(); luckyAvatarParticleView.kNw.add(Integer.valueOf(i)); random = (int) (((double) ((((float) Math.abs(random - luckyAvatarParticleView.kNu)) * (((float) i) * 1.0f)) / ((float) Math.abs(ewi.widthPixels - luckyAvatarParticleView.kNt)))) + 0.5d); if (random == 0) { random = 1; } luckyAvatarParticleView.kNx.add(Integer.valueOf(random)); i2++; } } public LuckyAvatarParticleView(Context context, AttributeSet attributeSet) { super(context, attributeSet); } private int getRandomVelocity() { return this.kNy + ((int) (Math.random() * ((double) (this.kNz - this.kNy)))); } private int getRandomRectWidth() { return this.kNA + ((int) (Math.random() * ((double) (this.kNB - this.kNA)))); } protected void onDraw(Canvas canvas) { super.onDraw(canvas); int i = 0; while (true) { int i2 = i; if (i2 < this.kNv.size()) { canvas.drawRect((Rect) this.kNv.get(i2), this.fBa); i = i2 + 1; } else { return; } } } public void setDuration(long j) { this.duration = j; this.gGc = ValueAnimator.ofFloat(new float[]{0.0f, 1.0f}).setDuration(this.duration); this.gGc.addUpdateListener(new 1(this)); } public void setColor(int i) { this.fBa.setColor(i); this.fBa.setStyle(Style.FILL); } }
package com.tyss.cg.methods; public class BasicArithematicOperation { public BasicArithematicOperation() { System.out.println("BasicArithematicConstructor const"); } /** * This method returns the sum of two given integers. * * @param i * @param j * @return int i + int j */ public static int add(int i, int j) { // int sum=i+j; // return sum; return i + j; } /** * This method returns the division of two given numbers * * @param i * @param j * @return double i, double j */ public static double div(double i, double j) { return i / j; } /** * This method returns the difference of two given numbers * * @param i * @param j * @return */ public static int sub(int i, int j) { return i - j; } /** * This method is used to return the division with double value at return. * * @param i * @param j * @return */ public static double div(int i, int j) { return (i / j) * 1.0; } /** * This method is used to return the multiplication of two given numbers. * * @param i * @param j * @return */ public static int mul(int i, int j) { return (i * j); } public static void main(String[] args) { int sum = add(12, 13); System.out.println("sum: " + sum); System.out.println("sum: " + add(45, 45)); System.out.println("sub: " + sub(44, 32)); System.out.println("div: " + div(15, 2)); System.out.println("mul: " + mul(2, 5)); } }
package luccaPiovezan.grupo.wl.domain.colaborador; import javax.persistence.Entity; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import luccaPiovezan.grupo.wl.domain.usuario.Usuario; @SuppressWarnings("serial") @Getter @Setter @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Entity public class Colaborador extends Usuario{ private String comidas; private String bebidas; private String frios; }
/* * Created on 27-nov-2004 * */ package es.ucm.fdi.si.dibujo; import java.util.List; import es.ucm.fdi.si.modelo.IModelo; import es.ucm.fdi.si.modelo.ListaElementosContenido; import es.ucm.fdi.si.modelo.ListaElementosDiseņo; import es.ucm.fdi.si.modelo.Nodo; import es.ucm.fdi.si.modelo.Punto; /** * @author Alejandro Blanco, David Curieses Chamon, Oscar Ortega * * Proyecto Sistemas Informaticos: * * Herramienta CASE para diseņo y prototipado de aplicaciones hipermedia */ public class ModuloDibujo implements IModuloDibujo { private IModelo modelo; //Deberá desaparecer en realidad private FactoriaDibujo factoriaDibujo; public ModuloDibujo(IModelo modelo) { this.modelo=modelo; this.factoriaDibujo = new FactoriaDibujo(modelo); } public void setElementoSeleccionadoDiseņo(int x, int y) { factoriaDibujo.getDiseņo().setElementoSeleccionado(x, y); } public void setElementoSeleccionadoDiseņo(String nombre) { factoriaDibujo.getDiseņo().setElementoSeleccionado(nombre); } public ListaElementosDiseņo getElementosSeleccionadosDiseņo() { return factoriaDibujo.getDiseņo().getElementosSeleccionados(); } public void setTipoSeleccionadoDiseņo(int tipo) { factoriaDibujo.getDiseņo().setTipoSeleccionado(tipo); } public int getTipoSeleccionadoDiseņo() { return factoriaDibujo.getDiseņo().getTipoSeleccionado(); } public boolean aņadeElementoDiseņo(int tipo, String nombre, Punto puntoInicio, Punto puntoFin){ return factoriaDibujo.getDiseņo().aņadeElementoDiseņo(tipo, nombre, puntoInicio, puntoFin); } public boolean aņadeElementoDiseņo(int tipo, String nombre, Nodo nodoInicio, Nodo nodoFin, List listaPuntos, int tiempo) { return factoriaDibujo.getDiseņo().aņadeElementoDiseņo(tipo, nombre, nodoInicio, nodoFin, listaPuntos, tiempo); } public boolean existeElementoDiseņo(String nombre) { return factoriaDibujo.getDiseņo().existeElementoDiseņo(nombre); } public void actualizaNodo(String nombre, Punto puntoInicio , Punto puntoFin, String nuevoNombre) { factoriaDibujo.getDiseņo().actualizaNodo(nombre, puntoInicio, puntoFin, nuevoNombre); } public void setPosXY(int x, int y) { factoriaDibujo.getDiseņo().setPosXY(x,y); } public int getActualX() { return factoriaDibujo.getDiseņo().getActualX(); } public int getActualY() { return factoriaDibujo.getDiseņo().getActualY(); } public boolean estaDentro(int x, int y){ return factoriaDibujo.getDiseņo().estaDentro(x,y); } public void deleteElementosDiseņo(ListaElementosDiseņo elementosDiseņo) { factoriaDibujo.getDiseņo().deleteElementos(elementosDiseņo); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#getNumElementosDiseņo() */ public int getNumElementosDiseņo() { return factoriaDibujo.getDiseņo().getNumElementosDiseņo(); } /* Contenido */ public int getTipoSeleccionadoContenido() { return factoriaDibujo.getContenido().getTipoSeleccionadoContenido(); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#setTipoSeleccionadoContenido(int) */ public void setTipoSeleccionadoContenido(int tipoSeleccionadoContenido) { factoriaDibujo.getContenido().setTipoSeleccionadoContenido(tipoSeleccionadoContenido); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#getElementoSeleccionadoContenido() */ public ListaElementosContenido getElementosSeleccionadosContenido() { return factoriaDibujo.getContenido().getElementosSeleccionados(); } public boolean aņadeElementoContenido(int tipo, String nombre, Nodo nodoInicio, Nodo nodoFin, List listaPuntos) { return factoriaDibujo.getContenido().aņadeElementoContenido(tipo, nombre, nodoInicio, nodoFin, listaPuntos); } public boolean aņadeElementoContenido(int tipo, String nombre, Punto puntoInicio, Punto puntoFin) { return factoriaDibujo.getContenido().aņadeElementoContenido(tipo, nombre, puntoInicio, puntoFin); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#setElementoSeleccionadoContenido(int, int) */ public void setElementoSeleccionadoContenido(int x, int y) { factoriaDibujo.getContenido().setElementoSeleccionado(x, y); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#setPulsadoControl(boolean) */ public void setPulsadoControl(boolean b) { modelo.setPulsadoControl(b); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#isPulsadoControl() */ public boolean isPulsadoControl() { return modelo.isPulsadoControl(); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#aņadeElementoSeleccionadoDiseņo(int, int) */ public void aņadeElementoSeleccionadoDiseņo(int posX, int posY) { factoriaDibujo.getDiseņo().aņadeElementoSeleccionado(posX, posY); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#aņadeElementoSeleccionadoContenido(int, int) */ public void aņadeElementoSeleccionadoContenido(int posX, int posY) { factoriaDibujo.getContenido().aņadeElementoSeleccionado(posX, posY); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#deleteElementosContenido(es.ucm.fdi.si.modelo.ListaElementosContenido) */ public void deleteElementosContenido(ListaElementosContenido elementos) { factoriaDibujo.getContenido().deleteElementos(elementos); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#getNumElementosContenido() */ public int getNumElementosContenido() { return factoriaDibujo.getContenido().getNumElementosContenido(); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#existeElementoContenido(java.lang.String) */ public boolean existeElementoContenido(String nombre) { return factoriaDibujo.getContenido().existeElementoContenido(nombre); } /* (non-Javadoc) * @see es.ucm.fdi.si.dibujo.IModuloDibujo#actualizaNodoContenido(java.lang.String, es.ucm.fdi.si.modelo.Punto, es.ucm.fdi.si.modelo.Punto, java.lang.String) */ public void actualizaNodoContenido(String nombre, Punto puntoInicio, Punto puntoFin, String nuevoNombre) { factoriaDibujo.getContenido().actualizaNodoContenido(nombre, puntoInicio, puntoFin, nuevoNombre); } }
package com.tyjradio.jrdvoicerecorder.utils; import android.app.ActivityManager; import android.content.Context; import android.util.TypedValue; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayList; public class Utils { //dp转px public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } //px转dp public static int px2dip(Context context, int pxValue) { return ((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, pxValue, context.getResources().getDisplayMetrics())); } public static String unicodeToString(byte[] bytes){ StringBuffer strbuffer = new StringBuffer(); for (int i = 0; i < bytes.length/2; i++){ int addr = bytes[i*2] & 0xFF; addr |= ((bytes[i*2+1] << 8) & 0xFF00); strbuffer.append((char)addr); } return strbuffer.toString(); } public static byte[] getBytes(char[] chars) { byte [] result = new byte[chars.length]; for(int i=0;i<chars.length;i++){ result[i] = (byte) chars[i]; } return result; } /* byte[]转Int */ public static int bytesToInt(byte[] bytes) { int addr = bytes[0] & 0xFF; addr |= ((bytes[1] << 8) & 0xFF00); addr |= ((bytes[2] << 16) & 0xFF0000); addr |= ((bytes[3] << 24) & 0xFF000000); return addr; } /** * 以大端模式将byte[]转成int */ public static int bytesToIntBig(byte[] src, int offset) { int value; value = (int) (((src[offset] & 0xFF) << 24) | ((src[offset + 1] & 0xFF) << 16) | ((src[offset + 2] & 0xFF) << 8) | (src[offset + 3] & 0xFF)); return value; } /* Int转byte[] */ public static byte[] intToByte(int i) { byte[] abyte0 = new byte[4]; abyte0[0] = (byte) (0xff & i); abyte0[1] = (byte) ((0xff00 & i) >> 8); abyte0[2] = (byte) ((0xff0000 & i) >> 16); abyte0[3] = (byte) ((0xff000000 & i) >> 24); return abyte0; } /** * 以大端模式将int转成byte[] */ public static byte[] intToBytesBig(int value) { byte[] src = new byte[4]; src[0] = (byte) ((value >> 24) & 0xFF); src[1] = (byte) ((value >> 16) & 0xFF); src[2] = (byte) ((value >> 8) & 0xFF); src[3] = (byte) (value & 0xFF); return src; } /** * 组成新的字符 */ public static String Stringinsert(String src, String dec, int position){ StringBuffer stringBuffer = new StringBuffer(src); return stringBuffer.insert(position, dec).toString(); } /** * 截取byte数组 不改变原数组 * @param b 原数组 * @param off 偏差值(索引) * @param length 长度 * @return 截取后的数组 */ public static byte[] subByte(byte[] b,int off,int length){ byte[] b1 = new byte[length]; System.arraycopy(b, off, b1, 0, length); return b1; } /** * 判断后台服务是否运行 */ public static boolean isServiceRunning(Context context, String ServiceName) { if (("").equals(ServiceName) || ServiceName == null) return false; ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); ArrayList<ActivityManager.RunningServiceInfo> runningService = (ArrayList<ActivityManager.RunningServiceInfo>) activityManager.getRunningServices(50); for (int i=0; i<runningService.size(); i++){ if (runningService.get(i).service.getClassName().toString().equals(ServiceName)) return true; } return false; } public static short[] byteArrayToShortArray(byte[] byteArray) { short[] shortArray = new short[byteArray.length / 2]; ByteBuffer.wrap(byteArray).order(ByteOrder.nativeOrder()).asShortBuffer().get(shortArray); return shortArray; } public static byte[] shortArrayToByteArray( short[] shortArray) { int count = shortArray.length; byte[] dest = new byte[count << 1]; int i = 0; for(int var5 = count; i < var5; ++i) { int var10001 = i * 2; short var6 = shortArray[i]; short var7 = (short)'\uffff'; int var9 = var10001; short var10 = (short)(var6 & var7); dest[var9] = (byte)((int)((long)var10 >> 0)); var10001 = i * 2 + 1; var6 = shortArray[i]; var7 = (short)'\uffff'; var9 = var10001; var10 = (short)(var6 & var7); dest[var9] = (byte)((int)((long)var10 >> 8)); } return dest; } }
package mailinator; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class GetDataMailinator { public static void main(String[] args) throws InterruptedException { String disp = null; WebDriver dr = new FirefoxDriver(); dr.manage().window().maximize(); dr.get("http://mailinator.com"); dr.findElement(By.xpath("//*[@id='inboxfield']")).sendKeys("holidayiq_112233445566"); dr.findElement(By.xpath("html/body/div[2]/div/div[1]/div[2]/div/div[2]/div/div/btn")).click(); Thread.sleep(5000); List<WebElement> mailList = dr.findElements(By.className("subject")); System.out.println("Total mail: "+mailList.size()); for(int i=0;i<mailList.size();i++){ if(mailList.get(i).getText().contains("Call")){ mailList.get(i).click(); Thread.sleep(2000); disp = ""; String subject = null; subject = dr.findElement(By.xpath("//*[@id='mailshowdivhead']/div[2]/div/div[1]/div/div[3]/div[2]")).getText(); subject = subject.replaceAll("Call", ""); subject = subject.replaceAll(": contact details you requested", ""); disp = disp + ";" + subject; dr.switchTo().frame(1); String ph = null; try{ ph = dr.findElement(By.xpath("html/body/div[1]/div/div/table/tbody/tr[2]/td[2]")).getText(); }catch(Exception e){ ph = "No phone"; } String webUrl = null; try{ webUrl = dr.findElement(By.xpath("html/body/div[1]/div/div/table/tbody/tr[3]/td[2]")).getText(); }catch(Exception e){ webUrl = "No website"; } dr.switchTo().defaultContent(); disp = disp + ";" + ph; disp = disp + ";" + webUrl; System.out.println(disp); dr.findElement(By.xpath("//*[@id='showmailpane']/div/div/div[1]/a")).click(); Thread.sleep(2000); } } } }
package madotuki.comanda.server.controller; import madotuki.comanda.server.access.AccessUtils; import madotuki.comanda.shared.model.*; import madotuki.comanda.shared.remote.ISession; import madotuki.comanda.shared.remote.ISessionListener; import java.util.List; import java.util.Map; /** * Created by madotuki on 4/28/16. */ public class Session implements ISession { private final int myId; private final ISessionListener myListener; private final Account account; public Session(int id, ISessionListener listener, Account account) { this.myId = id; this.myListener = listener; this.account = account; } public void logoff() { /* SessionManager.getInstance().getMySessions().remove(myId); SessionManager.getInstance().getMySessionListeners().remove(myId);*/ myListener.serverDisconnecting(); } public Account getMyAccount() { return account; } public Account getAccount(int id) { return AccessUtils.getAccount(id); } public Table getTable(int id) { return AccessUtils.getTable(id); } public List<Table> getTables() { return AccessUtils.getTables(); } public List<Product> getProducts() { return AccessUtils.getProducts(); } public Order getOrder(int id) { return AccessUtils.getOrder(id); } public Order getOrderForTable(Table table) { return AccessUtils.getOrderForTable(table); } public Order addOrder(Table table) { return AccessUtils.addOrder(table, getMyAccount()); } public boolean finishOrder(Order order) { return AccessUtils.finishOrder(order); } @Override public OrderItem addItem(Order order, Product product) { return AccessUtils.addItem(order, product); } public boolean delItem(Order order, OrderItem item) { return AccessUtils.delItem(item); } public boolean setItemSent(OrderItem item) { // Change item if (!AccessUtils.setItemStatus(item, OrderItemStatus.SENT)) { return false; } // Notify kitchen Order order = AccessUtils.getOrder(item.getIdorder()); OrderItem itemAfter = order.getItems().get(item.getId()); SessionManager.getInstance().getMyKitchenListener().itemIsSent(itemAfter); return true; } public boolean setItemReady(OrderItem item) { // Change item if (!AccessUtils.setItemStatus(item, OrderItemStatus.READY)) { return false; } // Notify owner Order order = AccessUtils.getOrder(item.getIdorder()); OrderItem itemAfter = order.getItems().get(item.getId()); SessionManager.getInstance().getMySessionListeners().get(order.getAccount().getId()).itemIsReady(itemAfter); return true; } public boolean setItemDone(OrderItem item) { return AccessUtils.setItemStatus(item, OrderItemStatus.DONE); } public Map<Integer, OrderItem> getItemsSent() { return AccessUtils.getItemsSent(); } public Map<Integer, OrderItem> getItemsReady() { return AccessUtils.getItemsReady(getMyAccount()); } }
package com.angelboxes.springboot.springbootapi.controller; import com.angelboxes.springboot.springbootapi.SpringbootapiApplication; import com.angelboxes.springboot.springbootapi.model.Question; import org.json.JSONException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.*; import org.springframework.security.test.context.support.WithMockUser; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Base64; import static org.junit.jupiter.api.Assertions.assertTrue; @SpringBootTest(classes = SpringbootapiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class SurveryControllerTestIT { @LocalServerPort private int port; TestRestTemplate restTemplate = new TestRestTemplate(); HttpHeaders headers = new HttpHeaders(); public String createHeadersWithUserAndPassword(String user, String password) { String auth = user + ":" + password; byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(Charset.forName("US-ASCII"))); String headerValue = "Basic " + new String(encodedAuth); return headerValue; } @BeforeEach public void beforeEach() { headers.add("Authorization", createHeadersWithUserAndPassword("user1", "secret1")); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); } @Test public void testJsonAssert() throws JSONException { String jsonExpected = "{id:1,name:Ringo, role:Admin}"; JSONAssert.assertEquals("{id:1, role:Admin}", jsonExpected, false); } @Test public void testRetrieveSurveyQuestion() throws JSONException { String url = createUrl("/surveys/Survey1/questions/Question1"); String output = restTemplate.getForObject(url, String.class); System.out.println("Response: " + output); HttpEntity entity = new HttpEntity<String>(null, headers); ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, entity, String.class); JSONAssert.assertEquals("{id:Question1}", responseEntity.getBody(), false); System.out.println("Response: " + responseEntity.getBody()); } @Test public void addQuestionTest() throws JSONException { String url = createUrl("/surveys/Survey1/questions"); Question question1 = new Question("QuestionXXX", "Who are you?", "Somebody", Arrays.asList( "Nobody", "Anybody", "Somebody")); HttpEntity entity = new HttpEntity<Question>(question1, headers); ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, entity, String.class); HttpHeaders responseHeaders = responseEntity.getHeaders(); String actual = responseHeaders.get(HttpHeaders.LOCATION).get(0); assertTrue(actual.contains("/surveys/Survey1/questions")); } private String createUrl(String retrieveAllQuestions) { return "http://localhost:" + port + retrieveAllQuestions; } }
package com.jayqqaa12.mobilesafe.domain; import java.io.Serializable; public class Sim implements Serializable { private static final long serialVersionUID = -8163128852079215563L; private int id; private String name; private String sim; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSim() { return sim; } public void setSim(String sim) { this.sim = sim; } }
/** * OpenKM, Open Document Management System (http://www.openkm.com) * Copyright (c) 2006-2015 Paco Avila & Josep Llort * * No bytes were intentionally harmed during the development of this application. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ package com.openkm.frontend.client.widget.filebrowser; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Widget; import com.openkm.frontend.client.Main; import com.openkm.frontend.client.panel.top.TopPanel; import com.openkm.frontend.client.util.OKMBundleResources; import com.openkm.frontend.client.widget.foldertree.ExtendedPopupPanel; /** * Status * * @author jllort * */ public class Status extends ExtendedPopupPanel { private HorizontalPanel hPanel; private HTML msg; private HTML space; private Image image; private boolean flag_Folder_getChilds = false; private boolean flag_Document_getChilds = false; private boolean flag_Mail_getChilds = false; private boolean flag_Folder_delete = false; private boolean flag_Document_delete = false; private boolean flag_Checkout = false; private boolean flag_Lock = false; private boolean flag_UnLock = false; private boolean flag_Document_rename = false; private boolean flag_Folder_rename = false; private boolean flag_Document_purge = false; private boolean flag_Folder_purge = false; private boolean flag_GetFolder = false; private boolean flag_GetDocument = false; private boolean flag_AddSubscription = false; private boolean flag_RemoveSubscription = false; private boolean flag_Mail_delete = false; private boolean flag_Mail_purge = false; private boolean flag_Mail_getProperties = false; private boolean flag_Mail_rename = false; private boolean flag_CreateFromTemplate = false; private boolean flag_Ordering = false; private boolean flag_getChilds = false; private Widget widget; /** * Status */ public Status(Widget widget) { super(false, true); this.widget = widget; hPanel = new HorizontalPanel(); image = new Image(OKMBundleResources.INSTANCE.indicator()); msg = new HTML(""); space = new HTML(""); hPanel.add(image); hPanel.add(msg); hPanel.add(space); hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE); hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE); hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER); hPanel.setCellWidth(image, "30px"); hPanel.setCellWidth(space, "7px"); hPanel.setHeight("25px"); msg.setStyleName("okm-NoWrap"); super.hide(); setWidget(hPanel); } /** * Refresh */ public void refresh() { if (flag_Folder_getChilds || flag_Document_getChilds || flag_Folder_delete || flag_Document_delete || flag_Checkout || flag_Lock || flag_UnLock || flag_Document_rename || flag_Folder_rename || flag_Document_purge || flag_Folder_purge || flag_GetFolder || flag_GetDocument || flag_AddSubscription || flag_RemoveSubscription || flag_Mail_getChilds || flag_Mail_delete || flag_Mail_purge || flag_Mail_getProperties || flag_Mail_rename || flag_CreateFromTemplate || flag_Ordering || flag_getChilds) { int left = ((widget.getAbsoluteLeft() + widget.getOffsetWidth()-200)/2) + widget.getAbsoluteLeft(); int top = ((widget.getAbsoluteTop() + widget.getOffsetHeight())/2) + TopPanel.PANEL_HEIGHT; setPopupPosition(left,top); Main.get().mainPanel.desktop.browser.fileBrowser.panel.addStyleName("okm-PanelRefreshing"); super.show(); } else { super.hide(); Main.get().mainPanel.desktop.browser.fileBrowser.panel.removeStyleName("okm-PanelRefreshing"); } } /** * Sets folder childs flag */ public void setFlagFolderChilds() { msg.setHTML(Main.i18n("filebrowser.status.refresh.folder")); flag_Folder_getChilds = true; refresh(); } /** * Unset folder childs flag */ public void unsetFlagFolderChilds() { flag_Folder_getChilds = false; refresh(); } /** * Set document childs flag */ public void setFlagDocumentChilds() { msg.setHTML(Main.i18n("filebrowser.status.refresh.document")); flag_Document_getChilds = true; refresh(); } /** * Unset document childs flag */ public void unsetFlagDocumentChilds() { flag_Document_getChilds = false; refresh(); } /** * Set mail childs flag */ public void setFlagMailChilds() { msg.setHTML(Main.i18n("filebrowser.status.refresh.mail")); flag_Mail_getChilds = true; refresh(); } /** * Unset mail childs flag */ public void unsetFlagMailChilds() { flag_Mail_getChilds = false; refresh(); } /** * Sets folder delete flag */ public void setFlagFolderDelete() { msg.setHTML(Main.i18n("filebrowser.status.refresh.delete.folder")); flag_Folder_delete = true; refresh(); } /** * Unset folder delete flag */ public void unsetFlagFolderDelete() { flag_Folder_delete = false; refresh(); } /** * Sets document delete flag */ public void setFlagDocumentDelete() { msg.setHTML(Main.i18n("filebrowser.status.refresh.delete.document")); flag_Document_delete = true; refresh(); } /** * Unset document delte flag */ public void unsetFlagDocumentDelete() { flag_Document_delete = false; refresh(); } /** * Sets mail delete flag */ public void setFlagMailDelete() { msg.setHTML(Main.i18n("filebrowser.status.refresh.delete.mail")); flag_Mail_delete = true; refresh(); } /** * Unset mail delte flag */ public void unsetFlagMailDelete() { flag_Mail_delete = false; refresh(); } /** * Sets checkout flag */ public void setFlagCheckout() { msg.setHTML(Main.i18n("filebrowser.status.refresh.checkout")); flag_Checkout = true; refresh(); } /** * Unset checkout flag */ public void unsetFlagCheckout() { flag_Checkout = false; refresh(); } /** * Sets lock flag */ public void setFlagLock() { msg.setHTML(Main.i18n("filebrowser.status.refresh.lock")); flag_Lock = true; refresh(); } /** * Unset checkout flag */ public void unsetFlagLock() { flag_Lock = false; refresh(); } /** * Sets delete lock flag */ public void setFlagUnLock() { msg.setHTML(Main.i18n("filebrowser.status.refresh.unlock")); flag_UnLock = true; refresh(); } /** * Unset delete lock flag */ public void unsetFlagUnLock() { flag_UnLock = false; refresh(); } /** * Sets add subscription flag */ public void setFlagAddSubscription() { msg.setHTML(Main.i18n("filebrowser.status.refresh.add.subscription")); flag_AddSubscription = true; refresh(); } /** * Unset add subscription flag */ public void unsetFlagAddSubscription() { flag_AddSubscription = false; refresh(); } /** * Sets remove subscription flag */ public void setFlagRemoveSubscription() { msg.setHTML(Main.i18n("filebrowser.status.refresh.remove.subscription")); flag_RemoveSubscription = true; refresh(); } /** * Unset remove subscription flag */ public void unsetFlagRemoveSubscription() { flag_RemoveSubscription = false; refresh(); } /** * Sets document rename flag */ public void setFlagDocumentRename() { msg.setHTML(Main.i18n("filebrowser.status.refresh.document.rename")); flag_Document_rename = true; refresh(); } /** * Unset document rename flag */ public void unsetFlagDocumentRename() { flag_Document_rename = false; refresh(); } /** * Sets folder rename flag */ public void setFlagFolderRename() { msg.setHTML(Main.i18n("filebrowser.status.refresh.folder.rename")); flag_Folder_rename = true; refresh(); } /** * Unset folder rename flag */ public void unsetFlagFolderRename() { flag_Folder_rename = false; refresh(); } /** * Sets mail rename flag */ public void setFlagMailRename() { msg.setHTML(Main.i18n("filebrowser.status.refresh.mail.rename")); flag_Mail_rename = true; refresh(); } /** * Unset mail rename flag */ public void unsetFlagMailRename() { flag_Mail_rename = false; refresh(); } /** * Sets document purge flag */ public void setFlagDocumentPurge() { msg.setHTML(Main.i18n("filebrowser.status.refresh.document.purge")); flag_Document_purge = true; refresh(); } /** * Unset document purge flag */ public void unsetFlagDocumentPurge() { flag_Document_purge = false; refresh(); } /** * Sets mail purge flag */ public void setFlagMailPurge() { msg.setHTML(Main.i18n("filebrowser.status.refresh.mail.purge")); flag_Mail_purge = true; refresh(); } /** * Unset document purge flag */ public void unsetFlagMailPurge() { flag_Mail_purge = false; refresh(); } /** * Sets folder purge flag */ public void setFlagFolderPurge() { msg.setHTML(Main.i18n("filebrowser.status.refresh.folder.purge")); flag_Folder_purge = true; refresh(); } /** * Unset folder purge flag */ public void unsetFlagFolderPurge() { flag_Folder_purge = false; refresh(); } /** * Sets get folder flag */ public void setFlagGetFolder() { msg.setHTML(Main.i18n("filebrowser.status.refresh.folder.get")); flag_GetFolder = true; refresh(); } /** * Unset get folder flag */ public void unsetFlagGetFolder() { flag_GetFolder = false; refresh(); } /** * Sets get document flag */ public void setFlagGetDocument() { msg.setHTML(Main.i18n("filebrowser.status.refresh.document.get")); flag_GetDocument = true; refresh(); } /** * Unset get document flag */ public void unsetFlagGetDocument() { flag_GetDocument = false; refresh(); } /** * Set mail properties flag */ public void setFlagMailProperties() { msg.setHTML(Main.i18n("filebrowser.status.refresh.mail.properties")); flag_Mail_getProperties = true; refresh(); } /** * Unset mail properties flag */ public void unsetFlagMailProperties() { flag_Mail_getProperties = false; refresh(); } /** * Set create from template flag */ public void setFlagCreateFromTemplate() { msg.setHTML(Main.i18n("fileupload.status.create.from.template")); flag_CreateFromTemplate = true; refresh(); } /** * Unset create from template flag */ public void unsetFlagCreateFromTemplate() { flag_CreateFromTemplate = false; refresh(); } /** * Set ordering flag */ public void setFlagOrdering() { msg.setHTML(Main.i18n("filebrowser.status.ordering")); flag_Ordering = true; refresh(); } /** * Unset ordering flag */ public void unsetFlagOrdering() { flag_Ordering = false; refresh(); } /** * Set getchilds flag */ public void setFlagGetChilds() { msg.setHTML(Main.i18n("filebrowser.controller.getchilds")); flag_getChilds = true; refresh(); } /** * Unset getchidls flag */ public void unsetFlagGetChilds() { flag_getChilds = false; refresh(); } }
package it.unical.asd.group6.computerSparePartsCompany.controller; import it.unical.asd.group6.computerSparePartsCompany.core.exception.customer.CustomerByUsernameNotFoundOnRetrieveException; import it.unical.asd.group6.computerSparePartsCompany.core.services.implemented.CustomerServiceImpl; import it.unical.asd.group6.computerSparePartsCompany.core.services.implemented.EmployeeServiceImpl; import it.unical.asd.group6.computerSparePartsCompany.data.dto.CustomerDTO; import it.unical.asd.group6.computerSparePartsCompany.data.entities.Customer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.server.ResponseStatusException; import java.util.List; import java.util.Optional; @RestController @RequestMapping("/customer") @CrossOrigin(origins = "*", allowedHeaders = "*") public class CustomerController { @Autowired private CustomerServiceImpl customerService; @Autowired private EmployeeServiceImpl employeeService; @GetMapping("/login") public ResponseEntity<Boolean> doLogin( @RequestParam("username") String username, @RequestParam("password") String password) { return ResponseEntity.ok(customerService.checkLogin(username,password)); } @PostMapping("/register") public ResponseEntity<Boolean> doSignUp (@RequestBody Customer customer) { return ResponseEntity.ok(customerService.registerNewCustomer(customer)); } @PostMapping("/register-param") public ResponseEntity<Boolean> signUp ( @RequestParam("name") String name, @RequestParam("surname") String surname, @RequestParam("phoneNumber") String phoneNumber, @RequestParam("email") String email, @RequestParam("username") String username, @RequestParam("password") String password, @RequestParam("vatID") Long vatID) { return ResponseEntity.ok(customerService.createNewCustomer(name,surname,phoneNumber,email,username,password,vatID)); } @GetMapping("/user-check") public ResponseEntity<Boolean> checkUser(@RequestParam("username")String username) { return ResponseEntity.ok(customerService.searchByUsername(username)); } @GetMapping("/email-check") public ResponseEntity<Boolean> checkEmail(@RequestParam("email")String email) { return ResponseEntity.ok(customerService.searchByEmail(email)); } @GetMapping("/all-customers") public ResponseEntity<List<CustomerDTO>> allCustomers() { List<CustomerDTO> customers = customerService.getAllCustomer(); return ResponseEntity.ok(customers); } @GetMapping("/stringtest") public ResponseEntity<String> stringtest() { return ResponseEntity.ok(String.format("this is a string")); } @GetMapping("/by-username") //*** c public ResponseEntity<CustomerDTO> getCustomerByUsername(@RequestParam String username, @RequestParam String password) { if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } CustomerDTO customer = customerService.getCustomerByUsername(username).get(); return ResponseEntity.ok(customer); } @DeleteMapping("/del-customer") public ResponseEntity<Boolean> deleteCustomer(@RequestParam String username, @RequestParam String password) { if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } return ResponseEntity.ok(customerService.deleteCustomer(username)); } @GetMapping("/report-totalpurchases") //** c public ResponseEntity<Integer> getTotalPurchases(@RequestParam String username, @RequestParam String password){ if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } return ResponseEntity.ok(customerService.getReportTotalPurchases(username)); } @GetMapping("/report-totalamount") //** c public ResponseEntity<Double> getTotalAmount(@RequestParam String username, @RequestParam String password){ if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } return ResponseEntity.ok(customerService.getReportTotalAmountSpent(username)); } @GetMapping("/report-favoritecategory") //** c public ResponseEntity<String> getFavoriteCategory(@RequestParam String username, @RequestParam String password){ if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } return ResponseEntity.ok(customerService.getReportFavoriteCategory(username)); } @PostMapping("/change-password") public ResponseEntity<Boolean> changePassword(@RequestParam String username,@RequestParam String password,@RequestParam String oldPassword) { if(oldPassword.equals(customerService.getCustomerByUsername(username).get().getPassword())) return ResponseEntity.ok(customerService.updateCustomer(username,password)); else return ResponseEntity.ok(false); } @PostMapping("/update-data") public ResponseEntity<Boolean> changeCustomerData(@RequestParam String username, @RequestParam String password, @RequestParam String name, @RequestParam String surname, @RequestParam String phoneNumber, @RequestParam String iva) { if(!customerService.checkLogin(username,password)) { throw new ResponseStatusException(HttpStatus.FORBIDDEN); } return ResponseEntity.ok(customerService.updateDataCustomer(username,name,surname,phoneNumber,Long.parseLong(iva))); } @GetMapping("/all-usernames") //** e public ResponseEntity<List<String>>getUsernames() { return ResponseEntity.ok(customerService.getAllUsernames()); } @PutMapping("/{username}") public ResponseEntity<Customer> updateCustomerWithPut(@RequestBody CustomerDTO newCustomerDTO, @PathVariable String username){ Optional<CustomerDTO> optionalCustomer = customerService.getCustomerByUsername(username); if (!optionalCustomer.isPresent()){ return new ResponseEntity<>(HttpStatus.NOT_FOUND); } customerService.updateCustomerInfos(optionalCustomer.get(), newCustomerDTO); return new ResponseEntity<>(HttpStatus.OK); } }
package me.zhongmingmao.feign; import config.feign.UserProviderFeignConfig; import me.zhongmingmao.domain.User; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; // FeignClient用于创建一个Ribbon负载均衡器 // 当使用Eureka时,Ribbon会把name解析成Eureka Server上的服务 // 否则解析成service.ribbon.listOfServers @FeignClient( name = "user-provider", configuration = UserProviderFeignConfig.class, // 自定义配置,不应该在UserConsumerApplication的扫描范围内 // fallback = UserFeignClientFallback.class, // Feign已经整合了Hystrix,简单回退 fallbackFactory = UserFeignClientFallbackFactory.class) // 能获知回退的原因,优先级低于fallback public interface UserFeignClient { @GetMapping("/users/{id}") String findById(@PathVariable("id") Long id); @PostMapping("/users/post") User post(@RequestBody User user); }
package com.chuxin.family.views.chat; import com.chuxin.family.global.CxGlobalParams; import com.chuxin.family.libs.gpuimage.utils.PictureUtils; import com.chuxin.family.models.Message; import com.chuxin.family.models.TextMessage; import com.chuxin.family.resource.CxResourceDarwable; import com.chuxin.family.resource.CxResourceString; import com.chuxin.family.utils.InteractiveImageSpan; import com.chuxin.family.utils.RelativeInteractiveImageSpan; import com.chuxin.family.utils.CxLog; import com.chuxin.family.utils.TextUtil; import com.chuxin.family.widgets.CustomTextView; import com.chuxin.family.widgets.CxImageView; import com.nostra13.universalimageloader.core.ImageLoader; import com.chuxin.family.R; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; public class TextEntry extends ChatLogEntry { private static final String TAG = "TextEntry"; private static final int VIEW_RES_ID = R.layout.cx_fa_view_chat_chatting_text_row; private static final int ICON_ID = R.id.cx_fa_view_chat_chatting_text_row__icon; private static final int CONTENT_ID = R.id.cx_fa_view_chat_chatting_text_row__content; private static final int TIMESTAMP_ID = R.id.cx_fa_view_chat_chatting_text_row__timestamp; private static final int DATESTAMP_ID = R.id.cx_fa_view_chat_chatting_text_row__datestamp; private static final int SEND_SUCCESS_BUTTON_ID = R.id.cx_fa_view_chat_chatting_text_row__exclamation; private static final int CHAT_VIEW_LINEARLAYOUT_ID = R.id.cx_fa_view_chat_chatting_row__content; private static final boolean OWNER_FLAG = true; private String mMsgText; // add by shichao 经典表情图文混排 private static String[] sFaceValues = null; private static String[] sFaceTexts = null; public static String[] getFaceValues(Resources res) { if (sFaceValues == null) { sFaceValues = res.getStringArray(R.array.face_static_images_ids); } return sFaceValues; } public static String[] getFaceTexts(Resources res) { if (sFaceTexts == null) { sFaceTexts = res.getStringArray(R.array.face_texts); } return sFaceTexts; } public TextEntry(Message message, Context context, boolean isShowDate) { super(message, context, isShowDate); } @Override public int getType() { return ENTRY_TYPE_TEXT; } @Override public boolean isOwner() { return OWNER_FLAG; } public int getViewResourceId() { return VIEW_RES_ID; } public int getIconId() { return ICON_ID; } public int getContentId() { return CONTENT_ID; } public int getTimeStampId() { return TIMESTAMP_ID; } public int getDateStampId() { return DATESTAMP_ID; } public int getSendSuccessButtonId() { return SEND_SUCCESS_BUTTON_ID; } public int getChatViewLinearLayoutId(){ return CHAT_VIEW_LINEARLAYOUT_ID; } @Override public View build(View view, ViewGroup parent) { ChatLogAdapter tag = null; if (view == null) { view = LayoutInflater.from(mContext).inflate(getViewResourceId(), null); } CxImageView icon = (CxImageView)view.findViewById(getIconId()); LinearLayout chatLinearLayout = (LinearLayout)view.findViewById(getChatViewLinearLayoutId()); TextView text = (TextView)view.findViewById(getContentId()); TextView timeStamp = (TextView)view.findViewById(getTimeStampId()); TextView dateStamp = (TextView)view.findViewById(getDateStampId()); TextMessage message = (TextMessage)mMessage; int msgType = message.getType(); final int msgId = message.getMsgId(); int msgCreatTimeStamp = message.getCreateTimestamp(); mMsgText = message.getText(); if (tag == null) { tag = new ChatLogAdapter(); } tag.mChatType = msgType; tag.mMsgId = msgId; tag.mMsgText = mMsgText; // RkLog.v(TAG, "text" + message.getText()); if (isOwner()) { if(message.getText().equals(mContext.getString(CxResourceString.getInstance().str_chat_welcome_first_msg))){ mIsShowDate = true; } //icon.setImageResource(R.drawable.cx_fa_wf_icon_small); /*icon.setImage(RkGlobalParams.getInstance().getIconBig(), false, 44, mContext, "head", mContext);*/ icon.setImageResource(CxResourceDarwable.getInstance().dr_chat_icon_small_me); icon.displayImage(ImageLoader.getInstance(), CxGlobalParams.getInstance().getIconSmall(), CxResourceDarwable.getInstance().dr_chat_icon_small_me, true, CxGlobalParams.getInstance().getSmallImgConner()); icon.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO update owner headimage CxLog.i(TAG, "click update owner headimage button"); // mChatFragment.updateHeadImage(); ChatFragment.getInstance().updateHeadImage(); } }); int msgSendState = message.getSendSuccess(); final ImageButton reSendBtn = (ImageButton)view.findViewById(getSendSuccessButtonId()); ProgressBar pb = (ProgressBar) view.findViewById(R.id.cx_fa_view_chat_chatting_text_row_circleProgressBar); if(msgSendState == 0){ reSendBtn.setVisibility(View.GONE); pb.setVisibility(View.VISIBLE); } else if (msgSendState == 1) { reSendBtn.setVisibility(View.GONE); pb.setVisibility(View.GONE); } if ( msgSendState == 2 ) { pb.setVisibility(View.GONE); reSendBtn.setVisibility(View.VISIBLE); reSendBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // resend message new AlertDialog.Builder(ChatFragment.getInstance().getActivity()) .setTitle(R.string.cx_fa_alert_dialog_tip) .setMessage(R.string.cx_fa_chat_resend_msg) .setPositiveButton(R.string.cx_fa_chat_button_resend_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { reSendBtn.setVisibility(View.GONE); ChatFragment.getInstance().reSendMessage(mMsgText, 0, msgId); } }).setNegativeButton(R.string.cx_fa_cancel_button_text, null).show(); } }); } } else { //icon.setImageResource(R.drawable.cx_fa_hb_icon_small); /*icon.setImage(RkGlobalParams.getInstance().getPartnerIconBig(), false, 44, mContext, "head", mContext);*/ icon.setImageResource(CxResourceDarwable.getInstance().dr_chat_icon_small_oppo); icon.displayImage(ImageLoader.getInstance(), CxGlobalParams.getInstance().getPartnerIconBig(), CxResourceDarwable.getInstance().dr_chat_icon_small_oppo, true, CxGlobalParams.getInstance().getMateSmallImgConner()); icon.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO 跳转到个人资料页 ChatFragment.getInstance().gotoOtherFragment("rkmate"); } }); } text.setText(""); if(CxGlobalParams.getInstance().getSingle_mode()==1 && !isOwner()){ if(mMsgText.contains("小家看起来很不错,快邀请我进来玩吧")){ text.setText(CxResourceString.getInstance().str_chat_welcome_single_mode_default); } }else{ String[] faceTexts = getFaceTexts(mContext.getResources()); TypedArray faceImageIds = mContext.getResources().obtainTypedArray(R.array.cx_fa_ids_input_panel_face_images); boolean isFace=false; boolean hasright=false; SpannableStringBuilder spanStr = null; for(int i=0;i<mMsgText.length();i++){ if('['==mMsgText.charAt(i)){ for(int j=i+1;j<mMsgText.length();j++){ if(']'==mMsgText.charAt(j)){ hasright=true; String substring = mMsgText.substring(i, j+1); for(int m=0;m<faceTexts.length;m++){ if(faceTexts[m].equals(substring)){ isFace=true; int resourceId = faceImageIds.getResourceId(m, 0); spanStr = TextUtil.getImageSpanStr(substring, resourceId, mContext.getResources().getDimensionPixelSize(R.dimen.cx_fa_dimen_chat_emotion_size), mContext.getResources().getDimensionPixelSize(R.dimen.cx_fa_dimen_chat_emotion_size), mContext); text.append(spanStr); break; } } if(!isFace){ text.append(substring); } i=j; break; } } if(!hasright){ text.append("["); } }else{ text.append(mMsgText.charAt(i)+""); } } } // 图文混排 add by shichao /* try { SpannableStringBuilder builder = new SpannableStringBuilder(mMsgText); Pattern pattern = Pattern.compile("\\[(\\w+?)\\]"); Matcher matcher = pattern.matcher(mMsgText); String[] faceValues = getFaceValues(view.getResources()); String[] faceTexts = getFaceTexts(view.getResources()); TypedArray faceImageIds = view.getResources().obtainTypedArray(R.array.face_static_images); PictureUtils pu = new PictureUtils(mContext); while(matcher.find()){ for(int i = 0; i<matcher.groupCount(); i++){ System.out.println("Group 0:"+matcher.group(i));//得到第0组——整个匹配 for(int j = 0; j < faceTexts.length; j++){ if(matcher.group(i).equals(faceTexts[j])){ // Field field = R.drawable.class.getDeclaredField(faceValues[j]); // int resourceId = Integer.parseInt(field.get(null).toString()); int resourceId = faceImageIds.getResourceId(j, 0); Drawable drawable = mContext.getResources().getDrawable(resourceId); // Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), resourceId); // Bitmap imageBitmap = pu.zoomBitmap(bitmap, 45, 45); // ImageSpan span = new ImageSpan(mContext, imageBitmap, ImageSpan.ALIGN_BASELINE); InteractiveImageSpan span = new RelativeInteractiveImageSpan(drawable, 2.0f, 1); // drawable.setBounds(0, 0, 12, 12); builder.setSpan(span, matcher.start(), matcher.end(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); // bitmap.recycle(); break; } } } } text.setText(builder); } catch (NumberFormatException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } */ // catch (NoSuchFieldException e) { // e.printStackTrace(); // } catch (IllegalAccessException e) { // e.printStackTrace(); // } // text.setText(mMsgText); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date((long)(msgCreatTimeStamp) * 1000)); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日"); String dateNow = dateFormat.format(new Date((long)(msgCreatTimeStamp) * 1000)); if (mIsShowDate) { dateStamp.setVisibility(View.VISIBLE); dateStamp.setText(dateNow); } else { dateStamp.setVisibility(View.GONE); } String format = view.getResources().getString( R.string.cx_fa_nls_reminder_period_time_format); String time = String.format(format, calendar); timeStamp.setText(time); view.setTag(tag); return view; } }
package com.waltonbd.WebTests; import org.testng.Assert; import org.testng.annotations.Test; import com.waltonbd.WebPages.ProductsPage; public class ProductsTest extends BaseTest{ public ProductsTest(String url) { super("https://waltonbd.com/"); } @Test (priority=1) public void openProductPage() { page.getInstance(ProductsPage.class).gotoProductPage(); //Refrigerator & Freezer Assert.assertEquals(page.getPageTitle(), "Refrigerator & Freezer"); System.out.println("Page Title: "+page.getPageTitle()); } }
/* * Copyright 2010-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.h2cl.spring.data.foundationdb.support; import org.springframework.data.mapping.PersistentEntity; import org.springframework.data.repository.core.support.PersistentEntityInformation; import org.springframework.lang.Nullable; import de.h2cl.spring.data.foundationdb.core.mapping.FoundationDbPersistentEntity; import de.h2cl.spring.data.foundationdb.query.FoundationDbEntityInformation; /** * {@link FoundationDbEntityInformation} implementation using a {@link FoundationDbPersistentEntity} instance to lookup the necessary * information. Can be configured with a custom collection to be returned which will trump the one returned by the * {@link FoundationDbPersistentEntity} if given. * * @author Oliver Gierke * @author Christoph Strobl * @author Mark Paluch */ public class MappingFoundationDbEntityInformation<T, ID> extends PersistentEntityInformation<T, ID> implements FoundationDbEntityInformation<T, ID> { private final FoundationDbPersistentEntity<T> entityMetadata; private final @Nullable String customSubspaceName; private final Class<ID> fallbackIdType; /** * Creates a new {@link PersistentEntityInformation} for the given {@link PersistentEntity}. * * @param entity must not be {@literal null}. * @param customSubspaceName */ public MappingFoundationDbEntityInformation(FoundationDbPersistentEntity<T> entity, @Nullable String customSubspaceName, @Nullable Class<ID> fallbackIdType) { super(entity); this.entityMetadata = entity; this.customSubspaceName = customSubspaceName; this.fallbackIdType = fallbackIdType; } /** * Creates a new {@link MappingFoundationDbEntityInformation} for the given {@link FoundationDbPersistentEntity} and fallback * identifier type. * * @param entity must not be {@literal null}. * @param fallbackIdType can be {@literal null}. */ public MappingFoundationDbEntityInformation(FoundationDbPersistentEntity<T> entity, @Nullable Class<ID> fallbackIdType) { this(entity, null, fallbackIdType); } @Override public String getSubspaceName() { return customSubspaceName == null ? entityMetadata.getSubspace() : customSubspaceName; } }
package com.nxtlife.mgs.dao.impl; import java.util.List; import org.springframework.stereotype.Repository; import com.nxtlife.mgs.dao.RoleAuthorityDao; import com.nxtlife.mgs.entity.common.RoleAuthorityKey; import com.nxtlife.mgs.entity.user.RoleAuthority; @Repository("roleAuthorityDaoImpl") public class RoleAuthorityDaoImpl extends BaseDao<RoleAuthorityKey, RoleAuthority> implements RoleAuthorityDao { @Override public int deleteByRoleIdAndAuthorityIds(Long roleId, List<Long> authorityIds) { return query("delete from RoleAuthority where role_id=:roleId and authority_id in :authorityIds") .setParameter("roleId", roleId).setParameter("authorityIds", authorityIds).executeUpdate(); } }
package models; import java.util.Date; import javax.annotation.Nullable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import play.db.ebean.Model; @Entity public class Event extends Model { private static final long serialVersionUID = 1L; public static Finder<Integer, Event> find = new Finder<Integer, Event>( Integer.class, Event.class); @Id @GeneratedValue(strategy = GenerationType.AUTO) protected Integer id; protected String title; protected EventType type; protected Double latitude; protected Double longitude; @Column(columnDefinition = "TEXT") protected String description; protected Date beginning; @Nullable protected Date end; @ManyToOne protected Staff creator; public Event(Integer id, String title, EventType type, Double latitude, Double longitude, String description, Date beginning, Date end) { this.id = id; this.title = title; this.type = type; this.latitude = latitude; this.longitude = longitude; this.description = description; this.beginning = beginning; this.end = end; } public Event(String title, EventType type, Double latitude, Double longitude, String description, Date beginning) { this.title = title; this.type = type; this.latitude = latitude; this.longitude = longitude; this.description = description; this.beginning = beginning; } public Event(String title, EventType type, Double latitude, Double longitude, String description, Date beginning, Date end) { this.title = title; this.type = type; this.latitude = latitude; this.longitude = longitude; this.description = description; this.beginning = beginning; this.end = end; } public Staff getCreator() { return creator; } public void setCreator(Staff creator) { this.creator = creator; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public EventType getType() { return type; } public void setType(EventType type) { this.type = type; } public Double getLatitude() { return latitude; } public void setLatitude(Double latitude) { this.latitude = latitude; } public Double getLongitude() { return longitude; } public void setLongitude(Double longitude) { this.longitude = longitude; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Date getBeginning() { return beginning; } public void setBeginning(Date beginning) { this.beginning = beginning; } public Date getEnd() { return end; } public void setEnd(Date end) { this.end = end; } public static enum EventType { ALERT, NEWS, PREVENTION } }
package com.technology.share.service.impl; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.technology.share.service.BaseService; public class BaseServiceImpl<M extends BaseMapper<T>,T> extends ServiceImpl<M,T> implements BaseService<T> { }
package com.zhouyi.business.core.vo.headvo; /** * @author 李秸康 * @ClassNmae: LedenCollectDNAHeaderVo * @Description: DNA头信息 * @date 2019/7/4 13:43 * @Version 1.0 **/ public class LedenCollectDNAHeaderVo extends HeaderVo { }
package Flags; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; public class Sweden extends Flag { @Override public String getName() { return "Sweden"; } @Override public Node renderFlag() { StackPane flagContainer = new StackPane(); flagContainer.setAlignment(Pos.CENTER); Rectangle blue = new Rectangle(); blue.setWidth(400); blue.setHeight(200); blue.setFill(Color.rgb(0, 127, 229)); Rectangle y1 = new Rectangle(); y1.setWidth(40); y1.setHeight(200); y1.setTranslateY(0); y1.setTranslateX(-50); y1.setFill(Color.rgb(255, 204, 0)); Rectangle y2 = new Rectangle(); y2.setWidth(400); y2.setHeight(40); y2.setTranslateY(0); y2.setTranslateX(0); y2.setFill(Color.rgb(255, 204, 0)); flagContainer.getChildren().add(blue); flagContainer.getChildren().add(y1); flagContainer.getChildren().add(y2); return flagContainer; } }
/** * @Title: OfficeService.java * @package com.rofour.baseball.service.officemanage * @Project: baseball-yeah * ────────────────────────────────── * Copyright (c) 2016, 指端科技. */ package com.rofour.baseball.service.officemanage; import com.rofour.baseball.controller.model.ResultInfo; import com.rofour.baseball.controller.model.office.OfficeQueryInfo; import com.rofour.baseball.dao.officemanage.bean.OfficeBean; import com.rofour.baseball.dao.officemanage.bean.OfficeStoreBean; import java.io.IOException; import java.util.List; import java.util.Map; /** * @ClassName: OfficeService * @Description 职务管理接口 * @author WJ * @date 2016年10月12日 下午1:50:44 * */ public interface OfficeService { /** * @Description 查询 * @param info * @return List<AcctRefundBean> 返回类型 * @author WJ * @date 2016年10月12日 下午1:56:02 **/ List<OfficeBean> list(OfficeQueryInfo info); /** * @Description 统计 * @param info * @return int 返回类型 * @author WJ * @date 2016年10月12日 下午1:56:05 **/ int getTotal(OfficeQueryInfo info); /** * @Description 解除职务 * @return ResultInfo<Object> 返回类型 **/ ResultInfo<Object> dismiss(Long valueOf,int office); /** * @Description 更新审核状态 **/ void audit(Long auditId, Boolean isPass, Long managerId) throws Exception; /** * @Description 职务编辑细节 * @param userId * @throws IOException **/ ResultInfo<Object> officeDetail(Long userId) throws IOException; /** * * @Description 获取头像等图片信息 * @param bizId * @param attachType * */ ResultInfo<Object> getUrl(Long bizId,String attachType) throws IOException; /** * * @Description 查询属下小派和coo * @param info * */ public List<OfficeBean> queryAttached(OfficeQueryInfo info); /** * * @Description 统计属下小派或者coo人数 * @param info * */ public int userTotal(OfficeQueryInfo info); /** * * @Description 统计属下商户数 * @param info * */ public int storeTotal(OfficeQueryInfo info); /** * @Description 查询属下的商户 * @param info **/ List<OfficeStoreBean> queryAttachedStores(OfficeQueryInfo info); /** * @Description 小派删除,支持批量 * @param map **/ ResultInfo<Object> pDel(Map<String,Object> map); /** * @Description 商户删除,支持批量 * @param map **/ ResultInfo<Object> sDel(Map<String, Object> map); /** * @Description 查询普通小派 * @param info **/ List<OfficeBean> listPuser(OfficeQueryInfo info); /** * @Description 统计小派人数 * @param info **/ int getPuserTotal(OfficeQueryInfo info); /** * @Description 小派增加,支持批量 * @param map **/ ResultInfo<Object> pAdd(Map<String, Object> map); /** * @Description: 获取审核记录 * @param * @return * @throws * @author ZXY */ Map getOfficeAudit(OfficeQueryInfo queryInfo) throws Exception; }
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package pe.gob.onpe.adan.model.adan; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import javax.persistence.Table; /** * * @author bvaldez */ @Entity @Table(name = "TAB_LOCAL") public class Local implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_LOCAL") @SequenceGenerator(name = "SEQ_LOCAL", sequenceName = "SEQ_TAB_LOCAL_PK") @Column(name="N_LOCAL_PK") private Integer N_LOCAL_PK; @Column(name="C_CODIGO") @JsonProperty("C_CODIGO") private String C_CODIGO; @Column(name="C_UBIGEO") @JsonProperty("C_UBIGEO") private String C_UBIGEO; @Column(name="C_NOMBRE") @JsonProperty("C_NOMBRE") private String C_NOMBRE; @Column(name="C_DIRECCION") @JsonProperty("C_DIRECCION") private String C_DIRECCION; @Column(name="N_MESAS") @JsonProperty("N_MESAS") private Integer N_MESAS; @Column(name="N_ELECTORES") @JsonProperty("N_ELECTORES") private Integer N_ELECTORES; @Column(name="C_CCPP") @JsonProperty("C_CCPP") private String C_CCPP; @Column(name="N_LATITUD",nullable = true) @JsonProperty("N_LATITUD") private String N_LATITUD; @Column(name="N_LONGITUD",nullable = true) @JsonProperty("N_LONGITUD") private String N_LONGITUD; @Column(name="N_ESTADO") @JsonProperty("N_ESTADO") private int N_ESTADO; @Column (name="C_REFERENCIA") @JsonProperty("C_REFERENCIA") private String C_REFERENCIA; @Column (name="C_AUD_USUARIO_CREACION",nullable = true) @JsonProperty("C_AUD_USUARIO_CREACION") private String C_AUD_USUARIO_CREACION; @Column (name="D_AUD_FECHA_CREACION",nullable = true) @JsonProperty("D_AUD_FECHA_CREACION") private Date D_AUD_FECHA_CREACION; @Column (name="C_AUD_USUARIO_MODIFICACION",nullable = true) @JsonProperty("C_AUD_USUARIO_MODIFICACION") private String C_AUD_USUARIO_MODIFICACION; @Column(name="D_AUD_FECHA_MODIFICACION",nullable = true) @JsonProperty("D_AUD_FECHA_MODIFICACION") private Date D_AUD_FECHA_MODIFICACION; @Column(name="C_OBSERVACION",nullable = true) @JsonProperty("C_OBSERVACION") private String C_OBSERVACION; @Column(name="N_TIPO_SOLUCION") @JsonProperty("N_TIPO_SOLUCION") private Integer N_TIPO_SOLUCION; @Column(name="C_TIPO_SOLUCIONES",nullable = true) @JsonProperty("C_TIPO_SOLUCIONES") private String C_TIPO_SOLUCIONES; @Column(name="N_MESAS_ESTIMADAS",nullable = true) @JsonProperty("N_MESAS_ESTIMADAS") private Integer N_MESAS_ESTIMADAS; @Column(name="N_MESAS_ACTUALIZADAS",nullable = true) @JsonProperty("N_MESAS_ACTUALIZADAS") private Integer N_MESAS_ACTUALIZADAS; @Column(name="N_ELECTORES_MESA",nullable = true) @JsonProperty("N_ELECTORES_MESA") private String N_ELECTORES_MESA; public Integer getN_LOCAL_PK() { return N_LOCAL_PK; } public void setN_LOCAL_PK(Integer N_LOCAL_PK) { this.N_LOCAL_PK = N_LOCAL_PK; } public String getC_CODIGO() { return C_CODIGO; } public void setC_CODIGO(String C_CODIGO) { this.C_CODIGO = C_CODIGO; } public String getC_UBIGEO() { return C_UBIGEO; } public void setC_UBIGEO(String C_UBIGEO) { this.C_UBIGEO = C_UBIGEO; } public String getC_NOMBRE() { return C_NOMBRE; } public void setC_NOMBRE(String C_NOMBRE) { this.C_NOMBRE = C_NOMBRE; } public String getC_DIRECCION() { return C_DIRECCION; } public void setC_DIRECCION(String C_DIRECCION) { this.C_DIRECCION = C_DIRECCION; } public Integer getN_MESAS() { return N_MESAS; } public void setN_MESAS(Integer N_MESAS) { this.N_MESAS = N_MESAS; } public Integer getN_ELECTORES() { return N_ELECTORES; } public void setN_ELECTORES(Integer N_ELECTORES) { this.N_ELECTORES = N_ELECTORES; } public String getC_CCPP() { return C_CCPP; } public void setC_CCPP(String C_CCPP) { this.C_CCPP = C_CCPP; } public String getN_LATITUD() { return N_LATITUD; } public void setN_LATITUD(String N_LATITUD) { this.N_LATITUD = N_LATITUD; } public String getN_LONGITUD() { return N_LONGITUD; } public void setN_LONGITUD(String N_LONGITUD) { this.N_LONGITUD = N_LONGITUD; } public int getN_ESTADO() { return N_ESTADO; } public void setN_ESTADO(int N_ESTADO) { this.N_ESTADO = N_ESTADO; } public String getC_REFERENCIA() { return C_REFERENCIA; } public void setC_REFERENCIA(String C_REFERENCIA) { this.C_REFERENCIA = C_REFERENCIA; } public String getC_AUD_USUARIO_CREACION() { return C_AUD_USUARIO_CREACION; } public void setC_AUD_USUARIO_CREACION(String C_AUD_USUARIO_CREACION) { this.C_AUD_USUARIO_CREACION = C_AUD_USUARIO_CREACION; } public Date getD_AUD_FECHA_CREACION() { return D_AUD_FECHA_CREACION; } public void setD_AUD_FECHA_CREACION(Date D_AUD_FECHA_CREACION) { this.D_AUD_FECHA_CREACION = D_AUD_FECHA_CREACION; } public String getC_AUD_USUARIO_MODIFICACION() { return C_AUD_USUARIO_MODIFICACION; } public void setC_AUD_USUARIO_MODIFICACION(String C_AUD_USUARIO_MODIFICACION) { this.C_AUD_USUARIO_MODIFICACION = C_AUD_USUARIO_MODIFICACION; } public Date getD_AUD_FECHA_MODIFICACION() { return D_AUD_FECHA_MODIFICACION; } public void setD_AUD_FECHA_MODIFICACION(Date D_AUD_FECHA_MODIFICACION) { this.D_AUD_FECHA_MODIFICACION = D_AUD_FECHA_MODIFICACION; } public String getC_OBSERVACION() { return C_OBSERVACION; } public void setC_OBSERVACION(String C_OBSERVACION) { this.C_OBSERVACION = C_OBSERVACION; } public Integer getN_TIPO_SOLUCION() { return N_TIPO_SOLUCION; } public void setN_TIPO_SOLUCION(Integer N_TIPO_SOLUCION) { this.N_TIPO_SOLUCION = N_TIPO_SOLUCION; } public String getC_TIPO_SOLUCIONES() { return C_TIPO_SOLUCIONES; } public void setC_TIPO_SOLUCIONES(String C_TIPO_SOLUCIONES) { this.C_TIPO_SOLUCIONES = C_TIPO_SOLUCIONES; } public Integer getN_MESAS_ESTIMADAS() { return N_MESAS_ESTIMADAS; } public void setN_MESAS_ESTIMADAS(Integer N_MESAS_ESTIMADAS) { this.N_MESAS_ESTIMADAS = N_MESAS_ESTIMADAS; } public Integer getN_MESAS_ACTUALIZADAS() { return N_MESAS_ACTUALIZADAS; } public void setN_MESAS_ACTUALIZADAS(Integer N_MESAS_ACTUALIZADAS) { this.N_MESAS_ACTUALIZADAS = N_MESAS_ACTUALIZADAS; } public String getN_ELECTORES_MESA() { return N_ELECTORES_MESA; } public void setN_ELECTORES_MESA(String N_ELECTORES_MESA) { this.N_ELECTORES_MESA = N_ELECTORES_MESA; } }
/* * Copyright 2007 Jens Dietrich * 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 example.nz.org.take.compiler.userv.testcases; import java.util.Calendar; import java.util.GregorianCalendar; import nz.org.take.rt.DerivationLogEntry; import nz.org.take.rt.ResultSet; import example.nz.org.take.compiler.userv.domainmodel.*; import example.nz.org.take.compiler.userv.generated.*; import junit.framework.TestCase; /** * Test cases based on the UServ example. * http://www.businessrulesforum.com/2005_Product_Derby.pdf * @author <a href="http://www-ist.massey.ac.nz/JBDietrich/">Jens Dietrich</a> */ public class UservTestCases extends TestCase { private UservRules kb = null; private int CURRENTYEAR = new GregorianCalendar().get(Calendar.YEAR); protected void setUp() throws Exception { super.setUp(); kb = new UservRules(); // bind constants referenced in the kb Constants.HighTheftProbabilityAutoList = HighTheftProbabilityAutoList.getList(); Constants.CurrentYear = CURRENTYEAR; Constants.NextYear = CURRENTYEAR+1; } private void printLog(ResultSet result) { for (Object s:result.getDerivationLog()) { System.out.println(((DerivationLogEntry)s).getName()); } } private int count(ResultSet result) { int count =0; while(result.hasNext()) { result.next(); count = count+1; } return count; } public void testAE_POIC01() throws Exception { Car car = new Car(); car.setHasDriversAirbag(false); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); ResultSet<PotentialOccupantInjuryRating> result = kb.getPotentialOccupantInjuryRating(car); assertTrue(result.hasNext()); assertEquals("extremely high",result.next().rating); } public void testAE_POIC02() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); ResultSet<PotentialOccupantInjuryRating> result = kb.getPotentialOccupantInjuryRating(car); assertTrue(result.hasNext()); assertEquals("high",result.next().rating); } public void testAE_POIC03() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(false); ResultSet<PotentialOccupantInjuryRating> result = kb.getPotentialOccupantInjuryRating(car); assertTrue(result.hasNext()); assertEquals("moderate",result.next().rating); } public void testAE_POIC04() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); ResultSet<PotentialOccupantInjuryRating> result = kb.getPotentialOccupantInjuryRating(car); assertTrue(result.hasNext()); assertEquals("low",result.next().rating); } public void testAE_POIC05() throws Exception { Car car = new Car(); car.setConvertible(true); car.setHasRollBar(false); ResultSet<PotentialOccupantInjuryRating> result = kb.getPotentialOccupantInjuryRating(car); assertTrue(result.hasNext()); assertEquals("extremely high",result.next().rating); } public void testAE_PTC01() throws Exception { Car car = new Car(); car.setConvertible(true); car.setPrice(20000); ResultSet<PotentialTheftRating> result = kb.getPotenialTheftRating(car); assertTrue(result.hasNext()); assertEquals("high",result.next().rating); } public void testAE_PTC02() throws Exception { Car car = new Car(); car.setConvertible(false); car.setPrice(50000); ResultSet<PotentialTheftRating> result = kb.getPotenialTheftRating(car); assertTrue(result.hasNext()); assertEquals("high",result.next().rating); } public void testAE_PTC03() throws Exception { Car car = new Car(); car.setConvertible(false); car.setPrice(20000); car.setType("Mini"); ResultSet<PotentialTheftRating> result = kb.getPotenialTheftRating(car); assertTrue(result.hasNext()); assertEquals("high",result.next().rating); } public void testAE_PTC04() throws Exception { Car car = new Car(); car.setConvertible(false); car.setPrice(30000); car.setType("BMW 3"); ResultSet<PotentialTheftRating> result = kb.getPotenialTheftRating(car); assertTrue(result.hasNext()); assertEquals("moderate",result.next().rating); } public void testAE_PTC05() throws Exception { Car car = new Car(); car.setConvertible(false); car.setPrice(18000); car.setType("Daihatsu Sirion"); ResultSet<PotentialTheftRating> result = kb.getPotenialTheftRating(car); assertTrue(result.hasNext()); assertEquals("low",result.next().rating); } public void testAE01() throws Exception { Car car = new Car(); car.setHasDriversAirbag(false); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); ResultSet<AutoEligibility> result = kb.getAutoEligibility(car); assertTrue(result.hasNext()); assertEquals("not eligible",result.next().value); } public void testAE02() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); ResultSet<AutoEligibility> result = kb.getAutoEligibility(car); assertTrue(result.hasNext()); assertEquals("provisional",result.next().value); } public void testAE03() throws Exception { Car car = new Car(); car.setConvertible(true); car.setPrice(20000); car.setType("Mini"); car.setHasDriversAirbag(true); ResultSet<AutoEligibility> result = kb.getAutoEligibility(car); assertTrue(result.hasNext()); assertEquals("provisional",result.next().value); } public void testAE04() throws Exception { Car car = new Car(); car.setConvertible(false); car.setPrice(18000); car.setType("Skoda Fabia"); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); ResultSet<AutoEligibility> result = kb.getAutoEligibility(car); assertTrue(result.hasNext()); assertEquals("eligible",result.next().value); } public void testDE_DAC01() throws Exception { Driver driver = new Driver(); driver.setAge(23); driver.setMale(true); ResultSet<DriverCategory> result = kb.getDriverCategory(driver); assertTrue(result.hasNext()); assertEquals("young driver",result.next().category); } public void testDE_DAC02() throws Exception { Driver driver = new Driver(); driver.setAge(19); driver.setMale(false); ResultSet<DriverCategory> result = kb.getDriverCategory(driver); assertTrue(result.hasNext()); assertEquals("young driver",result.next().category); } public void testDE_DAC03() throws Exception { Driver driver = new Driver(); driver.setAge(19); driver.setMale(false); driver.setHasDriversTrainingFromSchool(true); ResultSet<DriverEligibility> result = kb.getDriverEligibility(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DAC04() throws Exception { Driver driver = new Driver(); driver.setAge(77); ResultSet<DriverCategory> result = kb.getDriverCategory(driver); assertTrue(result.hasNext()); assertEquals("senior driver",result.next().category); } public void testDE_DAC05() throws Exception { Driver driver = new Driver(); driver.setAge(77); driver.setHasDriversTrainingFromSchool(true); ResultSet<DriverEligibility> result = kb.getDriverEligibility(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DAC06() throws Exception { Driver driver = new Driver(); driver.setAge(44); ResultSet<DriverEligibility> result = kb.getDriverEligibility(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DAC07() throws Exception { Driver driver = new Driver(); driver.setHasDriversTrainingFromSchool(true); ResultSet<TrainedDriver> result = kb.hasTrainingCertification(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DAC08() throws Exception { Driver driver = new Driver(); driver.setHasDriversTrainingFromLicensedDriverTrainingCompany(true); ResultSet<TrainedDriver> result = kb.hasTrainingCertification(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DAC09() throws Exception { Driver driver = new Driver(); driver.setHasTakenASeniorCitizenDriversRefresherCourse(true); ResultSet<TrainedDriver> result = kb.hasTrainingCertification(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DRC01() throws Exception { Driver driver = new Driver(); driver.setHasBeenConvictedOfaDUI(true); ResultSet<HighRiskDriver> result = kb.isHighRiskDriver(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DRC02() throws Exception { Driver driver = new Driver(); driver.setNumberOfAccidentsInvolvedIn(5); ResultSet<HighRiskDriver> result = kb.isHighRiskDriver(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DRC02a() throws Exception { Driver driver = new Driver(); driver.setNumberOfAccidentsInvolvedIn(1); ResultSet<HighRiskDriver> result = kb.isHighRiskDriver(driver); assertFalse(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DRC03() throws Exception { Driver driver = new Driver(); driver.setNumberOfMovingViolationsInLastTwoYears(5); ResultSet<HighRiskDriver> result = kb.isHighRiskDriver(driver); assertTrue(result.hasNext()); // nothing to compare - unary predicate } public void testDE_DRC03a() throws Exception { Driver driver = new Driver(); driver.setNumberOfMovingViolationsInLastTwoYears(1); ResultSet<HighRiskDriver> result = kb.isHighRiskDriver(driver); result.next(); this.printLog(result); assertFalse(result.hasNext()); // nothing to compare - unary predicate } public void testES_01a() throws Exception { // car will be not eligible due to AE_POIC05 and AE_01 Car car = new Car(); car.setConvertible(true); car.setHasRollBar(false); // driver will be normal driver Driver driver = new Driver(); driver.setAge(30); // check other rules used assertEquals("not eligible",kb.getAutoEligibility(car).next().value); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(100,result.next().score); } public void testES_01b() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); // driver will be normal driver Driver driver = new Driver(); driver.setAge(30); // check other rules used assertEquals("provisional",kb.getAutoEligibility(car).next().value); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(50,result.next().score); } public void testES_02a() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); // driver will be a young driver that is not eligible Driver driver = new Driver(); driver.setAge(17); driver.setHasDriversTrainingFromSchool(false); driver.setHasDriversTrainingFromLicensedDriverTrainingCompany(false); driver.setHasTakenASeniorCitizenDriversRefresherCourse(false); // check other rules used assertEquals("young driver",kb.getDriverCategory(driver).next().category); assertFalse(kb.hasTrainingCertification(driver).hasNext()); assertEquals("eligible",kb.getAutoEligibility(car).next().value); assertFalse(kb.getDriverEligibility(driver).hasNext()); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(30,result.next().score); } public void testES_02b() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); // driver will be a senior driver that is not eligible Driver driver = new Driver(); driver.setAge(88); driver.setHasDriversTrainingFromSchool(false); driver.setHasDriversTrainingFromLicensedDriverTrainingCompany(false); driver.setHasTakenASeniorCitizenDriversRefresherCourse(false); // check other rules used assertEquals("senior driver",kb.getDriverCategory(driver).next().category); assertFalse(kb.hasTrainingCertification(driver).hasNext()); assertEquals("eligible",kb.getAutoEligibility(car).next().value); ResultSet<DriverEligibility> rs = kb.getDriverEligibility(driver); rs.next(); assertFalse(kb.getDriverEligibility(driver).hasNext()); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(20,result.next().score); } public void testES_02c() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); // driver will be a high risk driver Driver driver = new Driver(); driver.setAge(42); driver.setNumberOfAccidentsInvolvedIn(5); assertTrue(kb.isHighRiskDriver(driver).hasNext()); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(100,result.next().score); } public void testES_03a() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); Driver driver = new Driver(); driver.setAge(42); driver.setPreferred(true); assertFalse(kb.isHighRiskDriver(driver).hasNext()); assertTrue(kb.getDriverEligibility(driver).hasNext()); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(-50,result.next().score); } public void testES_03b() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); Driver driver = new Driver(); driver.setAge(42); driver.setElite(true); assertFalse(kb.isHighRiskDriver(driver).hasNext()); assertTrue(kb.getDriverEligibility(driver).hasNext()); // check components of policy scores ResultSet<PolicyEligibilityScore> result = kb.getPolicyEligibilityScore(car, driver); assertTrue(result.hasNext()); assertEquals(-100,result.next().score); } public void testES_04() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); // driver will be normal driver Driver driver = new Driver(); driver.setAge(30); // check other rules used assertEquals("provisional",kb.getAutoEligibility(car).next().value); assertEquals(50,kb.getPolicyEligibilityScore(car,driver).next().score); assertEquals(1,count(kb.getPolicyEligibilityScore(car, driver))); ResultSet<InsuranceEligibility> result = kb.getPolicyEligibility(car,driver); assertTrue(result.hasNext()); assertEquals("eligible",result.next().status); } public void testES_05() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); // driver will be a high risk driver Driver driver = new Driver(); driver.setAge(42); driver.setNumberOfAccidentsInvolvedIn(5); assertTrue(kb.isHighRiskDriver(driver).hasNext()); assertEquals(100,kb.getPolicyEligibilityScore(car,driver).next().score); ResultSet<InsuranceEligibility> result = kb.getPolicyEligibility(car,driver); assertTrue(result.hasNext()); assertEquals("must be reviewed by underwriting manager",result.next().status); } // no test case for ES_06 - cannot create a client with eligibilityScore > 250 !! public void testES_07_08() throws Exception { Car car = new Car(); car.setConvertible(false); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); // driver will be a high risk driver Driver driver = new Driver(); driver.setAge(42); driver.setNumberOfYearsWithUServ(20); assertTrue(kb.isLongTermClient(driver).hasNext()); ResultSet<InsuranceEligibility> result = kb.getPolicyEligibility(car,driver); assertTrue(result.hasNext()); assertEquals("eligible",result.next().status); } public void testAP_01() throws Exception { Car car = new Car(); car.setCategory("compact"); ResultSet<BasePremium> result = kb.getBasePremium(car); assertTrue(result.hasNext()); assertEquals(250,result.next().premium); } public void testAP_02() throws Exception { Car car = new Car(); car.setCategory("sedan"); ResultSet<BasePremium> result = kb.getBasePremium(car); assertTrue(result.hasNext()); assertEquals(400,result.next().premium); } public void testAP_03() throws Exception { Car car = new Car(); car.setCategory("luxury"); ResultSet<BasePremium> result = kb.getBasePremium(car); assertTrue(result.hasNext()); assertEquals(500,result.next().premium); } public void testAP_04_05() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true);// make sure the insury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setModelYear(CURRENTYEAR); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); assertTrue(result.hasNext()); assertEquals(400,result.next().premium); assertFalse(result.hasNext()); } public void testAP_04_06() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); // make sure the insury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setModelYear(CURRENTYEAR+1); // next years model Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); assertTrue(result.hasNext()); assertEquals(400,result.next().premium); assertFalse(result.hasNext()); } public void testAP_07() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); // make sure the insury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setAge(3); car.setModelYear(CURRENTYEAR-3); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); assertTrue(result.hasNext()); assertEquals(300,result.next().premium); assertFalse(result.hasNext()); } public void testAP_08() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); // make sure the insury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setAge(7); car.setModelYear(CURRENTYEAR-7); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); assertTrue(result.hasNext()); assertEquals(250,result.next().premium); assertFalse(result.hasNext()); } public void testAP_09() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); // make sure the injury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setAge(7); car.setModelYear(CURRENTYEAR-7); Policy policy = new Policy(); policy.setIncludesUninsuredMotoristCoverage(true); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); // part 1 - from car assertTrue(result.hasNext()); assertEquals(250,result.next().premium); // part 2 - from policy assertTrue(result.hasNext()); assertEquals(300,result.next().premium); assertFalse(result.hasNext()); } public void testAP_10() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); // make sure the injury rating is low so that other rules don't fire car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setAge(7); car.setModelYear(CURRENTYEAR-7); Policy policy = new Policy(); policy.setIncludesMedicalCoverage(true); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); // part 1 - from car assertTrue(result.hasNext()); assertEquals(250,result.next().premium); // part 2 - from policy assertTrue(result.hasNext()); assertEquals(600,result.next().premium); assertFalse(result.hasNext()); } public void testAP_11() throws Exception { Car car = new Car(); car.setHasRollBar(false); car.setConvertible(true); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setAge(7); car.setModelYear(CURRENTYEAR-7); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); // part 1 - from age assertTrue(result.hasNext()); assertEquals(250,result.next().premium); // part 2 - from occupant injury rating assertTrue(result.hasNext()); assertEquals(1000,result.next().premium); } public void testAP_12() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); car.setAge(7); car.setModelYear(CURRENTYEAR-7); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); // part 1 - from age assertTrue(result.hasNext()); assertEquals(250,result.next().premium); // part 2 - from occupant injury rating assertTrue(result.hasNext()); assertEquals(500,result.next().premium); } public void testAP_13() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); car.setAge(7); car.setModelYear(CURRENTYEAR-7); car.setPrice(50000); Policy policy = new Policy(); ResultSet<AdditionalPremium> result = kb.getAdditionalPremium(policy, car); // part 1 - from age assertTrue(result.hasNext()); assertEquals(250,result.next().premium); // part 2 - from theft rating assertTrue(result.hasNext()); assertEquals(500,result.next().premium); } public void testAD_01() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); ResultSet<PremiumDiscount> result = kb.getPremiumDiscount(car); assertTrue(result.hasNext()); assertEquals(12,result.next().discount); } public void testAD_02() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(false); ResultSet<PremiumDiscount> result = kb.getPremiumDiscount(car); assertTrue(result.hasNext()); assertEquals(15,result.next().discount); } public void testAD_03() throws Exception { Car car = new Car(); car.setHasDriversAirbag(true); car.setHasFrontPassengerAirbag(true); car.setHasSidePanelAirbags(true); ResultSet<PremiumDiscount> result = kb.getPremiumDiscount(car); assertTrue(result.hasNext()); assertEquals(18,result.next().discount); } public void testAD_04() throws Exception { Car car = new Car(); car.setHasDriversAirbag(false); car.setHasFrontPassengerAirbag(false); car.setHasSidePanelAirbags(false); car.setPrice(80000); car.setHasAlarm(true); ResultSet<PremiumDiscount> result = kb.getPremiumDiscount(car); assertTrue(result.hasNext()); assertEquals(10,result.next().discount); } public void testDP_01() throws Exception { Driver driver = new Driver(); driver.setAge(17); driver.setMarried(true); driver.setLocation("CA"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(700,result.next().premium); } public void testDP_02() throws Exception { Driver driver = new Driver(); driver.setAge(17); driver.setMarried(false); driver.setLocation("NY"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(720,result.next().premium); } public void testDP_03() throws Exception { Driver driver = new Driver(); driver.setAge(17); driver.setMarried(true); driver.setLocation("FL"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(300,result.next().premium); } public void testDP_04() throws Exception { Driver driver = new Driver(); driver.setAge(17); driver.setMarried(false); driver.setLocation("FL"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(300,result.next().premium); } public void testDP_05() throws Exception { Driver driver = new Driver(); driver.setAge(75); driver.setMarried(false); driver.setLocation("NY"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(500,result.next().premium); } public void testDP_06() throws Exception { Driver driver = new Driver(); driver.setAge(75); driver.setMarried(false); driver.setLocation("FL"); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(200,result.next().premium); } public void testDP_07() throws Exception { Driver driver = new Driver(); driver.setAge(42); // neither young nor senior ResultSet<DriverCategory> result = kb.getDriverCategory(driver); assertTrue(result.hasNext()); assertEquals("typical driver",result.next().category); } public void testDP_08() throws Exception { Driver driver = new Driver(); driver.setAge(42); driver.setNumberOfAccidentsInvolvedIn(5); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(1000,result.next().premium); } public void testDP_09() throws Exception { Driver driver = new Driver(); driver.setAge(42); driver.setNumberOfAccidentsInvolvedIn(2); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(300,result.next().premium); } public void testMSD_01() throws Exception { Driver driver = new Driver(); driver.setAge(42); driver.setPreferred(true); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(-250,result.next().premium); } public void testMSD_02() throws Exception { Driver driver = new Driver(); driver.setAge(42); driver.setElite(true); ResultSet<AdditionalDriverPremium> result = kb.getAdditionalDriverPremium(driver); assertTrue(result.hasNext()); assertEquals(-500,result.next().premium); } }
package com.github.emailtohl.integration.web.service.chat; import java.io.Serializable; import java.util.Date; import java.util.Map; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; /** * 被websocket序列化的类 * @author HeLei */ public class Chat implements Cloneable, Serializable { private static final long serialVersionUID = 7381096058154145043L; private String content; private String userId; private Date time; private String name; private String nickname;// 可存储第三方昵称 private String email; private String iconSrc; private String cellPhone; public Chat() {} public Chat(Map<?, ?> map) { } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNickname() { return nickname; } public void setNickname(String nickname) { this.nickname = nickname; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getIconSrc() { return iconSrc; } public void setIconSrc(String iconSrc) { this.iconSrc = iconSrc; } public String getCellPhone() { return cellPhone; } public void setCellPhone(String cellPhone) { this.cellPhone = cellPhone; } @Override public String toString() { return "Chat [content=" + content + ", userId=" + userId + ", time=" + time + ", name=" + name + ", nickname=" + nickname + ", email=" + email + ", iconSrc=" + iconSrc + ", cellPhone=" + cellPhone + "]"; } }
/* * FAGI core package */ package gr.athena.innovation.fagi.core;
package com.bierocratie.db.accounting; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Query; import com.bierocratie.db.persistence.PersistenceManager; import java.math.BigDecimal; import java.sql.SQLException; /** * Created with IntelliJ IDEA. * User: pir * Date: 01/11/14 * Time: 12:06 * To change this template use File | Settings | File Templates. */ //FIXME //@UIScoped public class StockValueDAO { private static final String SELECT_STOCK = "SELECT s.amount FROM StockValue s WHERE s.year.year=:year"; private static final EntityManagerFactory entityManagerFactory = PersistenceManager.getInstance().getEntityManagerFactory(); public BigDecimal getStockHTByYear(String year) throws SQLException { EntityManager entityManager = entityManagerFactory.createEntityManager(); Query query = entityManager.createQuery(SELECT_STOCK); query.setParameter("year", year); if (query.getResultList().isEmpty()) { return BigDecimal.ZERO; } return new BigDecimal((Double) query.getSingleResult()); } }
package Aula09; public class Tenista extends JogDecorator{ Tenista(JogadorInterface i) { super(i); // TODO Auto-generated constructor stub } public void joga(){ super.joga(); System.out.print(" tenis "); } public void serve(){ System.out.println("--serve"); } }
import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Color; public class MainMenu { static MainMenu window; protected JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { window = new MainMenu(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainMenu() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBackground(Color.CYAN); frame.getContentPane().setBackground(Color.GREEN); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JLabel lblWhatWouldYou = new JLabel("What Would you like to do:"); lblWhatWouldYou.setBounds(128, 26, 191, 15); frame.getContentPane().add(lblWhatWouldYou); JButton btnCreateNewAccount = new JButton("Create New Account"); btnCreateNewAccount.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { CreateAccount create = new CreateAccount(); create.frame.setVisible(true); } }); btnCreateNewAccount.setBounds(94, 67, 244, 25); frame.getContentPane().add(btnCreateNewAccount); JButton btnDeposit = new JButton("Deposit"); btnDeposit.setBounds(94, 99, 244, 25); frame.getContentPane().add(btnDeposit); JButton btnWithdraw = new JButton("Withdraw"); btnWithdraw.setBounds(94, 131, 244, 25); frame.getContentPane().add(btnWithdraw); JButton btnUpdateAccountInformation = new JButton("Update Account Information"); btnUpdateAccountInformation.setBounds(94, 161, 244, 25); frame.getContentPane().add(btnUpdateAccountInformation); JButton btnLogout = new JButton("LOGOUT"); btnLogout.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { window.frame.dispose(); LoginWIndow login = new LoginWIndow(); EventQueue.invokeLater(new Runnable() { public void run() { try { login.frame.setVisible(true); login.frame.setTitle("Login"); } catch (Exception e) { } } }); } }); btnLogout.setBounds(34, 209, 114, 25); frame.getContentPane().add(btnLogout); JButton btnExit = new JButton("EXIT"); btnExit.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { System.exit(0); } }); btnExit.setBounds(284, 209, 114, 25); frame.getContentPane().add(btnExit); } }
package edu.iss.caps.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import edu.iss.caps.model.User; public class LecturerCheckInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if(request.getSession().getAttribute("user")!=null){ User u=(User) request.getSession().getAttribute("user"); if (!u.getRole().equals("Lecturer")){ response.sendRedirect("/caps/home/login"); } } else if(request.getSession().getAttribute("user")==null){ response.sendRedirect("/caps/home/login"); } return true; } }
public class poolPuzzles { public static void main (String[] args) { puzzle1(); } public static void puzzle1() { int x = 0; while () { } } }
/* * Copyright (C) 2015 Miquel Sas * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program. If not, see * <http://www.gnu.org/licenses/>. */ package com.qtplaf.library.util.xml; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.SAXException; /** * Wraps the <i>SAXParser</i> to handler events with the more simple and convenient <i>ParserHandler</i>. * * @author Miquel Sas */ public class Parser { /** * Default constructor. */ public Parser() { } /** * Parse the file handling event with the argument parser handler. * * @param file The XML file to parse. * @param handler The parser handler. * @throws ParserConfigurationException If a config error occurs. * @throws SAXException If a parser error occurs. * @throws IOException If an IO error occurs. */ public void parse(File file, ParserHandler handler) throws ParserConfigurationException, SAXException, IOException { parse(new FileInputStream(file), handler); } /** * Parse the file handling event with the argument parser handler. * * @param is The input stream. * @param handler The parser handler. * @throws ParserConfigurationException If a config error occurs. * @throws SAXException If a parser error occurs. * @throws IOException If an IO error occurs. */ public void parse(InputStream is, ParserHandler handler) throws ParserConfigurationException, SAXException, IOException { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); InternalParserHandler internalHandler = new InternalParserHandler(handler); try { parser.parse(is, internalHandler); } finally { is.close(); } } }
package q0124_hard; public class BinaryTreeMaximumPathSum { }
package org.murinrad.android.musicmultiply.devices.management; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; import org.murinrad.android.musicmultiply.MainActivity; import org.murinrad.android.musicmultiply.datamodel.device.DeviceImpl; import org.murinrad.android.musicmultiply.datamodel.device.IDevice; import org.murinrad.android.musicmultiply.devices.management.security.SecurityProvider; import java.io.InvalidClassException; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; /** * Created by Radovan Murin on 6.4.2015. */ public abstract class IDeviceAdvertListener implements IDeviceManager, SecurityProvider.ISecurityProviderListener { private static final String KNOWN_DEV_STORE = "KNOWN_DEVICES"; List<IDeviceManager> deviceManagerList = new ArrayList<>(); Set<IDevice> deviceSet; SharedPreferences knownDevicesStore; IDeviceAdvertListener(Context ctx) { deviceSet = new DeviceSet(new SecurityProvider(ctx)); knownDevicesStore = ctx.getSharedPreferences(KNOWN_DEV_STORE, 0); SecurityProvider.addSecurityProviderListener(this); } public static IDevice[] getAllKnownDevices(Context ctx) { SharedPreferences prefx = ctx.getSharedPreferences(KNOWN_DEV_STORE, 0); Map<String, Object> allDevices = (Map<String, Object>) prefx.getAll(); List<IDevice> devices = new ArrayList<>(); for (Object o : allDevices.values()) { String serialized = (String) o; try { IDevice dev = new DeviceImpl(serialized, null); devices.add(dev); } catch (InvalidClassException e) { Log.w(MainActivity.APP_TAG, "Unknown string in device store", e); } } return devices.toArray(new IDevice[]{}); } synchronized void notifyAdd(IDevice device) { for (IDeviceManager devMgr : deviceManagerList) { devMgr.addDevice(device); } } synchronized void notifyRemove(IDevice device) { for (IDeviceManager devMgr : deviceManagerList) { devMgr.removeDevice(device); } } synchronized void notifyRemove(String device) { for (IDeviceManager devMgr : deviceManagerList) { devMgr.removeDevice(device); } } synchronized void notifyListeners() { for (IDeviceManager devMgr : deviceManagerList) { devMgr.refreshDevices(getAllDevices()); } } public synchronized void addDeviceListener(IDeviceManager deviceManager) { deviceManagerList.add(deviceManager); deviceManager.refreshDevices(getAllDevices()); } public synchronized void removeDeviceManager(IDeviceManager deviceManager) { Object o = deviceManagerList.remove(deviceManager); if (o == null) Log.w(MainActivity.APP_TAG, "Device advert listener was asked to remove a listener which was not registered"); } synchronized IDevice[] getAllDevices() { return deviceSet.toArray(new IDevice[]{}); } @Override public synchronized void addDevice(IDevice dev) { if (deviceSet.add(dev)) { Log.i(MainActivity.APP_TAG, "New device added:" + dev.getName()); notifyAdd(dev); } } @Override public synchronized void removeDevice(IDevice dev) { deviceSet.remove(dev); Log.i(MainActivity.APP_TAG, "Device removed:" + dev.getName()); notifyRemove(dev); } @Override public synchronized void removeDevice(String UUID) { Iterator<IDevice> iterator = deviceSet.iterator(); while (iterator.hasNext()) { IDevice d = iterator.next(); if (d.getDeviceUUID().equals(UUID)) { iterator.remove(); notifyRemove(d); break; } } } @Override public void onSecurityChange() { removeAllDevices(); } private void removeAllDevices() { for (IDevice dev : getAllDevices()) { removeDevice(dev); } } @Override public synchronized void refreshDevices(IDevice[] devs) { notifyListeners(); } public abstract void stop(); protected class DeviceSet extends HashSet<IDevice> { SecurityProvider security; DeviceSet(SecurityProvider provider) { this.security = provider; } @Override public boolean add(final IDevice object) { if (contains(object)) return false; SharedPreferences.Editor e = knownDevicesStore.edit(); e.putString(object.getDeviceUUID(), object.serialize()); e.commit(); final AtomicBoolean retVal = new AtomicBoolean(false); final AtomicBoolean waiter = new AtomicBoolean(true); security.isAuthorisedAsync(object, new SecurityProvider.SecurityProviderCallback() { @Override public void onAuthSuccess() { retVal.set(true); DeviceSet.super.add(object); waiter.set(false); } @Override public void onAuthFailure() { waiter.set(false); } }); while (waiter.get()) { //wait for auth } return retVal.get(); } } }
/* * Created on Mar 30, 2007 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package com.ibm.ive.tools.japt.reorderTest; import com.ibm.ive.tools.commandLine.FlagOption; import com.ibm.ive.tools.commandLine.Option; import com.ibm.ive.tools.japt.ExtensionException; import com.ibm.ive.tools.japt.JaptRepository; import com.ibm.ive.tools.japt.Logger; import com.ibm.ive.tools.japt.commandLine.CommandLineExtension; import com.ibm.jikesbt.BT_ClassComparator; public class ReorderExtension implements CommandLineExtension { private FlagOption slow = new FlagOption("slow", "slow class order"); public Option[] getOptions() { return new Option[] {slow}; } public void execute(JaptRepository repository, Logger logger) throws ExtensionException { repository.sortClasses(slow.isFlagged() ? new SlowExecutionClassComparator() : (BT_ClassComparator) new FastExecutionClassComparator()); } public String getName() { return "Reorder extension"; } }
package com.tencent.mm.plugin.hp.b; import android.content.Context; import android.content.Intent; import com.tencent.map.lib.mapstructure.MapRouteSectionWithName; import com.tencent.mm.plugin.report.service.KVCommCrossProcessReceiver; import com.tencent.mm.plugin.report.service.h; import com.tencent.mm.plugin.sns.i$l; import com.tencent.mm.sdk.platformtools.ad; import com.tencent.mm.sdk.platformtools.ak; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.smtt.sdk.WebViewClient; import com.tencent.tinker.loader.shareutil.ShareIntentUtil; import com.tencent.tinker.loader.shareutil.SharePatchFileUtil; import com.tencent.tinker.loader.shareutil.ShareTinkerInternals; public final class b { private static long kmx = 0; public static void aWk() { h.mEJ.a(338, 9, 1, false); } public static void rl(int i) { x.i("Tinker.HotPatchReportHelper", "hp_report new hotpatch requested"); switch (i) { case 0: h.mEJ.a(338, 0, 1, false); break; case 1: h.mEJ.a(338, 20, 1, false); break; case 2: h.mEJ.a(614, 0, 1, false); break; } kmx = bi.VG(); } public static void rm(int i) { long bI = bi.bI(kmx); x.i("Tinker.HotPatchReportHelper", "hp_report report download cost = %d", new Object[]{Long.valueOf(bI)}); switch (i) { case 1: h.mEJ.a(338, 40, 1, false); break; } if (bI < 0) { x.e("Tinker.HotPatchReportHelper", "hp_report report download cost failed, invalid cost"); } else if (bI <= 5000) { h.mEJ.U(338, 1, 43); } else if (bI <= 60000) { h.mEJ.U(338, 1, 44); } else if (bI <= 180000) { h.mEJ.U(338, 1, 45); } else { h.mEJ.U(338, 1, 46); } } public static void rn(int i) { x.i("Tinker.HotPatchReportHelper", "hp_report download failed"); switch (i) { case 0: h.mEJ.a(338, 41, 1, false); return; case 1: h.mEJ.a(338, 42, 1, false); return; case 2: h.mEJ.a(614, 3, 1, false); return; default: return; } } public static void fK(boolean z) { x.i("Tinker.HotPatchReportHelper", "hp_report try to apply hotpatch"); h.mEJ.U(338, 2, 71); if (z) { h.mEJ.a(338, 7, 1, true); } } public static void ro(int i) { x.i("Tinker.HotPatchReportHelper", "hp_report try to apply hotpatch fail"); switch (i) { case -26: h.mEJ.a(338, 83, 1, false); return; case -25: h.mEJ.a(338, 82, 1, false); return; case -24: h.mEJ.a(338, 81, 1, false); return; case -23: h.mEJ.a(338, 79, 1, false); return; case -22: h.mEJ.a(338, 80, 1, false); return; case -21: h.mEJ.a(338, 77, 1, false); return; case -20: h.mEJ.a(338, 76, 1, false); return; case WebViewClient.ERROR_IO /*-7*/: h.mEJ.a(338, 84, 1, false); return; case WebViewClient.ERROR_CONNECT /*-6*/: h.mEJ.a(338, 78, 1, false); return; case WebViewClient.ERROR_PROXY_AUTHENTICATION /*-5*/: h.mEJ.a(338, 85, 1, false); return; case WebViewClient.ERROR_AUTHENTICATION /*-4*/: h.mEJ.a(338, 74, 1, false); return; case WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME /*-3*/: h.mEJ.a(338, 73, 1, false); return; case -2: h.mEJ.a(338, 75, 1, false); return; case -1: h.mEJ.a(338, 72, 1, false); return; default: return; } } public static void N(Intent intent) { KVCommCrossProcessReceiver.brK(); x.i("Tinker.HotPatchReportHelper", "hp_report try to apply patch service start"); if (intent == null) { h.mEJ.U(338, 6, 127); } else if (ShareIntentUtil.j(intent, "patch_path_extra") == null) { h.mEJ.U(338, 6, MapRouteSectionWithName.kMaxRoadNameLength); } else { h.mEJ.a(338, 6, 1, true); } } public static void l(long j, boolean z) { if (z) { h.mEJ.a(338, 3, 1, true); } if (z) { h.mEJ.a(338, 101, 1, false); } else { h.mEJ.a(338, 103, 1, false); } x.i("Tinker.HotPatchReportHelper", "hp_report report apply cost = %d", new Object[]{Long.valueOf(j)}); if (j < 0) { x.e("Tinker.HotPatchReportHelper", "hp_report report apply cost failed, invalid cost"); } else if (j <= 5000) { if (z) { h.mEJ.a(338, 117, 1, false); } else { h.mEJ.a(338, 122, 1, false); } } else if (j <= 10000) { if (z) { h.mEJ.a(338, 118, 1, false); } else { h.mEJ.a(338, 123, 1, false); } } else if (j <= 30000) { if (z) { h.mEJ.a(338, 119, 1, false); } else { h.mEJ.a(338, 124, 1, false); } } else if (j > 60000) { if (j >= 3600000) { h.mEJ.a(338, 133, 1, false); } if (z) { h.mEJ.a(338, 121, 1, false); } else { h.mEJ.a(338, 126, 1, false); } } else if (z) { h.mEJ.a(338, 120, 1, false); } else { h.mEJ.a(338, 125, 1, false); } } public static void rp(int i) { x.i("Tinker.HotPatchReportHelper", "hp_report package check failed, error = %d", new Object[]{Integer.valueOf(i)}); switch (i) { case WebViewClient.ERROR_TIMEOUT /*-8*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, 131); return; case WebViewClient.ERROR_IO /*-7*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, 113); return; case WebViewClient.ERROR_CONNECT /*-6*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, 112); return; case WebViewClient.ERROR_PROXY_AUTHENTICATION /*-5*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, i$l.AppCompatTheme_switchStyle); return; case WebViewClient.ERROR_AUTHENTICATION /*-4*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, i$l.AppCompatTheme_spinnerStyle); return; case WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME /*-3*/: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, i$l.AppCompatTheme_seekBarStyle); return; case -2: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, 129); return; case -1: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, i$l.AppCompatTheme_ratingBarStyleSmall); return; default: return; } } public static void d(Throwable th) { h.mEJ.a(338, 104, 1, false); h.mEJ.c("Tinker", "Tinker Exception:apply tinker occur unknown exception " + ak.j(th), null); } public static void e(Throwable th) { if (th.getMessage().contains("checkDexOptExist failed")) { h.mEJ.a(338, 134, 1, false); } else if (th.getMessage().contains("checkDexOptFormat failed")) { h.mEJ.a(338, 135, 1, false); h.mEJ.c("Tinker", "Tinker Exception:apply tinker occur dexOpt format exception " + ak.j(th), null); } else { h.mEJ.a(338, 105, 1, false); h.mEJ.c("Tinker", "Tinker Exception:apply tinker occur dexOpt exception " + ak.j(th), null); } } public static void aWl() { h.mEJ.a(338, 106, 1, false); } public static void aWm() { h.mEJ.a(338, 116, 1, false); } public static void rq(int i) { switch (i) { case 1: h.mEJ.a(338, 130, 1, false); return; case 3: h.mEJ.a(338, 114, 1, false); return; case 5: h.mEJ.a(338, 115, 1, false); return; case 6: h.mEJ.a(338, 132, 1, false); return; case 7: h.mEJ.a(338, 136, 1, false); return; default: return; } } public static void m(long j, boolean z) { h.mEJ.a(338, 4, 1, false); if (z) { x.i("Tinker.HotPatchReportHelper", "hp_report report load cost = %d", new Object[]{Long.valueOf(j)}); if (j < 0) { x.e("Tinker.HotPatchReportHelper", "hp_report report load cost failed, invalid cost"); return; } else if (j <= 500) { h.mEJ.a(338, 177, 1, false); return; } else if (j <= 1000) { h.mEJ.a(338, 178, 1, false); return; } else if (j <= 3000) { h.mEJ.a(338, 179, 1, false); return; } else if (j <= 5000) { h.mEJ.a(338, 180, 1, false); return; } else { h.mEJ.a(338, 181, 1, false); return; } } h.mEJ.a(338, 159, 1, false); } public static void a(Throwable th, int i) { boolean z = false; switch (i) { case WebViewClient.ERROR_AUTHENTICATION /*-4*/: h.mEJ.a(338, 188, 1, false); break; case WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME /*-3*/: if (!th.getMessage().contains("checkResInstall failed")) { h.mEJ.a(338, 184, 1, false); break; } h.mEJ.a(338, 190, 1, false); z = true; break; case -2: if (!th.getMessage().contains("checkDexInstall failed")) { h.mEJ.a(338, 161, 1, false); x.e("Tinker.HotPatchReportHelper", "tinker dex reflect fail:" + th.getMessage()); break; } h.mEJ.a(338, 189, 1, false); x.i("Tinker.HotPatchReportHelper", "tinker dex check fail:" + th.getMessage()); z = true; break; case -1: h.mEJ.a(338, 160, 1, false); break; } if (!z) { String j = ak.j(th); if (i == -4) { Context context = ad.getContext(); String hY = SharePatchFileUtil.hY(context); if (!ShareTinkerInternals.oW(hY)) { j = "tinker checkSafeModeCount fail:\n" + hY; SharePatchFileUtil.aj(SharePatchFileUtil.hX(context)); } } h.mEJ.c("Tinker", "Tinker Exception:load tinker occur exception " + j, null); } } public static void j(boolean z, int i) { x.i("Tinker.HotPatchReportHelper", "hp_report package check failed, error = %d", new Object[]{Integer.valueOf(i)}); if (z) { h.mEJ.a(338, 170, 1, false); } switch (i) { case WebViewClient.ERROR_TIMEOUT /*-8*/: h.mEJ.U(338, 169, 186); return; case WebViewClient.ERROR_IO /*-7*/: h.mEJ.U(338, 169, 176); return; case WebViewClient.ERROR_CONNECT /*-6*/: h.mEJ.U(338, 169, 175); return; case WebViewClient.ERROR_PROXY_AUTHENTICATION /*-5*/: h.mEJ.U(338, 169, 174); return; case WebViewClient.ERROR_AUTHENTICATION /*-4*/: h.mEJ.U(338, 169, 173); return; case WebViewClient.ERROR_UNSUPPORTED_AUTH_SCHEME /*-3*/: h.mEJ.U(338, 169, 172); return; case -2: h.mEJ.U(338, i$l.AppCompatTheme_ratingBarStyleIndicator, 182); return; case -1: h.mEJ.U(338, 169, 171); return; default: return; } } public static void rr(int i) { switch (i) { case 1: h.mEJ.a(338, 166, 1, false); return; case 2: h.mEJ.a(338, 167, 1, false); return; case 3: h.mEJ.a(338, 164, 1, false); return; case 4: h.mEJ.a(338, 183, 1, false); return; case 5: h.mEJ.a(338, 165, 1, false); return; case 6: h.mEJ.a(338, 187, 1, false); return; default: return; } } public static void rs(int i) { switch (i) { case 3: h.mEJ.a(338, 162, 1, false); return; case 5: h.mEJ.a(338, 163, 1, false); return; case 6: h.mEJ.a(338, 185, 1, false); return; default: return; } } public static void aWn() { h.mEJ.a(338, 168, 1, false); } public static void aWo() { h.mEJ.a(338, 5, 1, false); } public static void c(int i, Throwable th) { switch (i) { case 0: h.mEJ.a(338, 193, 1, false); return; case 1: h.mEJ.a(338, 191, 1, false); h.mEJ.c("Tinker", "Tinker Exception:interpret occur instruction exception " + ak.j(th), null); return; case 2: h.mEJ.a(338, 192, 1, false); h.mEJ.c("Tinker", "Tinker Exception:interpret occur command exception " + ak.j(th), null); return; default: return; } } }
package com.cybozu.kintone.client.module.record; import static org.junit.Assert.*; import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; import java.util.Random; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import com.cybozu.kintone.client.TestConstants; import com.cybozu.kintone.client.authentication.Auth; import com.cybozu.kintone.client.connection.Connection; import com.cybozu.kintone.client.exception.KintoneAPIException; import com.cybozu.kintone.client.model.app.form.FieldType; import com.cybozu.kintone.client.model.comment.AddCommentResponse; import com.cybozu.kintone.client.model.comment.CommentContent; import com.cybozu.kintone.client.model.comment.CommentMention; import com.cybozu.kintone.client.model.comment.GetCommentsResponse; import com.cybozu.kintone.client.model.file.FileModel; import com.cybozu.kintone.client.model.member.Member; import com.cybozu.kintone.client.model.record.AddRecordResponse; import com.cybozu.kintone.client.model.record.AddRecordsResponse; import com.cybozu.kintone.client.model.record.GetRecordResponse; import com.cybozu.kintone.client.model.record.GetRecordsResponse; import com.cybozu.kintone.client.model.record.RecordUpdateItem; import com.cybozu.kintone.client.model.record.RecordUpdateKey; import com.cybozu.kintone.client.model.record.RecordUpdateResponseItem; import com.cybozu.kintone.client.model.record.RecordUpdateStatusItem; import com.cybozu.kintone.client.model.record.SubTableValueItem; import com.cybozu.kintone.client.model.record.UpdateRecordResponse; import com.cybozu.kintone.client.model.record.UpdateRecordsResponse; import com.cybozu.kintone.client.model.record.field.FieldValue; import com.cybozu.kintone.client.module.file.File; public class RecordTest { private static Integer APP_ID; private static String API_TOKEN = "xxx"; private static String HA_API_TOKEN = "xxx"; private static String NO_VIEW_PERMISSION_API_TOKEN = "xxx"; private static String NO_ADD_PERMISSION_API_TOKEN = "xxx"; private static String ADD_NO_VIEW_API_TOKEN = "xxx"; private static String BLANK_APP_API_TOKEN = "xxx"; private static String GUEST_SPACE_API_TOKEN = "xxx"; private static String ANOTHER_GUEST_SPACE_API_TOKEN = "xxx"; private static String PROHIBIT_DUPLICATE_API_TOKEN = "xxx"; private static String REQUIRED_FIELD_API_TOKEN = "xxx"; private static String NO_ADMIN_PERMISSION_API_TOKEN = "xxx"; private static String NO_DELETE_PERMISSION_API_TOKEN = "xxx"; private static String NO_EDIT_PERMISSION_API_TOKEN = "xxx"; private static String LOCAL_LANGUAGE_API_TOKEN = "xxx"; private static String NO_SET_ASSIGNEE_API_TOKEN = "xxx"; private static String NO_MANAGE_PERMISSION_API_TOKEN = "xxx"; private static Member testman1 = new Member("xxx", "xxx"); private static Member testman2 = new Member("xxx", "xxx"); private static Member testgroup1 = new Member("xxx", "xxx"); private static Member testgroup2 = new Member("xxx", "xxx"); private static Member testorg1 = new Member("xxx", "xxx"); private static Member testorg2 = new Member("xxx", "xxx"); private static Member testAdimin = new Member("xxx", "xxx"); private static Member testTokenAdimin = new Member("xxx", "xxx"); private static Member testCertAdimin = new Member("xxx", "xxx"); private Record passwordAuthRecordManagerment; private Record guestAuthRecordManagerment; private Record tokenRecordManagerment; private Record noViewPermissionTokenRecordManagerment; private Record noAddPermissionTokenReocrdManagerment; private Record addNoViewTokenRecordManagerment; private Record blankAppApiTokenRecordManagerment; private Record prohibitDuplicateTokenRecordManagerment; private Record requiredFieldTokenRecordManagerment; private Record noAdminPermissionRecordManagerment; private Record noDeletePermissionRecordManagerment; private Record noEditPermissionRecordManagerment; private Record localLanguageRecordManagerment; private Record noSetAssigneeRecordManagerment; private Record noManagePermissionRecordManagerment; private Record tokenGuestRecordManagerment; private Record certRecordManagerment; private Record certGuestRecordManagerment; private Integer uniqueKey = 1; @Before public void setup() throws KintoneAPIException { Auth passwordAuth = new Auth(); passwordAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection passwordAuthConnection = new Connection(TestConstants.DOMAIN, passwordAuth); passwordAuthConnection.setProxy(TestConstants.PROXY_HOST, TestConstants.PROXY_PORT); this.passwordAuthRecordManagerment = new Record(passwordAuthConnection); Auth guestAuth = new Auth(); guestAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection gusetConnection = new Connection(TestConstants.DOMAIN, guestAuth, TestConstants.GUEST_SPACE_ID); this.guestAuthRecordManagerment = new Record(gusetConnection); Auth tokenAuth = new Auth(); tokenAuth.setApiToken(API_TOKEN); Connection tokenConnection = new Connection(TestConstants.DOMAIN, tokenAuth); this.tokenRecordManagerment = new Record(tokenConnection); Auth tokenAuth1 = new Auth(); tokenAuth1.setApiToken(NO_VIEW_PERMISSION_API_TOKEN); Connection tokenConnection1 = new Connection(TestConstants.DOMAIN, tokenAuth1); this.noViewPermissionTokenRecordManagerment = new Record(tokenConnection1); Auth tokenAuth2 = new Auth(); tokenAuth2.setApiToken(BLANK_APP_API_TOKEN); Connection tokenConnection2 = new Connection(TestConstants.DOMAIN, tokenAuth2); this.blankAppApiTokenRecordManagerment = new Record(tokenConnection2); Auth tokenAuth3 = new Auth(); tokenAuth3.setApiToken(PROHIBIT_DUPLICATE_API_TOKEN); Connection tokenConnection3 = new Connection(TestConstants.DOMAIN, tokenAuth3); this.prohibitDuplicateTokenRecordManagerment = new Record(tokenConnection3); Auth tokenAuth4 = new Auth(); tokenAuth4.setApiToken(REQUIRED_FIELD_API_TOKEN); Connection tokenConnection4 = new Connection(TestConstants.DOMAIN, tokenAuth4); this.requiredFieldTokenRecordManagerment = new Record(tokenConnection4); Auth tokenAuth5 = new Auth(); tokenAuth5.setApiToken(NO_ADD_PERMISSION_API_TOKEN); Connection tokenConnection5 = new Connection(TestConstants.DOMAIN, tokenAuth5); this.noAddPermissionTokenReocrdManagerment = new Record(tokenConnection5); Auth tokenAuth6 = new Auth(); tokenAuth6.setApiToken(ADD_NO_VIEW_API_TOKEN); Connection tokenConnection6 = new Connection(TestConstants.DOMAIN, tokenAuth6); this.addNoViewTokenRecordManagerment = new Record(tokenConnection6); Auth tokenAuth7 = new Auth(); tokenAuth7.setApiToken(NO_ADMIN_PERMISSION_API_TOKEN); Connection tokenConnection7 = new Connection(TestConstants.DOMAIN, tokenAuth7); this.noAdminPermissionRecordManagerment = new Record(tokenConnection7); Auth tokenAuth8 = new Auth(); tokenAuth8.setApiToken(NO_DELETE_PERMISSION_API_TOKEN); Connection tokenConnection8 = new Connection(TestConstants.DOMAIN, tokenAuth8); this.noDeletePermissionRecordManagerment = new Record(tokenConnection8); Auth tokenAuth9 = new Auth(); tokenAuth9.setApiToken(NO_EDIT_PERMISSION_API_TOKEN); Connection tokenConnection9 = new Connection(TestConstants.DOMAIN, tokenAuth9); this.noEditPermissionRecordManagerment = new Record(tokenConnection9); Auth tokenAuth10 = new Auth(); tokenAuth10.setApiToken(LOCAL_LANGUAGE_API_TOKEN); Connection tokenConnection10 = new Connection(TestConstants.DOMAIN, tokenAuth10); this.localLanguageRecordManagerment = new Record(tokenConnection10); Auth tokenAuth11 = new Auth(); tokenAuth11.setApiToken(NO_SET_ASSIGNEE_API_TOKEN); Connection tokenConnection11 = new Connection(TestConstants.DOMAIN, tokenAuth11); this.noSetAssigneeRecordManagerment = new Record(tokenConnection11); Auth tokenAuth12 = new Auth(); tokenAuth12.setApiToken(NO_MANAGE_PERMISSION_API_TOKEN); Connection tokenConnection12 = new Connection(TestConstants.DOMAIN, tokenAuth12); this.noManagePermissionRecordManagerment = new Record(tokenConnection12); Auth tokenGuestAuth = new Auth(); tokenGuestAuth.setApiToken(GUEST_SPACE_API_TOKEN); Connection tokenGuestConnection = new Connection(TestConstants.DOMAIN, tokenGuestAuth, TestConstants.GUEST_SPACE_ID); this.tokenGuestRecordManagerment = new Record(tokenGuestConnection); Auth certAuth = new Auth(); certAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certAuth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection certConnection = new Connection(TestConstants.SECURE_DOMAIN, certAuth); this.certRecordManagerment = new Record(certConnection); Auth certGuestAuth = new Auth(); certGuestAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certGuestAuth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection CertGuestConnection = new Connection(TestConstants.SECURE_DOMAIN, certGuestAuth, TestConstants.GUEST_SPACE_ID); this.certGuestRecordManagerment = new Record(CertGuestConnection); // get maximum "数値"field value in all records and set it uniqueKey. String query = "order by 数値 desc"; ArrayList<String> fields = new ArrayList<String>(); fields.add("数値"); GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, query, fields, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); this.uniqueKey += Integer.parseInt((String) resultRecords.get(0).get("数値").getValue()); } public HashMap<String, FieldValue> createTestRecord() { HashMap<String, FieldValue> testRecord = new HashMap<String, FieldValue>(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text"); testRecord = addField(testRecord, "数値", FieldType.NUMBER, this.uniqueKey); this.uniqueKey += 1; testRecord = addField(testRecord, "文字列__複数行", FieldType.MULTI_LINE_TEXT, "test multi text"); testRecord = addField(testRecord, "リッチエディター", FieldType.RICH_TEXT, "<div>test rich text<br /></div>"); ArrayList<String> selectedItemList = new ArrayList<String>(); selectedItemList.add("sample1"); selectedItemList.add("sample2"); testRecord = addField(testRecord, "チェックボックス", FieldType.CHECK_BOX, selectedItemList); testRecord = addField(testRecord, "ラジオボタン", FieldType.RADIO_BUTTON, "sample2"); testRecord = addField(testRecord, "ドロップダウン", FieldType.DROP_DOWN, "sample3"); testRecord = addField(testRecord, "複数選択", FieldType.MULTI_SELECT, selectedItemList); testRecord = addField(testRecord, "リンク", FieldType.LINK, "http://cybozu.co.jp/"); testRecord = addField(testRecord, "日付", FieldType.DATE, "2018-01-01"); testRecord = addField(testRecord, "時刻", FieldType.TIME, "12:34"); testRecord = addField(testRecord, "日時", FieldType.DATETIME, "2018-01-02T02:30:00Z"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(testman1); userList.add(testman2); addField(testRecord, "ユーザー選択", FieldType.USER_SELECT, userList); ArrayList<Member> groupList = new ArrayList<Member>(); groupList.add(testgroup1); groupList.add(testgroup2); addField(testRecord, "グループ選択", FieldType.GROUP_SELECT, groupList); ArrayList<Member> orgList = new ArrayList<Member>(); orgList.add(testorg1); orgList.add(testorg2); addField(testRecord, "組織選択", FieldType.ORGANIZATION_SELECT, orgList); return testRecord; } public HashMap<String, FieldValue> addField(HashMap<String, FieldValue> record, String code, FieldType type, Object value) { FieldValue newField = new FieldValue(); newField.setType(type); newField.setValue(value); record.put(code, newField); return record; } @Test public void testGetRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); ArrayList<FileModel> cbFileList = new ArrayList<FileModel>(); FileModel file1 = new FileModel(); file1.setContentType("text/plain"); file1.setFileKey("xxx"); file1.setName("xxx.txt"); file1.setSize("0"); cbFileList.add(file1); FileModel file2 = new FileModel(); file2.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); file2.setFileKey("xxx"); file2.setName("RecordModuleTest.xlsx"); file2.setSize("6577"); cbFileList.add(file2); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, cbFileList); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tableItem1 = new SubTableValueItem(); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(testman1); userList.add(testman2); addField(testRecord, "ユーザー選択", FieldType.USER_SELECT, userList); tableItem1.setID(3016494); HashMap<String, FieldValue> tableItemValue1 = new HashMap<String, FieldValue>(); tableItemValue1 = addField(tableItemValue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tableItemValue1 = addField(tableItemValue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue1 = addField(tableItemValue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text1"); tableItem1.setValue(tableItemValue1); subTable.add(tableItem1); SubTableValueItem tableItem2 = new SubTableValueItem(); tableItem2.setID(3016497); HashMap<String, FieldValue> tableItemValue2 = new HashMap<String, FieldValue>(); tableItemValue2 = addField(tableItemValue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample2"); tableItemValue2 = addField(tableItemValue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue2 = addField(tableItemValue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text2"); tableItem2.setValue(tableItemValue2); subTable.add(tableItem2); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 1234); testRecord = addField(testRecord, "計算_数値", FieldType.CALC, 1234); ArrayList<String> categoryList = new ArrayList<String>(); categoryList.add("テスト1-1"); categoryList.add("テスト1"); categoryList.add("テスト2"); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, categoryList); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "未処理"); ArrayList<Member> assigneeList = new ArrayList<Member>(); assigneeList.add(testman1); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, assigneeList); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "lookup1"); // Main Test processing Integer id = 1; GetRecordResponse response = this.passwordAuthRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); ArrayList<FileModel> cbFileList = new ArrayList<FileModel>(); FileModel file1 = new FileModel(); file1.setContentType("text/plain"); file1.setFileKey("xxx"); file1.setName("xxx.txt"); file1.setSize("0"); cbFileList.add(file1); FileModel file2 = new FileModel(); file2.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); file2.setFileKey("xxx"); file2.setName("xxx.xlsx"); file2.setSize("6577"); cbFileList.add(file2); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, cbFileList); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tableItem1 = new SubTableValueItem(); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(testman1); userList.add(testman2); addField(testRecord, "ユーザー選択", FieldType.USER_SELECT, userList); tableItem1.setID(3016494); HashMap<String, FieldValue> tableItemValue1 = new HashMap<String, FieldValue>(); tableItemValue1 = addField(tableItemValue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tableItemValue1 = addField(tableItemValue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue1 = addField(tableItemValue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text1"); tableItem1.setValue(tableItemValue1); subTable.add(tableItem1); SubTableValueItem tableItem2 = new SubTableValueItem(); tableItem2.setID(3016497); HashMap<String, FieldValue> tableItemValue2 = new HashMap<String, FieldValue>(); tableItemValue2 = addField(tableItemValue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample2"); tableItemValue2 = addField(tableItemValue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue2 = addField(tableItemValue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text2"); tableItem2.setValue(tableItemValue2); subTable.add(tableItem2); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 1234); testRecord = addField(testRecord, "計算_数値", FieldType.CALC, 1234); ArrayList<String> categoryList = new ArrayList<String>(); categoryList.add("テスト1-1"); categoryList.add("テスト1"); categoryList.add("テスト2"); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, categoryList); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "未処理"); ArrayList<Member> assigneeList = new ArrayList<Member>(); assigneeList.add(testman1); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, assigneeList); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "lookup1"); // Main Test processing Integer id = 1; GetRecordResponse response = this.tokenRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); ArrayList<FileModel> cbFileList = new ArrayList<FileModel>(); FileModel file1 = new FileModel(); file1.setContentType("text/plain"); file1.setFileKey("xxx"); file1.setName("xxx.txt"); file1.setSize("0"); cbFileList.add(file1); FileModel file2 = new FileModel(); file2.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); file2.setFileKey("xxx"); file2.setName("xxx.xlsx"); file2.setSize("6577"); cbFileList.add(file2); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, cbFileList); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tableItem1 = new SubTableValueItem(); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(testman1); userList.add(testman2); addField(testRecord, "ユーザー選択", FieldType.USER_SELECT, userList); tableItem1.setID(3016494); HashMap<String, FieldValue> tableItemValue1 = new HashMap<String, FieldValue>(); tableItemValue1 = addField(tableItemValue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tableItemValue1 = addField(tableItemValue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue1 = addField(tableItemValue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text1"); tableItem1.setValue(tableItemValue1); subTable.add(tableItem1); SubTableValueItem tableItem2 = new SubTableValueItem(); tableItem2.setID(3016497); HashMap<String, FieldValue> tableItemValue2 = new HashMap<String, FieldValue>(); tableItemValue2 = addField(tableItemValue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample2"); tableItemValue2 = addField(tableItemValue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableItemValue2 = addField(tableItemValue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "test table_text2"); tableItem2.setValue(tableItemValue2); subTable.add(tableItem2); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 1234); testRecord = addField(testRecord, "計算_数値", FieldType.CALC, 1234); ArrayList<String> categoryList = new ArrayList<String>(); categoryList.add("テスト1-1"); categoryList.add("テスト1"); categoryList.add("テスト2"); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, categoryList); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "未処理"); ArrayList<Member> assigneeList = new ArrayList<Member>(); assigneeList.add(testman1); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, assigneeList); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "lookup1"); // Main Test processing Integer id = 1; GetRecordResponse response = this.certRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordDefaultBlankApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "$id", FieldType.__ID__, 1); testRecord = addField(testRecord, "$revision", FieldType.__REVISION__, 1); testRecord = addField(testRecord, "创建人", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "创建时间", FieldType.CREATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "更新人", FieldType.MODIFIER, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新时间", FieldType.UPDATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "记录编号", FieldType.RECORD_NUMBER, 1); // Main Test processing Integer appid = 1633; Integer recordId = 1; GetRecordResponse response = this.passwordAuthRecordManagerment.getRecord(appid, recordId); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordDefaultBlankAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "$id", FieldType.__ID__, 1); testRecord = addField(testRecord, "$revision", FieldType.__REVISION__, 1); testRecord = addField(testRecord, "创建人", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "创建时间", FieldType.CREATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "更新人", FieldType.MODIFIER, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新时间", FieldType.UPDATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "记录编号", FieldType.RECORD_NUMBER, 1); // Main Test processing Integer appid = 1633; Integer recordId = 1; GetRecordResponse response = this.blankAppApiTokenRecordManagerment.getRecord(appid, recordId); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordDefaultBlankAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "$id", FieldType.__ID__, 1); testRecord = addField(testRecord, "$revision", FieldType.__REVISION__, 1); testRecord = addField(testRecord, "创建人", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "创建时间", FieldType.CREATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "更新人", FieldType.MODIFIER, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新时间", FieldType.UPDATED_TIME, "2018-08-22T06:30:00Z"); testRecord = addField(testRecord, "记录编号", FieldType.RECORD_NUMBER, 1); // Main Test processing Integer appid = 1633; Integer recordId = 1; GetRecordResponse response = this.certRecordManagerment.getRecord(appid, recordId); HashMap<String, FieldValue> resultRecord = response.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testGetRecordNoPermissionFieldDoNotDisplay() throws KintoneAPIException { Integer appid = 1635; Integer recordId = 1; GetRecordResponse response = this.passwordAuthRecordManagerment.getRecord(appid, recordId); HashMap<String, FieldValue> resultRecord = response.getRecord(); assertNull(resultRecord.get("数值")); assertEquals(9, resultRecord.size()); } @Test public void testGetRecordNoPermissionFieldDoNotDisplayCert() throws KintoneAPIException { Integer appid = 1635; Integer recordId = 1; GetRecordResponse response = this.certRecordManagerment.getRecord(appid, recordId); HashMap<String, FieldValue> resultRecord = response.getRecord(); assertNull(resultRecord.get("数值")); assertEquals(9, resultRecord.size()); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutApp() throws KintoneAPIException { Integer id = 1; this.passwordAuthRecordManagerment.getRecord(null, id); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutAppToken() throws KintoneAPIException { Integer id = 1; this.tokenRecordManagerment.getRecord(null, id); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutAppCert() throws KintoneAPIException { Integer id = 1; this.certRecordManagerment.getRecord(null, id); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(100000, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(100000, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(100000, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdNegative() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(-1, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdNegativeToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(-1, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdNegativeCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(-1, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(0, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(0, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordAppIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(0, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutRecord() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutRecordToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordWithoutRecordCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(APP_ID, 100000); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(APP_ID, 100000); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(APP_ID, 100000); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdNegative() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(APP_ID, -1); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdNegativeToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(APP_ID, -1); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdNegativeCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(APP_ID, -1); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(APP_ID, 0); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecord(APP_ID, 0); } @Test(expected = KintoneAPIException.class) public void testGetRecordRecordIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(APP_ID, 0); } @Test(expected = KintoneAPIException.class) public void testGetRecordWhenDoNotHavePermissionOfApp() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecord(1632, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordWhenDoNotHavePermissionOfAppToken() throws KintoneAPIException { this.noViewPermissionTokenRecordManagerment.getRecord(1632, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordWhenDoNotHavePermissionOfAppCert() throws KintoneAPIException { this.certRecordManagerment.getRecord(1632, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordWhenDoNotHavePermissionOfRecord() throws KintoneAPIException { Integer appId = 1634; Integer recordId = 1; this.passwordAuthRecordManagerment.getRecord(appId, recordId); } @Test(expected = KintoneAPIException.class) public void testGetRecordWhenDoNotHavePermissionOfRecordCert() throws KintoneAPIException { Integer appId = 1634; Integer recordId = 1; this.certRecordManagerment.getRecord(appId, recordId); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailInGuestSpace() throws KintoneAPIException { this.guestAuthRecordManagerment.getRecord(APP_ID, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailInGuestSpaceToken() throws KintoneAPIException { this.tokenGuestRecordManagerment.getRecord(APP_ID, 1); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailInGuestSpaceCert() throws KintoneAPIException { this.certGuestRecordManagerment.getRecord(APP_ID, 1); } @Test public void testGetRecords() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test public void testGetRecordsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.tokenRecordManagerment.getRecords(APP_ID, query, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test public void testGetRecordsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.certRecordManagerment.getRecords(APP_ID, query, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test(expected = KintoneAPIException.class) public void testGetRecordsWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; this.passwordAuthRecordManagerment.getRecords(null, query, null, true); } @Test(expected = KintoneAPIException.class) public void testGetRecordsWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; this.tokenRecordManagerment.getRecords(null, query, null, true); } @Test(expected = KintoneAPIException.class) public void testGetRecordsWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; this.certRecordManagerment.getRecords(null, query, null, true); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecords(100000, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecords(100000, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.getRecords(100000, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdNegative() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecords(-1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdNegativeToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecords(-1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdNegativeCert() throws KintoneAPIException { this.certRecordManagerment.getRecords(-1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecords(0, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecords(0, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsAppIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.getRecords(0, null, null, null); } @Test public void testGetRecordsWithoutQuery() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, null, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertTrue((Integer) 3 <= response.getTotalCount()); assertTrue(3 <= resultRecords.size()); } @Test public void testGetRecordsWithoutQueryToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing GetRecordsResponse response = this.tokenRecordManagerment.getRecords(APP_ID, null, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertTrue((Integer) 3 <= response.getTotalCount()); assertTrue(3 <= resultRecords.size()); } @Test public void testGetRecordsWithoutQueryCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing GetRecordsResponse response = this.certRecordManagerment.getRecords(APP_ID, null, null, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertTrue((Integer) 3 <= response.getTotalCount()); assertTrue(3 <= resultRecords.size()); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidQuery() throws KintoneAPIException { this.passwordAuthRecordManagerment.getRecords(APP_ID, "aaa", null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidQueryToken() throws KintoneAPIException { this.tokenRecordManagerment.getRecords(APP_ID, "aaa", null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidQueryCert() throws KintoneAPIException { this.certRecordManagerment.getRecords(APP_ID, "aaa", null, null); } @Test public void testGetRecordsWithFields() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; ArrayList<String> fields = new ArrayList<String>(); fields.add("数値"); GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, query, fields, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); assertEquals(1, resultRecords.get(0).size()); assertEquals(String.valueOf(testRecord1.get("数値").getValue()), resultRecords.get(0).get("数値").getValue()); assertEquals(1, resultRecords.get(1).size()); assertEquals(String.valueOf(testRecord2.get("数値").getValue()), resultRecords.get(1).get("数値").getValue()); assertEquals(1, resultRecords.get(2).size()); assertEquals(String.valueOf(testRecord3.get("数値").getValue()), resultRecords.get(2).get("数値").getValue()); } @Test public void testGetRecordsWithFieldsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; ArrayList<String> fields = new ArrayList<String>(); fields.add("数値"); GetRecordsResponse response = this.tokenRecordManagerment.getRecords(APP_ID, query, fields, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); assertEquals(1, resultRecords.get(0).size()); assertEquals(String.valueOf(testRecord1.get("数値").getValue()), resultRecords.get(0).get("数値").getValue()); assertEquals(1, resultRecords.get(1).size()); assertEquals(String.valueOf(testRecord2.get("数値").getValue()), resultRecords.get(1).get("数値").getValue()); assertEquals(1, resultRecords.get(2).size()); assertEquals(String.valueOf(testRecord3.get("数値").getValue()), resultRecords.get(2).get("数値").getValue()); } @Test public void testGetRecordsWithFieldsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; ArrayList<String> fields = new ArrayList<String>(); fields.add("数値"); GetRecordsResponse response = this.certRecordManagerment.getRecords(APP_ID, query, fields, true); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals((Integer) 3, response.getTotalCount()); assertEquals(3, resultRecords.size()); assertEquals(1, resultRecords.get(0).size()); assertEquals(String.valueOf(testRecord1.get("数値").getValue()), resultRecords.get(0).get("数値").getValue()); assertEquals(1, resultRecords.get(1).size()); assertEquals(String.valueOf(testRecord2.get("数値").getValue()), resultRecords.get(1).get("数値").getValue()); assertEquals(1, resultRecords.get(2).size()); assertEquals(String.valueOf(testRecord3.get("数値").getValue()), resultRecords.get(2).get("数値").getValue()); } @Test public void testGetRecordByBigBody() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i < 1000; i++) { fields.add("test"); } this.passwordAuthRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test public void testGetRecordByBigBodyToken() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i < 1000; i++) { fields.add("test"); } this.tokenRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test public void testGetRecordByBigBodyCert() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i < 1000; i++) { fields.add("test"); } this.certRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidFields() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i <= 1000; i++) { fields.add("test"); } this.passwordAuthRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidFieldsToken() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i <= 1000; i++) { fields.add("test"); } this.tokenRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test(expected = KintoneAPIException.class) public void testGetRecordShouldFailWhenGivenInvalidFieldsCert() throws KintoneAPIException { ArrayList<String> fields = new ArrayList<>(); for (int i = 0; i <= 1000; i++) { fields.add("test"); } this.certRecordManagerment.getRecords(APP_ID, null, fields, false); } @Test public void testGetRecordsWithoutTotal() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(null, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test public void testGetRecordsWithoutTotalToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(null, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test public void testGetRecordsWithoutTotalCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer lowerLimit = (Integer) testRecord1.get("数値").getValue(); Integer upperLimit = (Integer) testRecord3.get("数値").getValue(); String query = "数値 >=" + lowerLimit + "and 数値 <=" + upperLimit + "order by 数値 asc"; GetRecordsResponse response = this.certRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(null, response.getTotalCount()); assertEquals(3, resultRecords.size()); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(0).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(0).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(1).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(1).get(entry.getKey()).getValue()); } for (Entry<String, FieldValue> entry : testRecord3.entrySet()) { assertEquals(entry.getValue().getType(), resultRecords.get(2).get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecords.get(2).get(entry.getKey()).getValue()); } } @Test public void testGetRecordsWhenCountFalse() throws KintoneAPIException { GetRecordsResponse recordRep = this.passwordAuthRecordManagerment.getRecords(APP_ID, null, null, false); assertNotNull(recordRep); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertNotNull(records); assertNull(recordRep.getTotalCount()); } @Test public void testGetRecordsWhenCountFalseToken() throws KintoneAPIException { GetRecordsResponse recordRep = this.tokenRecordManagerment.getRecords(APP_ID, null, null, false); assertNotNull(recordRep); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertNotNull(records); assertNull(recordRep.getTotalCount()); } @Test public void testGetRecordsWhenCountFalseCert() throws KintoneAPIException { GetRecordsResponse recordRep = this.certRecordManagerment.getRecords(APP_ID, null, null, false); assertNotNull(recordRep); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertNotNull(records); assertNull(recordRep.getTotalCount()); } @Test public void testGetRecordsLimitZeroAndCountTrue() throws KintoneAPIException { GetRecordsResponse recordRep = this.passwordAuthRecordManagerment.getRecords(APP_ID, "limit 0", null, true); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertEquals(0, records.size()); assertNotNull(recordRep.getTotalCount()); } @Test public void testGetRecordsLimitZeroAndCountTrueToken() throws KintoneAPIException { GetRecordsResponse recordRep = this.tokenRecordManagerment.getRecords(APP_ID, "limit 0", null, true); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertEquals(0, records.size()); assertNotNull(recordRep.getTotalCount()); } @Test public void testGetRecordsLimitZeroAndCountTrueCert() throws KintoneAPIException { GetRecordsResponse recordRep = this.certRecordManagerment.getRecords(APP_ID, "limit 0", null, true); ArrayList<HashMap<String, FieldValue>> records = recordRep.getRecords(); assertEquals(0, records.size()); assertNotNull(recordRep.getTotalCount()); } @Test(expected = KintoneAPIException.class) public void testGetRecordsWhenDoNotHavePermissionOfApp() throws KintoneAPIException { Integer appId = 1632; this.passwordAuthRecordManagerment.getRecords(appId, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsWhenDoNotHavePermissionOfAppToken() throws KintoneAPIException { Integer appId = 1632; this.noViewPermissionTokenRecordManagerment.getRecords(appId, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsWhenDoNotHavePermissionOfAppCert() throws KintoneAPIException { Integer appId = 1632; this.certRecordManagerment.getRecords(appId, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailInGuestSpace() throws KintoneAPIException { this.guestAuthRecordManagerment.getRecords(APP_ID, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailInGuestSpaceToken() throws KintoneAPIException { this.tokenGuestRecordManagerment.getRecords(APP_ID, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailInGuestSpaceCert() throws KintoneAPIException { this.certGuestRecordManagerment.getRecords(APP_ID, null, null, null); } @Test public void testGetRecordsNoPermissionFieldDoNotDisplay() throws KintoneAPIException { Integer appid = 1635; GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(appid, null, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); for (HashMap<String, FieldValue> hashMap : resultRecords) { assertEquals(9, hashMap.size()); } } @Test public void testGetRecordsNoPermissionFieldDoNotDisplayCert() throws KintoneAPIException { Integer appid = 1635; GetRecordsResponse response = this.certRecordManagerment.getRecords(appid, null, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); for (HashMap<String, FieldValue> hashMap : resultRecords) { assertEquals(9, hashMap.size()); } } @Test public void testGetRecordsTheTotalCountShould500() throws KintoneAPIException { String query = "limit 500"; GetRecordsResponse response = this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(500, resultRecords.size()); } @Test public void testGetRecordsTheTotalCountShould500Token() throws KintoneAPIException { String query = "limit 500"; GetRecordsResponse response = this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(500, resultRecords.size()); } @Test public void testGetRecordsTheTotalCountShould500Cert() throws KintoneAPIException { String query = "limit 500"; GetRecordsResponse response = this.certRecordManagerment.getRecords(APP_ID, query, null, null); ArrayList<HashMap<String, FieldValue>> resultRecords = response.getRecords(); assertEquals(500, resultRecords.size()); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailThenLimitOver500() throws KintoneAPIException { String query = "limit 501"; this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailThenLimitOver500Token() throws KintoneAPIException { String query = "limit 501"; this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShouldFailThenLimitOver500Cert() throws KintoneAPIException { String query = "limit 501"; this.certRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidLimit() throws KintoneAPIException { String query = "limit -1"; this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidLimitToken() throws KintoneAPIException { String query = "limit -1"; this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidLimitCert() throws KintoneAPIException { String query = "limit -1"; this.certRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidOffset() throws KintoneAPIException { String query = "offset -1"; this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidOffsetToken() throws KintoneAPIException { String query = "offset -1"; this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInvalidOffsetCert() throws KintoneAPIException { String query = "offset -1"; this.certRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInactiveUser() throws KintoneAPIException { String query = "ユーザー選択 in (\" USER\", \"xxx xxx\")"; this.passwordAuthRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInactiveUserToken() throws KintoneAPIException { String query = "ユーザー選択 in (\" USER\", \"xxx xxx\")"; this.tokenRecordManagerment.getRecords(APP_ID, query, null, null); } @Test(expected = KintoneAPIException.class) public void testGetRecordsShowFailGivenInactiveUserCert() throws KintoneAPIException { String query = "ユーザー選択 in (\" USER\", \"xxx xxx\")"; this.certRecordManagerment.getRecords(APP_ID, query, null, null); } @Test public void testAddRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, testman1); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-01-01T09:00:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, testman2); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-01-02T18:00:00Z"); // Main Test processing AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse getResponse = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> resultRecord = getResponse.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testAddRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, testman1); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-01-01T09:00:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, testman2); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-01-02T18:00:00Z"); // Main Test processing AddRecordResponse response = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse getResponse = this.tokenRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> resultRecord = getResponse.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testAddRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, testman1); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-01-01T09:00:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, testman2); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-01-02T18:00:00Z"); // Main Test processing AddRecordResponse response = this.certRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse getResponse = this.certRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> resultRecord = getResponse.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), resultRecord.get(entry.getKey()).getType()); Object expectedValue; if (entry.getValue().getValue() instanceof ArrayList || entry.getValue().getValue() instanceof Member) { expectedValue = entry.getValue().getValue(); } else { expectedValue = String.valueOf(entry.getValue().getValue()); } assertEquals(expectedValue, resultRecord.get(entry.getKey()).getValue()); } } @Test public void testAddRecordWithoutRecord() throws KintoneAPIException { AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(APP_ID, null); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordWithoutRecordToken() throws KintoneAPIException { AddRecordResponse response = this.tokenRecordManagerment.addRecord(APP_ID, null); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordWithoutRecordCert() throws KintoneAPIException { AddRecordResponse response = this.certRecordManagerment.addRecord(APP_ID, null); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordWithAttachment() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachment = new File(connection); FileModel file = attachment.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordWithAttachmentToken() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); AddRecordResponse response = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordWithAttachmentCert() throws KintoneAPIException { // Preprocessing Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); AddRecordResponse response = this.certRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordDataWithTable() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordDataWithTableToken() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); AddRecordResponse response = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordDataWithTableCert() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); AddRecordResponse response = this.certRecordManagerment.addRecord(APP_ID, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordWithAttachmentInGuest() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "附件", FieldType.FILE, al); // Main Test processing AddRecordResponse response = guestRecord.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = guestRecord.getRecord(1631, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordWithAttachmentInGuestToken() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setApiToken(GUEST_SPACE_API_TOKEN); Connection connection = new Connection(TestConstants.DOMAIN, auth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "附件", FieldType.FILE, al); // Main Test processing AddRecordResponse response = guestRecord.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = guestRecord.getRecord(1631, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordWithAttachmentInGuestCert() throws KintoneAPIException { // Preprocessing Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "附件", FieldType.FILE, al); // Main Test processing AddRecordResponse response = guestRecord.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); GetRecordResponse rp = guestRecord.getRecord(1631, response.getID()); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordInGuest() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse response = this.guestAuthRecordManagerment.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordInGuestToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse response = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordInGuestCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse response = this.certGuestRecordManagerment.addRecord(1631, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testAddRecordWithoutApp() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(null, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordWithoutAppToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(null, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordWithoutAppCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(null, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecord(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecord(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.addRecord(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdNegative() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecord(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdNegativeToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecord(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdNegativeCert() throws KintoneAPIException { this.certRecordManagerment.addRecord(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecord(0, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecord(0, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordAppIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.addRecord(0, null); } @Test public void testAddRecordInvalidFieldShouldSkipped() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不存在的", FieldType.SINGLE_LINE_TEXT, 123); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test public void testAddRecordInvalidFieldShouldSkippedToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不存在的", FieldType.SINGLE_LINE_TEXT, 123); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test public void testAddRecordInvalidFieldShouldSkippedCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不存在的", FieldType.SINGLE_LINE_TEXT, 123); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInputStringToNumberFieldInvalidField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInputStringToNumberFieldInvalidFieldToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInputStringToNumberFieldInvalidFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailFieldProhibitDuplicate() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailFieldProhibitDuplicateToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.prohibitDuplicateTokenRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailFieldProhibitDuplicateCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidValueOverMaximum() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.passwordAuthRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidValueOverMaximumToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.prohibitDuplicateTokenRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidValueOverMaximumCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.certRecordManagerment.addRecord(1636, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidLookupValue() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "agdagsgasdg"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidLookupValueToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "agdagsgasdg"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailInvalidLookupValueCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ルックアップ", FieldType.SINGLE_LINE_TEXT, "agdagsgasdg"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetCategories() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, "テスト1"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetCategoriesToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, "テスト1"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetCategoriesCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "カテゴリー", FieldType.CATEGORY, "テスト1"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetStatus() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "処理中"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetStatusToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "処理中"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetStatusCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "ステータス", FieldType.STATUS, "処理中"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetAssignee() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, new Member("user1", "user1")); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetAssigneeToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, new Member("user1", "user1")); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetAssigneeCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作業者", FieldType.STATUS_ASSIGNEE, new Member("user1", "user1")); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCreator() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCreatorToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCreatorCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedModifier() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedModifierToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedModifierCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCeratedTime() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCeratedTimeToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedCeratedTimeCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedUpdatedTime() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedUpdatedTimeToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetNonexistedUpdatedTimeCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenDoNotSetRequiredField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(1640, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenDoNotSetRequiredFieldToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.requiredFieldTokenRecordManagerment.addRecord(1640, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenDoNotSetRequiredFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(1640, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetUnexistedFileKey() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetUnexistedFileKeyToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWhenSetUnexistedFileKeyCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); this.certRecordManagerment.addRecord(APP_ID, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWheDoNotHavepermissionOfApp() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.addRecord(1632, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWheDoNotHavepermissionOfAppToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.noAddPermissionTokenReocrdManagerment.addRecord(1632, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWheDoNotHavepermissionOfAppCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.addRecord(1632, testRecord); } @Test public void testAddRecordShouldSuccessWheDoNotHavepermissionOfRecord() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(1634, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordShouldSuccessWheDoNotHavepermissionOfRecordToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); AddRecordResponse response = this.addNoViewTokenRecordManagerment.addRecord(1634, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordShouldSuccessWheDoNotHavepermissionOfRecordCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); AddRecordResponse response = this.certRecordManagerment.addRecord(1634, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWheDoNotHavepermissionOfField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); this.passwordAuthRecordManagerment.addRecord(1635, testRecord); } @Test(expected = KintoneAPIException.class) public void testAddRecordShouldFailWheDoNotHavepermissionOfFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); this.certRecordManagerment.addRecord(1635, testRecord); } @Test public void testAddRecordShouldSuccessUseBlankApp() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); AddRecordResponse response = this.passwordAuthRecordManagerment.addRecord(1633, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordShouldSuccessUseBlankAppToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); AddRecordResponse response = this.blankAppApiTokenRecordManagerment.addRecord(1633, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecordShouldSuccessUseBlankAppCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); AddRecordResponse response = this.certRecordManagerment.addRecord(1633, testRecord); assertTrue(response.getID() instanceof Integer); assertEquals((Integer) 1, response.getRevision()); } @Test public void testAddRecords() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.tokenRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.certRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsWithAttachment() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsWithAttachmentToken() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.tokenRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.tokenRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.tokenRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsWithAttachmentCert() throws KintoneAPIException { // Preprocessing Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.certRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.certRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.certRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsDataWithTable() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.passwordAuthRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordsDataWithTableToken() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.tokenRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.tokenRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.tokenRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordsDataWithTableCert() throws KintoneAPIException { // Preprocessing ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.certRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = this.certRecordManagerment.getRecord(APP_ID, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.certRecordManagerment.getRecord(APP_ID, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testAddRecordsWithAttachmentInGuest() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "附件", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "附件", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = guestRecord.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = guestRecord.getRecord(1631, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = guestRecord.getRecord(1631, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsWithAttachmentInGuestToken() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setApiToken(GUEST_SPACE_API_TOKEN); Connection connection = new Connection(TestConstants.DOMAIN, auth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "附件", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "附件", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = guestRecord.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = guestRecord.getRecord(1631, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = guestRecord.getRecord(1631, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsWithAttachmentInGuestCert() throws KintoneAPIException { // Preprocessing Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); FileModel file2 = attachmet.upload("src/test/resources/app/InvalidAppID.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "附件", FieldType.FILE, al1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "附件", FieldType.FILE, al2); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = guestRecord.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); GetRecordResponse rp1 = guestRecord.getRecord(1631, response.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = guestRecord.getRecord(1631, response.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testAddRecordsInGuest() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.guestAuthRecordManagerment.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsInGuestToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.tokenGuestRecordManagerment.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsInGuestCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); // Main Test processing AddRecordsResponse response = this.certGuestRecordManagerment.addRecords(1631, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecords(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecords(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.addRecords(100000, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdNegative() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecords(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdNegativeToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecords(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdNegativeCert() throws KintoneAPIException { this.certRecordManagerment.addRecords(-1, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecords(0, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecords(0, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsAppIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.addRecords(0, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutApp() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecords(null, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutAppToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecords(null, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutAppCert() throws KintoneAPIException { this.certRecordManagerment.addRecords(null, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutRecords() throws KintoneAPIException { this.passwordAuthRecordManagerment.addRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutRecordsToken() throws KintoneAPIException { this.tokenRecordManagerment.addRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testAddRecordsWithoutRecordsCert() throws KintoneAPIException { this.certRecordManagerment.addRecords(APP_ID, null); } @Test public void testAddRecordsInvalidFieldShouldSkipped() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不存在的字符串", FieldType.SINGLE_LINE_TEXT, "123"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不存在的数值", FieldType.NUMBER, 123); records.add(testRecord2); AddRecordsResponse response = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsInvalidFieldShouldSkippedToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不存在的字符串", FieldType.SINGLE_LINE_TEXT, "123"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不存在的数值", FieldType.NUMBER, 123); records.add(testRecord2); AddRecordsResponse response = this.tokenRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test public void testAddRecordsInvalidFieldShouldSkippedCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不存在的字符串", FieldType.SINGLE_LINE_TEXT, "123"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不存在的数值", FieldType.NUMBER, 123); records.add(testRecord2); AddRecordsResponse response = this.certRecordManagerment.addRecords(APP_ID, records); assertEquals(2, response.getIDs().size()); assertTrue(response.getIDs().get(0) instanceof Integer); assertTrue(response.getIDs().get(1) instanceof Integer); assertEquals(2, response.getRevisions().size()); assertEquals((Integer) 1, response.getRevisions().get(0)); assertEquals((Integer) 1, response.getRevisions().get(1)); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInputStringToNumberField() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 123); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInputStringToNumberFieldToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 123); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInputStringToNumberFieldCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 123); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailFieldProhibitDuplicate() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "aaa"); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailFieldProhibitDuplicateToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "aaa"); records.add(testRecord2); this.prohibitDuplicateTokenRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailFieldProhibitDuplicateCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "aaa"); records.add(testRecord2); this.certRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInvalidValueOverMaximum() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 8); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInvalidValueOverMaximumToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 8); records.add(testRecord2); this.prohibitDuplicateTokenRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailInvalidValueOverMaximumCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 8); records.add(testRecord2); this.certRecordManagerment.addRecords(1636, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCreator() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCreatorToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCreatorCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成者", FieldType.CREATOR, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedModifier() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedModifierToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedModifierCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新者", FieldType.MODIFIER, new Member("xxx", "xxx xxx")); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCeretedTime() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCeretedTimeToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedCeretedTimeCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedUpdatedTime() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedUpdatedTimeToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetNonexistedUpdatedTimeCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "更新日時", FieldType.UPDATED_TIME, "2019-11-11T01:46:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 8); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenDoNotSetRequiredField() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(1640, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenDoNotSetRequiredFieldCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); records.add(testRecord2); this.certRecordManagerment.addRecords(1640, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetUnexistedFileKey() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetUnexistedFileKeyToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWhenSetUnexistedFileKeyCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, "xxxxxxxxxxxxxxxxxxx"); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWheDoNotHavepermissionOfApp() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(1632, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWheDoNotHavepermissionOfAppToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord2); this.noAddPermissionTokenReocrdManagerment.addRecords(1632, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailWheDoNotHavepermissionOfAppCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); records.add(testRecord2); this.certRecordManagerment.addRecords(1632, records); } @Test public void testAddRecordsShouldSuccessOfHundred() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addRecords = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(100, iDs.size()); } @Test public void testAddRecordsShouldSuccessOfHundredToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addRecords = this.tokenRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(100, iDs.size()); } @Test public void testAddRecordsShouldSuccessOfHundredCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addRecords = this.certRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(100, iDs.size()); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailThenOverHundred() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } this.passwordAuthRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailThenOverHundredToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } this.tokenRecordManagerment.addRecords(APP_ID, records); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailThenOverHundredCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } this.certRecordManagerment.addRecords(APP_ID, records); } @Test public void testAddRecordsShouldSuccessUesAdminToSetFields() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test public void testAddRecordsShouldSuccessUesAdminToSetFieldsToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.tokenRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test public void testAddRecordsShouldSuccessUesAdminToSetFieldsCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.certRecordManagerment.addRecords(APP_ID, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailDoNotAdminToSetFields() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.passwordAuthRecordManagerment.addRecords(1637, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailDoNotAdminToSetFieldsToken() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.noAdminPermissionRecordManagerment.addRecords(1637, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test(expected = KintoneAPIException.class) public void testAddRecordsShouldFailDoNotAdminToSetFieldsCert() throws KintoneAPIException { ArrayList<HashMap<String, FieldValue>> records = new ArrayList<>(); HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord1); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("yfang", "yfang")); records.add(testRecord2); HashMap<String, FieldValue> testRecord3 = createTestRecord(); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); records.add(testRecord3); HashMap<String, FieldValue> testRecord4 = createTestRecord(); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("yfang", "yfang")); records.add(testRecord4); AddRecordsResponse addRecords = this.certRecordManagerment.addRecords(1637, records); ArrayList<Integer> iDs = addRecords.getIDs(); assertEquals(4, iDs.size()); } @Test public void testUpdateRecordById() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIDWithAttachment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByIDWithAttachmentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByIDWithAttachmentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); testRecord = addField(testRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByIDDataWithTable() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testUpdateRecordByIDDataWithTableToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testUpdateRecordByIDDataWithTableCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing testRecord = addField(testRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void tesUpdateRecordByIDInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); // Main Test processing testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = this.guestAuthRecordManagerment.updateRecordByID(1631, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void tesUpdateRecordByIDInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); // Main Test processing testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = this.tokenGuestRecordManagerment.updateRecordByID(1631, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void tesUpdateRecordByIDInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); // Main Test processing testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = this.certGuestRecordManagerment.updateRecordByID(1631, id, testRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdRevisionShouldFailLessThanNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdRevisionShouldFailLessThanNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdRevisionShouldFailLessThanNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailRevisionZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDUnexisted() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(10000, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDUnexistedToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(10000, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDUnexistedCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(10000, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDNegativeNumber() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(-1, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDNegativeNumberToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(-1, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIDNegativeNumberCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(-1, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIdZero() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(0, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIdZeroToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(0, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailAppIdZeroCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(0, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdUnexisted() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, 100000, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdUnexistedToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, 100000, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdUnexistedCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, 100000, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdNegativeNumber() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, -1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdNegativeNumberToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, -1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdNegativeNumberCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, -1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdZero() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, 0, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdZeroToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, 0, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailIdZeroCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, 0, testRecord, null); } @Test public void testUpdateRecordByIdInvalidFieldWillSkip() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdInvalidFieldWillSkipToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdInvalidFieldWillSkipCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByID(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByIdWithoutRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByID(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInputStringToNumberField() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInputStringToNumberFieldToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInputStringToNumberFieldCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailFieldProhibitDuplicate() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailFieldProhibitDuplicateToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.prohibitDuplicateTokenRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailFieldProhibitDuplicateCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInvalidValueOverMaximum() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.passwordAuthRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInvalidValueOverMaximumToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.prohibitDuplicateTokenRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailInvalidValueOverMaximumCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 11); this.certRecordManagerment.updateRecordByID(1636, 2, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWhenDoNotSetRequiredField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 111); this.passwordAuthRecordManagerment.updateRecordByID(1640, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWhenDoNotSetRequiredFieldToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 111); this.requiredFieldTokenRecordManagerment.updateRecordByID(1640, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWhenDoNotSetRequiredFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数値", FieldType.NUMBER, 111); this.certRecordManagerment.updateRecordByID(1640, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdChangeCreatorEtc() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdChangeCreatorEtcToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.tokenRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdChangeCreatorEtcCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord = addField(testRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord = addField(testRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.certRecordManagerment.updateRecordByID(APP_ID, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWheDoNotHavepermissionOfApp() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.updateRecordByID(1632, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWheDoNotHavepermissionOfAppToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.noAddPermissionTokenReocrdManagerment.updateRecordByID(1632, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldFailWheDoNotHavepermissionOfAppCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.updateRecordByID(1632, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldSuccessWheDoNotHavepermissionOfRecord() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.updateRecordByID(1634, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldSuccessWheDoNotHavepermissionOfRecordToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.addNoViewTokenRecordManagerment.updateRecordByID(1634, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldSuccessWheDoNotHavepermissionOfRecordCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.updateRecordByID(1634, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldSuccessWheDoNotHavepermissionOfField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); this.passwordAuthRecordManagerment.updateRecordByID(1635, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdShouldSuccessWheDoNotHavepermissionOfFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "数值", FieldType.NUMBER, 123); this.certRecordManagerment.updateRecordByID(1635, 1, testRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByID(null, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByID(null, id, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByIdWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByID(null, id, testRecord, revision); } @Test public void testUpdateRecordByUpdateKey() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyMultiUpdateKeys() throws KintoneAPIException { // 1622のアプリの二つの重複禁止のフィールドを設定している // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyMultiUpdateKeysToken() throws KintoneAPIException { // 1622のアプリの二つの重複禁止のフィールドを設定している // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyMultiUpdateKeysCert() throws KintoneAPIException { // 1622のアプリの二つの重複禁止のフィールドを設定している // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); Integer revision = addResponse.getRevision(); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyWithAttachment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyWithAttachmentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyWithAttachmentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); File attachmet = new File(connection); FileModel file = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al = new ArrayList<>(); al.add(file); RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "添付ファイル", FieldType.FILE, al); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyDataWithTable() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.passwordAuthRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyDataWithTableToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.tokenRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyDataWithTableCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<SubTableValueItem> subTable = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue = new HashMap<>(); tableitemvalue = addField(tableitemvalue, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList = new ArrayList<Member>(); userList.add(new Member("cyuan", "cyuan")); tableitemvalue = addField(tableitemvalue, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList); tableitemvalue = addField(tableitemvalue, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue); subTable.add(tablelist1); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "サブテーブル", FieldType.SUBTABLE, subTable); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); GetRecordResponse rp = this.certRecordManagerment.getRecord(APP_ID, id); HashMap<String, FieldValue> record = rp.getRecord(); for (Entry<String, FieldValue> entry : testRecord.entrySet()) { assertEquals(entry.getValue().getType(), record.get(entry.getKey()).getType()); if (FieldType.FILE == record.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordByUpdateKeyInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); testRecord = addField(testRecord, "数値", FieldType.NUMBER, new Random().nextInt()); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1656, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = this.guestAuthRecordManagerment.updateRecordByUpdateKey(1656, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyInGuestToken() throws KintoneAPIException { // Preprocessing Auth auth = new Auth(); auth.setApiToken(ANOTHER_GUEST_SPACE_API_TOKEN); Connection connection = new Connection(TestConstants.DOMAIN, auth, TestConstants.GUEST_SPACE_ID); Record guestRecord = new Record(connection); HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); testRecord = addField(testRecord, "数値", FieldType.NUMBER, new Random().nextInt()); AddRecordResponse addResponse = guestRecord.addRecord(1656, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = guestRecord.updateRecordByUpdateKey(1656, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); testRecord = addField(testRecord, "数値", FieldType.NUMBER, new Random().nextInt()); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1656, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); UpdateRecordResponse response = this.certGuestRecordManagerment.updateRecordByUpdateKey(1656, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyInvalidFildWillSkip() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyInvalidFildWillSkipToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyInvalidFildWillSkipCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailLessThanNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailLessThanNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailLessThanNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 100000); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyRevisionShouldFailRevisionZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWrongUpdatekey() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("リンク", String.valueOf(testRecord.get("リンク").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWrongUpdatekeyToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("リンク", String.valueOf(testRecord.get("リンク").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWrongUpdatekeyCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("リンク", String.valueOf(testRecord.get("リンク").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(10000, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(10000, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(10000, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDNegativeNumber() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(-1, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDNegativeNumberToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(-1, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDNegativeNumberCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(-1, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(0, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(0, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailAppIDZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(0, updateKey, updateRecord, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutKey() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutKeyToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutKeyCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, null, testRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInputStringToNumberField() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数値", FieldType.NUMBER, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInputStringToNumberFieldToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数値", FieldType.NUMBER, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInputStringToNumberFieldCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer revision = addResponse.getRevision(); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数値", FieldType.NUMBER, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailFieldProhibitDuplicate() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailFieldProhibitDuplicateToken() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.prohibitDuplicateTokenRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailFieldProhibitDuplicateCert() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); this.certRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInvalidValueOverMaximum() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值", FieldType.NUMBER, 11); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInvalidValueOverMaximumToken() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值", FieldType.NUMBER, 11); this.prohibitDuplicateTokenRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailInvalidValueOverMaximumCert() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值_0", "11"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值", FieldType.NUMBER, 11); this.certRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailUpdatekeyNotUnique() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值", "9"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值_0", FieldType.NUMBER, 12); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailUpdatekeyNotUniqueToken() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值", "9"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值_0", FieldType.NUMBER, 12); this.prohibitDuplicateTokenRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailUpdatekeyNotUniqueCert() throws KintoneAPIException { RecordUpdateKey updateKey = new RecordUpdateKey("数值", "9"); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "数值_0", FieldType.NUMBER, 12); this.certRecordManagerment.updateRecordByUpdateKey(1636, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyChangeCreatorEtc() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); updateRecord = addField(updateRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyChangeCreatorEtcToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); updateRecord = addField(updateRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyChangeCreatorEtCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); updateRecord = addField(updateRecord, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); updateRecord = addField(updateRecord, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWheDoNotHavepermissionOfApp() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1632, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWheDoNotHavepermissionOfAppToken() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.noAddPermissionTokenReocrdManagerment.updateRecordByUpdateKey(1632, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldFailWheDoNotHavepermissionOfAppCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.certRecordManagerment.updateRecordByUpdateKey(1632, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldSuccessWheDoNotHavepermissionOfRecord() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1634, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldSuccessWheDoNotHavepermissionOfRecordToken() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.addNoViewTokenRecordManagerment.updateRecordByUpdateKey(1634, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldSuccessWheDoNotHavepermissionOfRecordCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.certRecordManagerment.updateRecordByUpdateKey(1634, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldSuccessWheDoNotHavepermissionOfField() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(1635, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyShouldSuccessWheDoNotHavepermissionOfFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord = new HashMap<>(); updateRecord = addField(updateRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); RecordUpdateKey updateKey = new RecordUpdateKey("数值", "1"); this.certRecordManagerment.updateRecordByUpdateKey(1635, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.passwordAuthRecordManagerment.updateRecordByUpdateKey(null, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.tokenRecordManagerment.updateRecordByUpdateKey(null, updateKey, updateRecord, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordByUpdateKeyWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); HashMap<String, FieldValue> updateRecord = new HashMap<String, FieldValue>(); updateRecord = addField(updateRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text after"); this.certRecordManagerment.updateRecordByUpdateKey(null, updateKey, updateRecord, null); } @Test public void testUpdateRecordByUpdateKeyWithoutRecordData() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, null, null); assertEquals((Integer) (addResponse.getRevision() + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyWithoutRecordDataToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, null, null); assertEquals((Integer) (addResponse.getRevision() + 1), response.getRevision()); } @Test public void testUpdateRecordByUpdateKeyWithoutRecordDataCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing RecordUpdateKey updateKey = new RecordUpdateKey("数値", String.valueOf(testRecord.get("数値").getValue())); UpdateRecordResponse response = this.certRecordManagerment.updateRecordByUpdateKey(APP_ID, updateKey, null, null); assertEquals((Integer) (addResponse.getRevision() + 1), response.getRevision()); } @Test public void testUpdateRecords() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsByKey() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing RecordUpdateKey updateKey1 = new RecordUpdateKey("数値", String.valueOf(testRecord1.get("数値").getValue())); RecordUpdateKey updateKey2 = new RecordUpdateKey("数値", String.valueOf(testRecord2.get("数値").getValue())); HashMap<String, FieldValue> updateRecord1 = new HashMap<String, FieldValue>(); updateRecord1 = addField(updateRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<String, FieldValue>(); updateRecord2 = addField(updateRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after2"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(null, null, updateKey1, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(null, null, updateKey2, updateRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsByKeyToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing RecordUpdateKey updateKey1 = new RecordUpdateKey("数値", String.valueOf(testRecord1.get("数値").getValue())); RecordUpdateKey updateKey2 = new RecordUpdateKey("数値", String.valueOf(testRecord2.get("数値").getValue())); HashMap<String, FieldValue> updateRecord1 = new HashMap<String, FieldValue>(); updateRecord1 = addField(updateRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<String, FieldValue>(); updateRecord2 = addField(updateRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after2"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(null, null, updateKey1, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(null, null, updateKey2, updateRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsByKeyCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing RecordUpdateKey updateKey1 = new RecordUpdateKey("数値", String.valueOf(testRecord1.get("数値").getValue())); RecordUpdateKey updateKey2 = new RecordUpdateKey("数値", String.valueOf(testRecord2.get("数値").getValue())); HashMap<String, FieldValue> updateRecord1 = new HashMap<String, FieldValue>(); updateRecord1 = addField(updateRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<String, FieldValue>(); updateRecord2 = addField(updateRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after2"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(null, null, updateKey1, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(null, null, updateKey2, updateRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWrongRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -2, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -2, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWrongRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -2, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -2, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWrongRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -2, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -2, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsChangeCreatorEtc() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); HashMap<String, FieldValue> testRecord4 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); records.add(testRecord4); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); RecordUpdateItem item3 = new RecordUpdateItem(addResponse.getIDs().get(2), null, null, testRecord3); RecordUpdateItem item4 = new RecordUpdateItem(addResponse.getIDs().get(3), null, null, testRecord4); updateItems.add(item1); updateItems.add(item2); updateItems.add(item3); updateItems.add(item4); this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsChangeCreatorEtcToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); HashMap<String, FieldValue> testRecord4 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); records.add(testRecord4); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); RecordUpdateItem item3 = new RecordUpdateItem(addResponse.getIDs().get(2), null, null, testRecord3); RecordUpdateItem item4 = new RecordUpdateItem(addResponse.getIDs().get(3), null, null, testRecord4); updateItems.add(item1); updateItems.add(item2); updateItems.add(item3); updateItems.add(item4); this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsChangeCreatorEtcCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); HashMap<String, FieldValue> testRecord3 = createTestRecord(); HashMap<String, FieldValue> testRecord4 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); records.add(testRecord3); records.add(testRecord4); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "作成日時", FieldType.CREATED_TIME, "2018-08-28T08:07:00Z"); testRecord2 = addField(testRecord2, "作成者", FieldType.CREATOR, new Member("cyuan", "cyuan")); testRecord3 = addField(testRecord3, "更新日時", FieldType.UPDATED_TIME, "2018-08-28T08:07:00Z"); testRecord4 = addField(testRecord4, "更新者", FieldType.MODIFIER, new Member("cyuan", "cyuan")); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); RecordUpdateItem item3 = new RecordUpdateItem(addResponse.getIDs().get(2), null, null, testRecord3); RecordUpdateItem item4 = new RecordUpdateItem(addResponse.getIDs().get(3), null, null, testRecord4); updateItems.add(item1); updateItems.add(item2); updateItems.add(item3); updateItems.add(item4); this.certRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWheDoNotHavepermissionOfApp() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWheDoNotHavepermissionOfAppToken() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.noAddPermissionTokenReocrdManagerment.updateRecords(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWheDoNotHavepermissionOfAppCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldSuccessWheDoNotHavepermissionOfRecord() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldSuccessWheDoNotHavepermissionOfRecordToken() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.addNoViewTokenRecordManagerment.updateRecords(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldSuccessWheDoNotHavepermissionOfRecordCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test1"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldSuccessWheDoNotHavepermissionOfField() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "数值", FieldType.NUMBER, 123); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "数值", FieldType.NUMBER, 123); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1635, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldSuccessWheDoNotHavepermissionOfFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> updateRecord1 = new HashMap<>(); updateRecord1 = addField(updateRecord1, "数值", FieldType.NUMBER, 123); HashMap<String, FieldValue> updateRecord2 = new HashMap<>(); updateRecord2 = addField(updateRecord2, "数值", FieldType.NUMBER, 123); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, updateRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, updateRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1635, updateItems); } @Test public void testUpdateRecordsInvalidFieldWillSkip() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsInvalidFieldWillSkipToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsInvalidFieldWillSkipCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certRecordManagerment.updateRecords(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void testUpdateRecordsWithAttachment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); FileModel file2 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.passwordAuthRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.passwordAuthRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordsWithAttachmentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); Auth auth = new Auth(); auth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection connection = new Connection(TestConstants.DOMAIN, auth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); FileModel file2 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.tokenRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.tokenRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordsWithAttachmentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); File attachmet = new File(connection); FileModel file1 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al1 = new ArrayList<>(); al1.add(file1); testRecord1 = addField(testRecord1, "添付ファイル", FieldType.FILE, al1); FileModel file2 = attachmet.upload("src/test/resources/record/ValidRecordValue.txt"); ArrayList<FileModel> al2 = new ArrayList<>(); al2.add(file2); testRecord2 = addField(testRecord2, "添付ファイル", FieldType.FILE, al2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.certRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.FILE == record1.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record1.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } GetRecordResponse rp2 = this.certRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(1)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.FILE == record2.get(entry.getKey()).getType()) { ArrayList<FileModel> alf = (ArrayList<FileModel>) record2.get(entry.getKey()).getValue(); assertEquals(1, alf.size()); } } } @Test public void testUpdateRecordsDataWithTable() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList1 = new ArrayList<Member>(); userList1.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList1); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); // Main Test processing testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.passwordAuthRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.passwordAuthRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testUpdateRecordsDataWithTableToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList1 = new ArrayList<Member>(); userList1.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList1); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); // Main Test processing testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.tokenRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.tokenRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void testUpdateRecordsDataWithTableCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); HashMap<String, FieldValue> testRecord2 = createTestRecord(); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); ArrayList<SubTableValueItem> subTable1 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist1 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue1 = new HashMap<>(); tableitemvalue1 = addField(tableitemvalue1, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList1 = new ArrayList<Member>(); userList1.add(new Member("cyuan", "cyuan")); tableitemvalue1 = addField(tableitemvalue1, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList1); tableitemvalue1 = addField(tableitemvalue1, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist1.setID(1); tablelist1.setValue(tableitemvalue1); subTable1.add(tablelist1); ArrayList<SubTableValueItem> subTable2 = new ArrayList<SubTableValueItem>(); SubTableValueItem tablelist2 = new SubTableValueItem(); HashMap<String, FieldValue> tableitemvalue2 = new HashMap<>(); tableitemvalue2 = addField(tableitemvalue2, "文字列__1行_テーブル", FieldType.SINGLE_LINE_TEXT, "文字列__1行inテーブル"); ArrayList<Member> userList2 = new ArrayList<Member>(); userList2.add(new Member("cyuan", "cyuan")); tableitemvalue2 = addField(tableitemvalue2, "ユーザー選択_テーブル", FieldType.USER_SELECT, userList2); tableitemvalue2 = addField(tableitemvalue2, "ドロップダウン_テーブル", FieldType.DROP_DOWN, "sample1"); tablelist2.setID(1); tablelist2.setValue(tableitemvalue2); subTable2.add(tablelist2); // Main Test processing testRecord1 = addField(testRecord1, "サブテーブル", FieldType.SUBTABLE, subTable1); testRecord2 = addField(testRecord2, "サブテーブル", FieldType.SUBTABLE, subTable2); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(APP_ID, updateItems); GetRecordResponse rp1 = this.certRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record1 = rp1.getRecord(); for (Entry<String, FieldValue> entry : testRecord1.entrySet()) { assertEquals(entry.getValue().getType(), record1.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record1.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record1.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } GetRecordResponse rp2 = this.certRecordManagerment.getRecord(APP_ID, addResponse.getIDs().get(0)); HashMap<String, FieldValue> record2 = rp2.getRecord(); for (Entry<String, FieldValue> entry : testRecord2.entrySet()) { assertEquals(entry.getValue().getType(), record2.get(entry.getKey()).getType()); if (FieldType.SUBTABLE == record2.get(entry.getKey()).getType()) { ArrayList<SubTableValueItem> al = (ArrayList<SubTableValueItem>) record2.get(entry.getKey()).getValue(); assertEquals(1, al.size()); } } } @Test public void tesUpdateRecordsInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certGuestRecordManagerment.addRecords(1631, records); // Main Test processing testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certGuestRecordManagerment.updateRecords(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void tesUpdateRecordsInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenGuestRecordManagerment.addRecords(1631, records); // Main Test processing testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenGuestRecordManagerment.updateRecords(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test public void tesUpdateRecordsInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certGuestRecordManagerment.addRecords(1631, records); // Main Test processing testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest_文字列__1行__更新"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certGuestRecordManagerment.updateRecords(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 1), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 1), results.get(1).getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailInputStringToNumberField() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test single text after"); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, "test single text after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailInputStringToNumberFieldToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test single text after"); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, "test single text after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailInputStringToNumberFieldCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "不在在的字段", FieldType.SINGLE_LINE_TEXT, "test single text after"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, "test single text after"); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, "test single text after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailFieldProhibitDuplicate() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailFieldProhibitDuplicateToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.prohibitDuplicateTokenRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailFieldProhibitDuplicateCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsdShouldFailInvalidValueOverMaximum() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 11); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsdShouldFailInvalidValueOverMaximumToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 11); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.prohibitDuplicateTokenRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsdShouldFailInvalidValueOverMaximumcert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "数值", FieldType.NUMBER, 11); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "数值", FieldType.NUMBER, 11); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1636, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWhenDoNotSetRequiredField() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, 111); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 111); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(1640, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWhenDoNotSetRequiredFieldToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, 111); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 111); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.requiredFieldTokenRecordManagerment.updateRecords(1640, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailWhenDoNotSetRequiredFieldCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); // Main Test processing testRecord1 = addField(testRecord1, "数値", FieldType.NUMBER, 111); testRecord2 = addField(testRecord2, "数値", FieldType.NUMBER, 111); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(1, null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(2, null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(1640, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(100000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(100000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(100000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDNegativeNumber() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDNegativeNumberToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDNegativeNumberCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), -1, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), -1, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), 0, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), 0, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), 0, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), 0, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsShouldFailAppIDZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), 0, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), 0, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutItems() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.passwordAuthRecordManagerment.updateRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutItemsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.tokenRecordManagerment.updateRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutItemsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.certRecordManagerment.updateRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecords(null, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecords(null, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1 after"); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2 after"); ArrayList<RecordUpdateItem> updateItems = new ArrayList<RecordUpdateItem>(); RecordUpdateItem item1 = new RecordUpdateItem(addResponse.getIDs().get(0), null, null, testRecord1); RecordUpdateItem item2 = new RecordUpdateItem(addResponse.getIDs().get(1), null, null, testRecord2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecords(null, updateItems); } @Test public void testDeleteRecords() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsOnlyOneId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsOnlyOneIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsOnlyOneIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutIds() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.passwordAuthRecordManagerment.deleteRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutIdsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.tokenRecordManagerment.deleteRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutIdsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.certRecordManagerment.deleteRecords(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsShouldFailNotHaveDeletePermission() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1658, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.passwordAuthRecordManagerment.deleteRecords(1658, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsShouldFailNotHaveDeletePermissionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.noDeletePermissionRecordManagerment.addRecords(1658, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.noDeletePermissionRecordManagerment.deleteRecords(1658, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsShouldFailNotHaveDeletePermissionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1658, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.certRecordManagerment.deleteRecords(1658, ids); } @Test public void testDeleteRecordsSuccessNotHaveEditPermission() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1659, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.passwordAuthRecordManagerment.deleteRecords(1659, ids); } @Test public void testDeleteRecordsSuccessNotHaveEditPermissionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.noEditPermissionRecordManagerment.addRecords(1659, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.noEditPermissionRecordManagerment.deleteRecords(1659, ids); } @Test public void testDeleteRecordsSuccessNotHaveEditPermissionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1659, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.certRecordManagerment.deleteRecords(1659, ids); } @Test public void testDeleteRecordsSuccessNotHaveViewEditPermissionOfField() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1635, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.passwordAuthRecordManagerment.deleteRecords(1635, ids); } @Test public void testDeleteRecordsSuccessNotHaveViewEditPermissionOfFieldCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1635, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getIDs().get(0)); ids.add(addResponse.getIDs().get(1)); this.certRecordManagerment.deleteRecords(1635, ids); } @Test public void tesDeleteRecordByIDInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getID()); this.guestAuthRecordManagerment.deleteRecords(1631, ids); } @Test public void tesDeleteRecordByIDInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getID()); this.tokenGuestRecordManagerment.deleteRecords(1631, ids); } @Test public void tesDeleteRecordByIDInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(addResponse.getID()); this.certGuestRecordManagerment.deleteRecords(1631, ids); } @Test public void testDeleteRecordsSuccessIDsIsHundred() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { ids.add(addResponse.getIDs().get(i)); } this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsSuccessIDsIsHundredToken() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { ids.add(addResponse.getIDs().get(i)); } this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsSuccessIDsIsHundredCert() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { ids.add(addResponse.getIDs().get(i)); } this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessIDsOverHundred() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i <= 100; i++) { ids.add(i); } this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessIDsOverHundredToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i <= 100; i++) { ids.add(i); } this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessIDsOverHundredCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); for (int i = 0; i <= 100; i++) { ids.add(i); } this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdUnexisted() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.passwordAuthRecordManagerment.deleteRecords(10000, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdUnexistedToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.tokenRecordManagerment.deleteRecords(10000, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdUnexistedCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.certRecordManagerment.deleteRecords(10000, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdNegativeNumber() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.passwordAuthRecordManagerment.deleteRecords(-1, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdNegativeNumberToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.tokenRecordManagerment.deleteRecords(-1, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdNegativeNumberCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.certRecordManagerment.deleteRecords(-1, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdZero() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.passwordAuthRecordManagerment.deleteRecords(0, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdZeroToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.tokenRecordManagerment.deleteRecords(0, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsAppIdZeroCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); this.certRecordManagerment.deleteRecords(0, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutApp() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); ids.add(2); this.passwordAuthRecordManagerment.deleteRecords(null, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutAppToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); ids.add(2); this.tokenRecordManagerment.deleteRecords(null, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutAppCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(1); ids.add(2); this.certRecordManagerment.deleteRecords(null, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsUnexistedIds() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(100000); ids.add(200000); this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsUnexistedIdsToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(100000); ids.add(200000); this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsUnexistedIdsCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(100000); ids.add(200000); this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsNegativeNumbertIds() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(-1); ids.add(-2); this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsNegativeNumbertIdsToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(-1); ids.add(-2); this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsNegativeNumbertIdsCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(-1); ids.add(-2); this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsZeroIds() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(0); ids.add(0); this.passwordAuthRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsZeroIdsToken() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(0); ids.add(0); this.tokenRecordManagerment.deleteRecords(APP_ID, ids); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsZeroIdsCert() throws KintoneAPIException { ArrayList<Integer> ids = new ArrayList<Integer>(); ids.add(0); ids.add(0); this.certRecordManagerment.deleteRecords(APP_ID, ids); } @Test public void testDeleteRecordsWithRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void testDeleteRecordsWithRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void testDeleteRecordsWithRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdNotExisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(111111111, addResponse.getRevisions().get(1)); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdNotExistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(111111111, addResponse.getRevisions().get(1)); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdNotExistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(111111111, addResponse.getRevisions().get(1)); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void testDeleteRecordsWithRevisionWhenRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void testDeleteRecordsWithRevisionWhenRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void testDeleteRecordsWithRevisionWhenRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.guestAuthRecordManagerment.addRecords(1631, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.guestAuthRecordManagerment.deleteRecordsWithRevision(1631, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenGuestRecordManagerment.addRecords(1631, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.tokenGuestRecordManagerment.deleteRecordsWithRevision(1631, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certGuestRecordManagerment.addRecords(1631, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), -1); idsWithRevision.put(addResponse.getIDs().get(1), -1); this.certGuestRecordManagerment.deleteRecordsWithRevision(1631, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionSuccessIDsIsHundred() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { idsWithRevision.put(addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); } this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionSuccessIDsIsHundredToken() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { idsWithRevision.put(addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); } this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test public void tesDeleteRecordWithRevisionSuccessIDsIsHundredCert() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); records.add(testRecord); } AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i < addResponse.getIDs().size(); i++) { idsWithRevision.put(addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); } this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordWithRevisionSuccessIDsOverHundred() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i <= 100; i++) { idsWithRevision.put(i, i); } this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordWithRevisionSuccessIDsOverHundredToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i <= 100; i++) { idsWithRevision.put(i, i); } this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordWithRevisionSuccessIDsOverHundredCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); for (int i = 0; i <= 100; i++) { idsWithRevision.put(i, i); } this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionShouldFailNotHaveDeletePermission() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1658, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(1658, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionShouldFailNotHaveDeletePermissionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.noDeletePermissionRecordManagerment.addRecords(1658, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.noDeletePermissionRecordManagerment.deleteRecordsWithRevision(1658, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionShouldFailNotHaveDeletePermissionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1658, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.certRecordManagerment.deleteRecordsWithRevision(1658, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessNotHaveDeletePermissionOfRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1634, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(1634, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessNotHaveDeletePermissionOfRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.addNoViewTokenRecordManagerment.addRecords(1634, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.addNoViewTokenRecordManagerment.deleteRecordsWithRevision(1634, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsSuccessNotHaveDeletePermissionOfRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1634, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(0)); this.certRecordManagerment.deleteRecordsWithRevision(1634, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdUnexisted() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(10000, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdUnexistedToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.tokenRecordManagerment.deleteRecordsWithRevision(10000, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdUnexistedCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.certRecordManagerment.deleteRecordsWithRevision(10000, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdNegativeNumber() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(-1, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdNegativeNumberToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.tokenRecordManagerment.deleteRecordsWithRevision(-1, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdNegativeNumberCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.certRecordManagerment.deleteRecordsWithRevision(-1, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdZero() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(0, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdZeroToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.tokenRecordManagerment.deleteRecordsWithRevision(0, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionAppIdZeroCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1); idsWithRevision.put(2, 1); this.certRecordManagerment.deleteRecordsWithRevision(0, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionUnexistedRevision() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1000); idsWithRevision.put(2, 1000); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionUnexistedRevisionToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1000); idsWithRevision.put(2, 1000); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionUnexistedRevisionCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 1000); idsWithRevision.put(2, 1000); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionNegativeNumberRevision() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, -2); idsWithRevision.put(2, -3); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionNegativeNumberRevisionToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, -2); idsWithRevision.put(2, -3); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionNegativeNumberRevisionCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, -2); idsWithRevision.put(2, -3); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionZeroRevision() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 0); idsWithRevision.put(2, 0); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionZeroRevisionToken() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 0); idsWithRevision.put(2, 0); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionZeroRevisionCert() throws KintoneAPIException { HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(1, 0); idsWithRevision.put(2, 0); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdDuplicate() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addresponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord1); HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addresponse.getID(), addresponse.getRevision()); idsWithRevision.put(addresponse.getID(), addresponse.getRevision() + 1); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdDuplicateToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addresponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord1); HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addresponse.getID(), addresponse.getRevision()); idsWithRevision.put(addresponse.getID(), addresponse.getRevision() + 1); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionRecordIdDuplicateCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addresponse = this.certRecordManagerment.addRecord(APP_ID, testRecord1); HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addresponse.getID(), addresponse.getRevision()); idsWithRevision.put(addresponse.getID(), addresponse.getRevision() + 1); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> hm = new HashMap<>(); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, hm); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> hm = new HashMap<>(); this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, hm); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithoutRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> hm = new HashMap<>(); this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, hm); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithNullRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.passwordAuthRecordManagerment.deleteRecordsWithRevision(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithNullRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.tokenRecordManagerment.deleteRecordsWithRevision(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithNullRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.certRecordManagerment.deleteRecordsWithRevision(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(1)); this.passwordAuthRecordManagerment.deleteRecordsWithRevision(null, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(1)); this.tokenRecordManagerment.deleteRecordsWithRevision(null, idsWithRevision); } @Test(expected = KintoneAPIException.class) public void testDeleteRecordsWithRevisionWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing HashMap<Integer, Integer> idsWithRevision = new HashMap<Integer, Integer>(); idsWithRevision.put(addResponse.getIDs().get(0), addResponse.getRevisions().get(0)); idsWithRevision.put(addResponse.getIDs().get(1), addResponse.getRevisions().get(1)); this.certRecordManagerment.deleteRecordsWithRevision(null, idsWithRevision); } @Test public void testUpdateRecordAssignees() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } // users "user1 - user100" need to be added to domain @Ignore @Test public void testUpdateRecordAssigneesShouldSuccessAddHundredAssignees() throws KintoneAPIException { Auth passwordAuth = new Auth(); passwordAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection passwordAuthConnection = new Connection(TestConstants.HADOMAIN, passwordAuth); passwordAuthRecordManagerment = new Record(passwordAuthConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i < 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } // users "user1 - user100" need to be added to domain @Ignore @Test public void testUpdateRecordAssigneesShouldSuccessAddHundredAssigneesToken() throws KintoneAPIException { Auth tokenAuth = new Auth(); tokenAuth.setApiToken(HA_API_TOKEN); Connection tokenConnection = new Connection(TestConstants.HADOMAIN, tokenAuth); tokenRecordManagerment = new Record(tokenConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i < 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } // users "user1 - user100" need to be added to domain @Ignore @Test public void testUpdateRecordAssigneesShouldSuccessAddHundredAssigneesCert() throws KintoneAPIException { Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.HACLIENT_CERT_PATH, TestConstants.HACLIENT_CERT_PASSWORD); Connection CertConnection = new Connection(TestConstants.HASECURE_DOMAIN, certauth); certRecordManagerment = new Record(CertConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i < 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailAddOverHundredAssignees() throws KintoneAPIException { Auth passwordAuth = new Auth(); passwordAuth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); Connection passwordAuthConnection = new Connection(TestConstants.HADOMAIN, passwordAuth); passwordAuthRecordManagerment = new Record(passwordAuthConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i <= 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailAddOverHundredAssigneesToken() throws KintoneAPIException { Auth tokenAuth = new Auth(); tokenAuth.setApiToken(HA_API_TOKEN); Connection tokenConnection = new Connection(TestConstants.HADOMAIN, tokenAuth); tokenRecordManagerment = new Record(tokenConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i <= 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailAddOverHundredAssigneesCert() throws KintoneAPIException { Auth certauth = new Auth(); certauth.setPasswordAuth(TestConstants.USERNAME, TestConstants.PASSWORD); certauth.setClientCertByPath(TestConstants.HACLIENT_CERT_PATH, TestConstants.HACLIENT_CERT_PASSWORD); Connection CertConnection = new Connection(TestConstants.HASECURE_DOMAIN, certauth); certRecordManagerment = new Record(CertConnection); // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(1, id, action, null, revision); ArrayList<String> assignees = new ArrayList<String>(); for (int i = 1; i <= 101; i++) { assignees.add("user" + i); } UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(1, id, assignees, null); assertEquals((Integer) (revision + 3), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailThanMultiAssignees() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman2.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailThanMultiAssigneesToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman2.getCode()); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailThanMultiAssigneesCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman2.getCode()); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, revision); } @Test public void testUpdateRecordAssigneesSuccessRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesSuccessRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesSuccessRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -1); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesWithoutRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesWithoutRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesWithoutRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailWhenNotHasManageAppPermissionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.noManagePermissionRecordManagerment.addRecord(1667, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.noManagePermissionRecordManagerment.updateRecordAssignees(1667, id, assignees, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 111111); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 111111); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 111111); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionNegativeTwo() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionNegativeTwoToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionNegativeTwoCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesRevisionZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, 0); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWrongUserCode() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("aaaaaaaaaaaaaaaaaaa"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWrongUserCodeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("aaaaaaaaaaaaaaaaaaa"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWrongUserCodeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("aaaaaaaaaaaaaaaaaaa"); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserInactive() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Brian"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserInactiveToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Brian"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserInactiveCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Brian"); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserIsDeleted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Duc"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserIsDeletedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Duc"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesUserIsDeletedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("Duc"); this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); } @Test public void testUpdateRecordAssigneesUserDuplicate() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesUserDuplicateToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesUserDuplicateCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); assignees.add(testman1.getCode()); UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(APP_ID, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord1); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); UpdateRecordResponse response = this.guestAuthRecordManagerment.updateRecordAssignees(1631, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord1); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); UpdateRecordResponse response = this.tokenGuestRecordManagerment.updateRecordAssignees(1631, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test public void testUpdateRecordAssigneesInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord1); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); UpdateRecordResponse response = this.certGuestRecordManagerment.updateRecordAssignees(1631, id, assignees, null); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesProcessOFF() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.passwordAuthRecordManagerment.updateRecordAssignees(1640, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesProcessOFFToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.requiredFieldTokenRecordManagerment.updateRecordAssignees(1640, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesProcessOFFCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.certRecordManagerment.updateRecordAssignees(1640, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailNotHavePermissionApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1658, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.passwordAuthRecordManagerment.updateRecordAssignees(1658, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailNotHavePermissionAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.noDeletePermissionRecordManagerment.addRecord(1658, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.noDeletePermissionRecordManagerment.updateRecordAssignees(1658, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldFailNotHavePermissionAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1658, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.certRecordManagerment.updateRecordAssignees(1658, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldSuccessWhenNotHavePermissionId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1659, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.passwordAuthRecordManagerment.updateRecordAssignees(1659, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldSuccessWhenNotHavePermissionIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.noEditPermissionRecordManagerment.addRecord(1659, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.noEditPermissionRecordManagerment.updateRecordAssignees(1659, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesShouldSuccessWhenNotHavePermissionIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1659, testRecord1); // Main Test processing Integer id = addResponse.getID(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.certRecordManagerment.updateRecordAssignees(1659, id, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdUnexisted() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.passwordAuthRecordManagerment.updateRecordAssignees(100000, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdUnexistedToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.tokenRecordManagerment.updateRecordAssignees(100000, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdUnexistedCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.certRecordManagerment.updateRecordAssignees(100000, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdNegativeNumber() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.passwordAuthRecordManagerment.updateRecordAssignees(-1, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdNegativeNumberToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.tokenRecordManagerment.updateRecordAssignees(-1, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdNegativeNumberCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.certRecordManagerment.updateRecordAssignees(-1, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdZero() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.passwordAuthRecordManagerment.updateRecordAssignees(0, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdZeroToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.tokenRecordManagerment.updateRecordAssignees(0, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesAppIdZeroCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.certRecordManagerment.updateRecordAssignees(0, 1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdUnexisted() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, 100000, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdUnexistedToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, 100000, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdUnexistedCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("yfang"); this.certRecordManagerment.updateRecordAssignees(APP_ID, 100000, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdNegativeNumber() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, -1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdNegativeNumberToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, -1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdNegativeNumberCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.certRecordManagerment.updateRecordAssignees(APP_ID, -1, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdZero() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, 0, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdZeroToken() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, 0, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIdZeroCert() throws KintoneAPIException { ArrayList<String> assignees = new ArrayList<String>(); assignees.add("testman1"); this.certRecordManagerment.updateRecordAssignees(APP_ID, 0, assignees, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIWithoutAssignees() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIWithoutAssigneesToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordAssignees(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesIWithoutAssigneesCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); UpdateRecordResponse response = this.certRecordManagerment.updateRecordAssignees(APP_ID, id, null, revision); assertEquals((Integer) (revision + 1), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(APP_ID, null, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.tokenRecordManagerment.updateRecordAssignees(APP_ID, null, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.certRecordManagerment.updateRecordAssignees(APP_ID, null, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.passwordAuthRecordManagerment.updateRecordAssignees(null, id, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.tokenRecordManagerment.updateRecordAssignees(null, id, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordAssigneesWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); ArrayList<String> assignees = new ArrayList<String>(); assignees.add(testman1.getCode()); this.certRecordManagerment.updateRecordAssignees(null, id, assignees, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyAction() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyActionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyActionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusActionPlusAssignee() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusActionPlusAssigneeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusActionPlusAssigneeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusLocalLanguage() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1661, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "yfang"; String action = "しょりかいし"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(1661, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusLocalLanguageToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.localLanguageRecordManagerment.addRecord(1661, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "yfang"; String action = "しょりかいし"; UpdateRecordResponse response = this.localLanguageRecordManagerment.updateRecordStatus(1661, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusLocalLanguageCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1661, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "yfang"; String action = "しょりかいし"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(1661, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusDoNotSetAssignee() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(1662, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusDoNotSetAssigneeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.noSetAssigneeRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.noSetAssigneeRecordManagerment.updateRecordStatus(1662, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusDoNotSetAssigneeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(1662, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusCurrentUserToChangeStatus() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); Auth passwordAuth = new Auth(); passwordAuth.setPasswordAuth("user1", "user1"); Connection connection = new Connection(TestConstants.DOMAIN, passwordAuth); Record record = new Record(connection); String action2 = "完了する"; UpdateRecordResponse response1 = record.updateRecordStatus(APP_ID, id, action2, null, revision + 2); assertEquals((Integer) (revision + 4), response1.getRevision()); } @Test public void testUpdateRecordStatusCurrentUserToChangeStatusToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); Auth passwordAuth = new Auth(); passwordAuth.setPasswordAuth("user1", "user1"); Connection connection = new Connection(TestConstants.DOMAIN, passwordAuth); Record record = new Record(connection); String action2 = "完了する"; UpdateRecordResponse response1 = record.updateRecordStatus(APP_ID, id, action2, null, revision + 2); assertEquals((Integer) (revision + 4), response1.getRevision()); } @Test public void testUpdateRecordStatusCurrentUserToChangeStatusCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); assertEquals((Integer) (revision + 2), response.getRevision()); Auth certauth = new Auth(); certauth.setPasswordAuth("user1", "user1"); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); Record record = new Record(connection); String action2 = "完了する"; UpdateRecordResponse response1 = record.updateRecordStatus(APP_ID, id, action2, null, revision + 2); assertEquals((Integer) (revision + 4), response1.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAssignee() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "aaaaaaaaaaa"; String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAssigneeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "aaaaaaaaaaa"; String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAssigneeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = "aaaaaaaaaaa"; String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, revision); } @Test public void testUpdateRecordStatusRevisionNegativeOne() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -1); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusRevisionNegativeOneToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -1); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusRevisionNegativeOneCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; UpdateRecordResponse response = this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -1); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWhenComplete() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, 5665, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWhenCompleteToken() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, 5665, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWhenCompleteCert() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, 5665, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyAssigneeCanChage() throws KintoneAPIException { String action = "完了する"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, 5662, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyAssigneeCanChageToken() throws KintoneAPIException { String action = "完了する"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, 5662, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusOnlyAssigneeCanChageCert() throws KintoneAPIException { String action = "完了する"; this.certRecordManagerment.updateRecordStatus(APP_ID, 5662, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAssignee() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAssigneeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAssigneeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, null, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAction() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, null, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutActionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, null, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutActionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); this.certRecordManagerment.updateRecordStatus(APP_ID, id, null, assignee, revision); } @Test public void testUpdateRecordStatusWithoutRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String action = "処理開始"; String assignee = testman1.getCode(); this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, null); } @Test public void testUpdateRecordStatusWithoutRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String action = "処理開始"; String assignee = testman1.getCode(); this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, null); } @Test public void testUpdateRecordStatusWithoutRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String action = "処理開始"; String assignee = testman1.getCode(); this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, null, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, null, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, null, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(null, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(null, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(null, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAlreadyHasAssignee() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, 5664, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAlreadyHasAssigneeToken() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, 5664, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAlreadyHasAssigneeCert() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, 5664, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionApp() throws KintoneAPIException { String action = "开始处理"; this.passwordAuthRecordManagerment.updateRecordStatus(1632, 1, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionAppToken() throws KintoneAPIException { String action = "开始处理"; this.noAddPermissionTokenReocrdManagerment.updateRecordStatus(1632, 1, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionAppCert() throws KintoneAPIException { String action = "开始处理"; this.certRecordManagerment.updateRecordStatus(1632, 1, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1634, testRecord1); // Main Test processing Integer id = addResponse.getID(); String action = "开始处理"; this.passwordAuthRecordManagerment.updateRecordStatus(1634, id, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.addNoViewTokenRecordManagerment.addRecord(1634, testRecord1); // Main Test processing Integer id = addResponse.getID(); String action = "开始处理"; this.addNoViewTokenRecordManagerment.updateRecordStatus(1634, id, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusNotHavePermissionRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1634, testRecord1); // Main Test processing Integer id = addResponse.getID(); String action = "开始处理"; this.certRecordManagerment.updateRecordStatus(1634, id, action, null, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAppId() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(100000, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAppIdToken() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(100000, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAppIdCert() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(100000, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdNegativeOne() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(-1, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdNegativeOneToken() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(-1, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdNegativeOneCert() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(-1, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdZreo() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(0, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdZreoToken() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(0, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusAppIdZreoCert() throws KintoneAPIException { String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(0, 1, action, assignee, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedRevision() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String assignee = testman1.getCode(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedRevisionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String assignee = testman1.getCode(); String action = "処理開始"; this.tokenRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedRevisionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); String assignee = testman1.getCode(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(APP_ID, id, action, assignee, -2); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedAction() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理1開始"; this.passwordAuthRecordManagerment.updateRecordStatus(1662, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedActionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.noSetAssigneeRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理1開始"; this.noSetAssigneeRecordManagerment.updateRecordStatus(1662, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusUnexistedActionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1662, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String assignee = testman1.getCode(); String action = "処理1開始"; this.certRecordManagerment.updateRecordStatus(1662, id, action, assignee, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusProcessOff() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "文字列1行"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1658, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.passwordAuthRecordManagerment.updateRecordStatus(1658, id, action, null, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusProcessOffToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "文字列1行"); AddRecordResponse addResponse = this.noDeletePermissionRecordManagerment.addRecord(1658, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.noDeletePermissionRecordManagerment.updateRecordStatus(1658, id, action, null, revision); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordStatusProcessOffCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "文字列1行"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1658, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "処理開始"; this.certRecordManagerment.updateRecordStatus(1658, id, action, null, revision); } @Test public void testUpdateRecordStatusInGuest() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "开始处理"; UpdateRecordResponse response = this.guestAuthRecordManagerment.updateRecordStatus(1631, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusInGuestToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "开始处理"; UpdateRecordResponse response = this.tokenGuestRecordManagerment.updateRecordStatus(1631, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordStatusInGuestCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); Integer revision = addResponse.getRevision(); String action = "开始处理"; UpdateRecordResponse response = this.certGuestRecordManagerment.updateRecordStatus(1631, id, action, null, revision); assertEquals((Integer) (revision + 2), response.getRevision()); } @Test public void testUpdateRecordsStatus() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusInGuest() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.guestAuthRecordManagerment.addRecords(1631, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.guestAuthRecordManagerment.updateRecordsStatus(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusInGuestToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenGuestRecordManagerment.addRecords(1631, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.tokenGuestRecordManagerment.updateRecordsStatus(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusInGuestCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certGuestRecordManagerment.addRecords(1631, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); UpdateRecordsResponse response = this.certGuestRecordManagerment.updateRecordsStatus(1631, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(2, results.size()); assertEquals(addResponse.getIDs().get(0), results.get(0).getID()); assertEquals((Integer) (addResponse.getRevisions().get(0) + 2), results.get(0).getRevision()); assertEquals(addResponse.getIDs().get(1), results.get(1).getID()); assertEquals((Integer) (addResponse.getRevisions().get(1) + 2), results.get(1).getRevision()); } @Test public void testUpdateRecordsStatusHundred() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i < 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } UpdateRecordsResponse response = this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(100, results.size()); } @Test public void testUpdateRecordsStatusHundredToken() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i < 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } UpdateRecordsResponse response = this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(100, results.size()); } @Test public void testUpdateRecordsStatusHundredCert() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i < 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i < 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } UpdateRecordsResponse response = this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); ArrayList<RecordUpdateResponseItem> results = response.getRecords(); assertEquals(100, results.size()); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusOverHundred() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i <= 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusOverHundredToken() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i <= 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusOverHundredCert() throws KintoneAPIException { // Preprocessing ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); for (int i = 0; i <= 100; i++) { HashMap<String, FieldValue> testRecord = createTestRecord(); testRecord = addField(testRecord, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); records.add(testRecord); } AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); for (int i = 0; i <= 100; i++) { RecordUpdateStatusItem item = new RecordUpdateStatusItem("処理開始", testman1.getCode(), addResponse.getIDs().get(i), addResponse.getRevisions().get(i)); updateItems.add(item); } this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusProcessOff() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1658, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(1658, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusProcessOffToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.noDeletePermissionRecordManagerment.addRecords(1658, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.noDeletePermissionRecordManagerment.updateRecordsStatus(1658, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusProcessOffCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1658, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(1658, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionApp() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, 1, -1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, 2, -1); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionAppToken() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, 1, -1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, 2, -1); updateItems.add(item1); updateItems.add(item2); this.noViewPermissionTokenRecordManagerment.updateRecordsStatus(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionAppCert() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, 1, -1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, 2, -1); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(1632, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(1634, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.addNoViewTokenRecordManagerment.addRecords(1634, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.addNoViewTokenRecordManagerment.updateRecordsStatus(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusNotHavePermissionRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = new HashMap<>(); testRecord1 = addField(testRecord1, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); HashMap<String, FieldValue> testRecord2 = new HashMap<>(); testRecord2 = addField(testRecord2, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(1634, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("开始处理", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("开始处理", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(1634, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameBlank() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameBlankToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameBlankCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameInvalid() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("aaa", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameInvalidToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("aaa", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongActionNameInvalidCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("aaa", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAssigneeInvalid() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "ssssssssssssss", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAssigneeInvalidToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "ssssssssssssss", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAssigneeInvalidCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "ssssssssssssss", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDInvalid() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), -1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDInvalidToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), -1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDInvalidCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), -1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 100000, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 100000, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongIDUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 100000, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionInvalid() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, -2); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionInvalidToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, -2); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionInvalidCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, -2); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, 100000); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, 100000); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongRevisionUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, 100000); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithInactiveUser() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "XXXXX", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithInactiveUserToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "XXXXX", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithInactiveUserCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", "XXXXX", id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdUnexisted() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(10000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdUnexistedToken() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(10000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdUnexistedCert() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(10000, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdNegativeNumber() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdNegativeNumberToken() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdNegativeNumberCert() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(-1, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdZero() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdZeroToken() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithWrongAppIdZeroCert() throws KintoneAPIException { ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 1, null); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), 2, null); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(0, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutItems() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutItemsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.tokenRecordManagerment.updateRecordsStatus(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutItemsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing this.certRecordManagerment.updateRecordsStatus(APP_ID, null); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(null, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(null, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(null, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutRecord() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutRecordToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutRecordCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer revision1 = addResponse.getRevisions().get(0); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", testman1.getCode(), null, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutAssignee() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.passwordAuthRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.passwordAuthRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutAssigneeToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.tokenRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.tokenRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test(expected = KintoneAPIException.class) public void testUpdateRecordsStatusWithoutAssigneeCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord1 = createTestRecord(); testRecord1 = addField(testRecord1, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 1"); HashMap<String, FieldValue> testRecord2 = createTestRecord(); testRecord2 = addField(testRecord2, "文字列__1行", FieldType.SINGLE_LINE_TEXT, "test single text 2"); ArrayList<HashMap<String, FieldValue>> records = new ArrayList<HashMap<String, FieldValue>>(); records.add(testRecord1); records.add(testRecord2); AddRecordsResponse addResponse = this.certRecordManagerment.addRecords(APP_ID, records); // Main Test processing Integer id1 = addResponse.getIDs().get(0); Integer revision1 = addResponse.getRevisions().get(0); Integer id2 = addResponse.getIDs().get(1); Integer revision2 = addResponse.getRevisions().get(1); ArrayList<RecordUpdateStatusItem> updateItems = new ArrayList<RecordUpdateStatusItem>(); RecordUpdateStatusItem item1 = new RecordUpdateStatusItem("処理開始", null, id1, revision1); RecordUpdateStatusItem item2 = new RecordUpdateStatusItem("処理開始", null, id2, revision2); updateItems.add(item1); updateItems.add(item2); this.certRecordManagerment.updateRecordsStatus(APP_ID, updateItems); } @Test public void testAddComment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentsInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.guestAuthRecordManagerment.addComment(1631, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentsInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.tokenGuestRecordManagerment.addComment(1631, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentsInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse response = this.certGuestRecordManagerment.addComment(1631, id, comment); assertNotNull(response.getId()); } @Test public void testAddCommentAndCheckComment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment ", response.getComments().get(0).getText()); } @Test public void testAddCommentAndCheckCommentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testTokenAdimin, response.getComments().get(0).getCreator()); assertEquals(testman2.getName() + " \ntest comment ", response.getComments().get(0).getText()); } @Test public void testAddCommentAndCheckCommentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testCertAdimin, response.getComments().get(0).getCreator()); assertEquals(testman2.getName() + " \ntest comment ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithGroup() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention groupMention = new CommentMention(); groupMention.setCode(testgroup1.getCode()); groupMention.setType("GROUP"); mentionList.add(groupMention); comment.setText("test comment group"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testgroup1.getName() + " \ntest comment group ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithGroupToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention groupMention = new CommentMention(); groupMention.setCode(testgroup1.getCode()); groupMention.setType("GROUP"); mentionList.add(groupMention); comment.setText("test comment group"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testgroup1.getName() + " \ntest comment group ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithGroupCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention groupMention = new CommentMention(); groupMention.setCode(testgroup1.getCode()); groupMention.setType("GROUP"); mentionList.add(groupMention); comment.setText("test comment group"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testgroup1.getName() + " \ntest comment group ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithOrganization() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention orgMention = new CommentMention(); orgMention.setCode(testorg1.getCode()); orgMention.setType("ORGANIZATION"); mentionList.add(orgMention); comment.setText("test comment organization"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testorg1.getName() + " \ntest comment organization ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithOrganizationToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention orgMention = new CommentMention(); orgMention.setCode(testorg1.getCode()); orgMention.setType("ORGANIZATION"); mentionList.add(orgMention); comment.setText("test comment organization"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testorg1.getName() + " \ntest comment organization ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithOrganizationCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention orgMention = new CommentMention(); orgMention.setCode(testorg1.getCode()); orgMention.setType("ORGANIZATION"); mentionList.add(orgMention); comment.setText("test comment organization"); comment.setMentions(mentionList); AddCommentResponse addCommentResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testorg1.getName() + " \ntest comment organization ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithoutMetion() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("test comment no metion"); AddCommentResponse addCommentResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("test comment no metion ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithoutMetionToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("test comment no metion"); AddCommentResponse addCommentResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("test comment no metion ", response.getComments().get(0).getText()); } @Test public void testAddCommentWithoutMetionCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("test comment no metion"); AddCommentResponse addCommentResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("test comment no metion ", response.getComments().get(0).getText()); } @Test public void testAddCommentSpecialCharacter() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("テスト"); AddCommentResponse addCommentResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("テスト ", response.getComments().get(0).getText()); } @Test public void testAddCommentSpecialCharacterToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("テスト"); AddCommentResponse addCommentResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("テスト ", response.getComments().get(0).getText()); } @Test public void testAddCommentSpecialCharacterCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("テスト"); AddCommentResponse addCommentResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); assertNotNull(addCommentResponse.getId()); GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(1, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("テスト ", response.getComments().get(0).getText()); } @Test(expected = KintoneAPIException.class) public void testAddCommentBlank() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText(""); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentBlankToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText(""); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentBlankCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText(""); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentNull() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentNullToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentNullCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMaxCharacter() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); StringBuffer sb = new StringBuffer(); for (int i = 0; i <= 65535; i++) { sb.append("a"); } comment.setText(sb.toString()); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMaxCharacterToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); StringBuffer sb = new StringBuffer(); for (int i = 0; i <= 65535; i++) { sb.append("a"); } comment.setText(sb.toString()); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMaxCharacterCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); StringBuffer sb = new StringBuffer(); for (int i = 0; i <= 65535; i++) { sb.append("a"); } comment.setText(sb.toString()); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedUser() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedUserToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedUserCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMetionOverTen() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); for (int i = 0; i <= 10; i++) { CommentMention mention = new CommentMention(); mention.setCode(testman1.getCode()); mention.setType("USER"); mentionList.add(mention); } comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMetionOverTenToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); for (int i = 0; i <= 10; i++) { CommentMention mention = new CommentMention(); mention.setCode(testman1.getCode()); mention.setType("USER"); mentionList.add(mention); } comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentMetionOverTenCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); for (int i = 0; i <= 10; i++) { CommentMention mention = new CommentMention(); mention.setCode(testman1.getCode()); mention.setType("USER"); mentionList.add(mention); } comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedGroup() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("GROUP"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedGroupToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("GROUP"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedGroupCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("GROUP"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedOrganization() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("ORGANIZATION"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedOrganizationToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("ORGANIZATION"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentUnexistedOrganizationCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("aaaaaaaaaaaa"); mention.setType("ORGANIZATION"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(null, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(null, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(null, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppUnexisted() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(100000, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppUnexistedToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(100000, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppUnexistedCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(100000, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppNegativeNumber() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(-1, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppNegativeNumberToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(-1, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppNegativeNumberCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(-1, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppZero() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(0, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppZeroToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(0, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentAppZeroCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(0, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, null, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, null, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, null, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordUnexisted() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(APP_ID, 100000, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordUnexistedToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(APP_ID, 100000, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordUnexistedCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(APP_ID, 100000, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordNegativeNumber() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(APP_ID, -1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordNegativeNumberToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(APP_ID, -1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordNegativeNumberCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(APP_ID, -1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordZero() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.passwordAuthRecordManagerment.addComment(APP_ID, 0, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordZeroToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.tokenRecordManagerment.addComment(APP_ID, 0, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentRecordZeroCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("test comment"); this.certRecordManagerment.addComment(APP_ID, 0, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutComment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); this.passwordAuthRecordManagerment.addComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutCommentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); this.tokenRecordManagerment.addComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testAddCommentWithoutCommentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); // Main Test processing Integer id = addResponse.getID(); this.certRecordManagerment.addComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionApp() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.passwordAuthRecordManagerment.addComment(1632, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionAppToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.noViewPermissionTokenRecordManagerment.addComment(1632, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionAppCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.certRecordManagerment.addComment(1632, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionRecord() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.passwordAuthRecordManagerment.addComment(1634, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionRecordToken() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.addNoViewTokenRecordManagerment.addComment(1634, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentDoNotHavePermissionRecordCert() throws KintoneAPIException { CommentContent comment = new CommentContent(); comment.setText("yfang"); this.certRecordManagerment.addComment(1634, 1, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentCommentOff() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("yfang"); this.passwordAuthRecordManagerment.addComment(1640, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentCommentOffToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.requiredFieldTokenRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("yfang"); this.requiredFieldTokenRecordManagerment.addComment(1640, id, comment); } @Test(expected = KintoneAPIException.class) public void testAddCommentCommentOffCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); comment.setText("yfang"); this.certRecordManagerment.addComment(1640, id, comment); } @Test public void testGetComments() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testTokenAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.guestAuthRecordManagerment.addComment(1631, id, comment); comment.setText("test comment2"); this.guestAuthRecordManagerment.addComment(1631, id, comment); comment.setText("test comment3"); this.guestAuthRecordManagerment.addComment(1631, id, comment); comment.setText("test comment4"); this.guestAuthRecordManagerment.addComment(1631, id, comment); // Main Test processing GetCommentsResponse response = this.guestAuthRecordManagerment.getComments(1631, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("yfang" + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment2"); this.tokenGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment3"); this.tokenGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment4"); this.tokenGuestRecordManagerment.addComment(1631, id, comment); // Main Test processing GetCommentsResponse response = this.tokenGuestRecordManagerment.getComments(1631, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("yfang" + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testTokenAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment2"); this.certGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment3"); this.certGuestRecordManagerment.addComment(1631, id, comment); comment.setText("test comment4"); this.certGuestRecordManagerment.addComment(1631, id, comment); // Main Test processing GetCommentsResponse response = this.certGuestRecordManagerment.getComments(1631, id, "asc", 1, 2); assertEquals(2, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals("yfang" + " \ntest comment2 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertTrue(response.getOlder()); assertTrue(response.getNewer()); } @Test public void testGetCommentsAsc() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, "asc", null, null); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test public void testGetCommentsAscToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, "asc", null, null); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test public void testGetCommentsAscCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, "asc", null, null); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test public void testGetCommentsDesc() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, "desc", null, null); assertEquals(Integer.valueOf(2), response.getComments().get(0).getId()); } @Test public void testGetCommentsDescToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, "desc", null, null); assertEquals(Integer.valueOf(2), response.getComments().get(0).getId()); } @Test public void testGetCommentsDescCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, "desc", null, null); assertEquals(Integer.valueOf(2), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetOffset() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, 5, null); assertEquals(1, response.getComments().size()); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetOffsetToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.tokenRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, 5, null); assertEquals(1, response.getComments().size()); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetOffsetCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.certRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, 5, null); assertEquals(1, response.getComments().size()); assertEquals(Integer.valueOf(1), response.getComments().get(0).getId()); } @Test(expected = KintoneAPIException.class) public void testGetCommentsOffsetLessThanZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, -1, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsOffsetLessThanZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.tokenRecordManagerment.getComments(APP_ID, id, null, -1, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsOffsetLessThanZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.certRecordManagerment.getComments(APP_ID, id, null, -1, null); } @Test public void testGetCommentsSetLimit() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetLimitToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.tokenRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetLimitCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 6; i++) { this.certRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsSetLimitNoComment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(1, response.getComments().size()); } @Test public void testGetCommentsSetLimitNoCommentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(1, response.getComments().size()); } @Test public void testGetCommentsSetLimitNoCommentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, 5); assertEquals(1, response.getComments().size()); } @Test(expected = KintoneAPIException.class) public void testGetCommentsSetLimitOverTen() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, 11); } @Test(expected = KintoneAPIException.class) public void testGetCommentsSetLimitOverTenToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.tokenRecordManagerment.getComments(APP_ID, id, null, null, 11); } @Test(expected = KintoneAPIException.class) public void testGetCommentsSetLimitOverTenCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.certRecordManagerment.getComments(APP_ID, id, null, null, 11); } @Test public void testGetCommentsAscOfflitLimit() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, "asc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsAscOfflitLimitToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.tokenRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, "asc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsAscOfflitLimitCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.certRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, "asc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(6), response.getComments().get(0).getId()); } @Test public void testGetCommentsDescOffsetLimit() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, "desc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(5), response.getComments().get(0).getId()); } @Test public void testGetCommentsDescOffsetLimitToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.tokenRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, "desc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(5), response.getComments().get(0).getId()); } @Test public void testGetCommentsDescOffsetLimitCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); for (int i = 0; i < 10; i++) { this.certRecordManagerment.addComment(APP_ID, id, comment); } // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, "desc", 5, 5); assertEquals(5, response.getComments().size()); assertEquals(Integer.valueOf(5), response.getComments().get(0).getId()); } @Test(expected = KintoneAPIException.class) public void testGetCommentsInvalidOrder() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.passwordAuthRecordManagerment.getComments(APP_ID, id, "test", null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsInvalidOrderToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.tokenRecordManagerment.getComments(APP_ID, id, "test", null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsInvalidOrderCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.certRecordManagerment.getComments(APP_ID, id, "test", null, null); } @Test public void testGetCommentsWithoutOptions() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.passwordAuthRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(4, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment4 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertFalse(response.getOlder()); assertFalse(response.getNewer()); } @Test public void testGetCommentsWithoutOptionsToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.tokenRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(4, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment4 ", response.getComments().get(0).getText()); assertEquals(testTokenAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertFalse(response.getOlder()); assertFalse(response.getNewer()); } @Test public void testGetCommentsWithoutOptionsCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing GetCommentsResponse response = this.certRecordManagerment.getComments(APP_ID, id, null, null, null); assertEquals(4, response.getComments().size()); assertNotNull(response.getComments().get(0).getId()); assertNotNull(response.getComments().get(0).getCreatedAt()); assertEquals(testman2.getName() + " \ntest comment4 ", response.getComments().get(0).getText()); assertEquals(testAdimin, response.getComments().get(0).getCreator()); assertEquals(mentionList, response.getComments().get(0).getMentions()); assertFalse(response.getOlder()); assertFalse(response.getNewer()); } @Test(expected = KintoneAPIException.class) public void testGetCommentsCommentOff() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(1658, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsCommentOffToken() throws KintoneAPIException { this.noDeletePermissionRecordManagerment.getComments(1658, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsCommentOffCert() throws KintoneAPIException { this.certRecordManagerment.getComments(1658, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionApp() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(1632, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionAppToken() throws KintoneAPIException { this.noViewPermissionTokenRecordManagerment.getComments(1632, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionAppCert() throws KintoneAPIException { this.certRecordManagerment.getComments(1632, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionRecord() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(1634, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionRecordToken() throws KintoneAPIException { this.addNoViewTokenRecordManagerment.getComments(1634, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsDoNotHavePermissionRecordCert() throws KintoneAPIException { this.certRecordManagerment.getComments(1634, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutAppId() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(null, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutAppIdToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(null, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutAppIdCert() throws KintoneAPIException { this.certRecordManagerment.getComments(null, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(100000, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(100000, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.getComments(100000, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdNegativeNumber() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(-1, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdNegativeNumberToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(-1, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdNegativeNumberCert() throws KintoneAPIException { this.certRecordManagerment.getComments(-1, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(0, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(0, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsAppIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.getComments(0, 1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, 10000, null, null, null); } @Ignore @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, 1000000, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, 10000, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdNegativeNumber() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, -1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdNegativeNumberToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, -1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdNegativeNumberCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, -1, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, 0, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, 0, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsRecordIdZeroCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, 0, null, null, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWrongOffset() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, 1, null, -1, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWrongOffsetToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, 1, null, -1, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWrongOffsetCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, 1, null, -1, null); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitNegativeNumber() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, 1, null, null, -1); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitNegativeNumberToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, 1, null, null, -1); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitNegativeNumberCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, 1, null, null, -1); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitOverTen() throws KintoneAPIException { this.passwordAuthRecordManagerment.getComments(APP_ID, 1, null, null, 11); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitOverTenToken() throws KintoneAPIException { this.tokenRecordManagerment.getComments(APP_ID, 1, null, null, 11); } @Test(expected = KintoneAPIException.class) public void testGetCommentsLimitOverTenCert() throws KintoneAPIException { this.certRecordManagerment.getComments(APP_ID, 1, null, null, 11); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.passwordAuthRecordManagerment.getComments(APP_ID, null, "asc", 1, 2); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.tokenRecordManagerment.getComments(APP_ID, null, "asc", 1, 2); } @Test(expected = KintoneAPIException.class) public void testGetCommentsWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment1"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment2"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment3"); this.certRecordManagerment.addComment(APP_ID, id, comment); comment.setText("test comment4"); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.certRecordManagerment.getComments(APP_ID, null, "asc", 1, 2); } @Test public void testDeleteComment() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, commentId); } @Test public void testDeleteCommentToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.tokenRecordManagerment.deleteComment(APP_ID, id, commentId); } @Test public void testDeleteCommentCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.certRecordManagerment.deleteComment(APP_ID, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionApp() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(1632, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionAppToken() throws KintoneAPIException { this.noViewPermissionTokenRecordManagerment.deleteComment(1632, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionAppCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(1632, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionRecord() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(1634, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionRecordToken() throws KintoneAPIException { this.addNoViewTokenRecordManagerment.deleteComment(1634, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentDoNotHavePermissionRecordCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(1634, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutCommentId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutCommentIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.tokenRecordManagerment.deleteComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutCommentIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing this.certRecordManagerment.deleteComment(APP_ID, id, null); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDUnexisted() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, 100000); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDUnexistedToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.tokenRecordManagerment.deleteComment(APP_ID, id, 100000); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDUnexistedCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.certRecordManagerment.deleteComment(APP_ID, id, 100000); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDNegativeNumber() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, -1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDNegativeNumberToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.tokenRecordManagerment.deleteComment(APP_ID, id, -1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDNegativeNumberCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.certRecordManagerment.deleteComment(APP_ID, id, -1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDZero() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, 0); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDZeroToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.tokenRecordManagerment.deleteComment(APP_ID, id, 0); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentIDZeroCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); this.certRecordManagerment.deleteComment(APP_ID, id, 0); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutRecordId() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.passwordAuthRecordManagerment.deleteComment(APP_ID, null, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutRecordIdToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.tokenRecordManagerment.deleteComment(APP_ID, null, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutRecordIdCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.certRecordManagerment.deleteComment(APP_ID, null, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(APP_ID, 1000000, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(APP_ID, 1000000, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(APP_ID, 1000000, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordNegativeNumber() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(APP_ID, -1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordNegativeNumberToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(APP_ID, -1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordNegativeNumberCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(APP_ID, -1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(APP_ID, 0, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(APP_ID, 0, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentRecordZeroCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(APP_ID, 0, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutApp() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.passwordAuthRecordManagerment.deleteComment(null, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutAppToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.tokenRecordManagerment.deleteComment(null, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentWithoutAppCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); this.certRecordManagerment.deleteComment(null, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppUnexisted() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(10000, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppUnexistedToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(10000, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppUnexistedCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(10000, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppNegativeNumber() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(-1, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppNegativeNumberToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(-1, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppNegativeNumberCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(-1, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppZero() throws KintoneAPIException { this.passwordAuthRecordManagerment.deleteComment(0, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppZeroToken() throws KintoneAPIException { this.tokenRecordManagerment.deleteComment(0, 1, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentAppZeroCert() throws KintoneAPIException { this.certRecordManagerment.deleteComment(0, 1, 1); } @Test public void testDeleteCommentsInGuest() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.guestAuthRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addComment = this.guestAuthRecordManagerment.addComment(1631, id, comment); this.guestAuthRecordManagerment.deleteComment(1631, id, addComment.getId()); } @Test public void testDeleteCommentsInGuestToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.tokenGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addComment = this.tokenGuestRecordManagerment.addComment(1631, id, comment); this.tokenGuestRecordManagerment.deleteComment(1631, id, addComment.getId()); } @Test public void testDeleteCommentsInGuestCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "text", FieldType.SINGLE_LINE_TEXT, "guest 文字列__1行"); AddRecordResponse addResponse = this.certGuestRecordManagerment.addRecord(1631, testRecord); // Main Test processing Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode("yfang"); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse addComment = this.certGuestRecordManagerment.addComment(1631, id, comment); this.certGuestRecordManagerment.deleteComment(1631, id, addComment.getId()); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentCommentOff() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); this.passwordAuthRecordManagerment.deleteComment(1640, id, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentCommentOffToken() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.requiredFieldTokenRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); this.requiredFieldTokenRecordManagerment.deleteComment(1640, id, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentCommentOffCert() throws KintoneAPIException { HashMap<String, FieldValue> testRecord = new HashMap<>(); testRecord = addField(testRecord, "单行文本框", FieldType.SINGLE_LINE_TEXT, "test single text 1"); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(1640, testRecord); Integer id = addResponse.getID(); this.certRecordManagerment.deleteComment(1640, id, 1); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentOtherUser() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.passwordAuthRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.passwordAuthRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); Auth auth = new Auth(); auth.setPasswordAuth("cyuan", "cyuan"); Connection connection = new Connection(TestConstants.DOMAIN, auth); this.passwordAuthRecordManagerment = new Record(connection); this.passwordAuthRecordManagerment.deleteComment(APP_ID, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentOtherUserToken() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.tokenRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.tokenRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); Auth auth = new Auth(); auth.setPasswordAuth("cyuan", "cyuan"); Connection connection = new Connection(TestConstants.DOMAIN, auth); this.tokenRecordManagerment = new Record(connection); this.tokenRecordManagerment.deleteComment(APP_ID, id, commentId); } @Test(expected = KintoneAPIException.class) public void testDeleteCommentOtherUserCert() throws KintoneAPIException { // Preprocessing HashMap<String, FieldValue> testRecord = createTestRecord(); AddRecordResponse addResponse = this.certRecordManagerment.addRecord(APP_ID, testRecord); Integer id = addResponse.getID(); CommentContent comment = new CommentContent(); ArrayList<CommentMention> mentionList = new ArrayList<CommentMention>(); CommentMention mention = new CommentMention(); mention.setCode(testman2.getCode()); mention.setType("USER"); mentionList.add(mention); comment.setText("test comment"); comment.setMentions(mentionList); AddCommentResponse commentAddResponse = this.certRecordManagerment.addComment(APP_ID, id, comment); // Main Test processing Integer commentId = commentAddResponse.getId(); Auth certauth = new Auth(); certauth.setPasswordAuth("cyuan", "cyuan"); certauth.setClientCertByPath(TestConstants.CLIENT_CERT_PATH, TestConstants.CLIENT_CERT_PASSWORD); Connection connection = new Connection(TestConstants.SECURE_DOMAIN, certauth); this.certRecordManagerment = new Record(connection); this.certRecordManagerment.deleteComment(APP_ID, id, commentId); } }
package com.wuyan.masteryi.mall.service; /* *project:master-yi *file:CommentServiceImpl *@author:wsn *date:2021/7/13 14:32 */ import com.wuyan.masteryi.mall.entity.Comment; import com.wuyan.masteryi.mall.mapper.CommentMapper; import com.wuyan.masteryi.mall.utils.ResponseMsg; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; import java.util.List; import java.util.Map; @Service public class CommentServiceImpl implements CommentService{ @Autowired CommentMapper commentMapper; @Autowired GoodsService goodsService; @Override public Map<String, Object> getCommentsByGoodId(int goodId) { List<Comment> commentsByGoodId = commentMapper.getCommentsByGoodId(goodId); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm"); for(Comment comment:commentsByGoodId){ List<Integer> specIdByCom = commentMapper.getSpecIdByCom(comment.getInOrderId(), goodId); Map<String, String> comUserMsg = commentMapper.getComUserMsg(comment.getReUserId()); comment.setUserImg(comUserMsg.get("user_img_url")); comment.setUserName(comUserMsg.get("user_name")); if(specIdByCom.size()>0){ comment.setDescription((Map<String, String>) goodsService.getSpecsDesc(specIdByCom.get(0)).get("data")); } comment.setFTime(sdf.format(comment.getComTime())); } return ResponseMsg.sendMsg(200,"ok",commentsByGoodId); } @Override public Map<String, Object> addComment(int goodId, int userId, String content, int stars,int orderId) { commentMapper.addComment(goodId,userId,content,stars,orderId); return ResponseMsg.sendMsg(200,"ok",null); } @Override public Map<String, Object> addReply(int goodId, int userId, String content, int toComId) { commentMapper.addReply(goodId,userId,content,toComId); return ResponseMsg.sendMsg(200,"ok",null); } @Override public Map<String, Object> getCommentsByComId(int comId) { List<Comment> commentsByComId = commentMapper.getCommentsByComId(comId); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm"); for(Comment comment:commentsByComId){ Map<String, String> comUserMsg = commentMapper.getComUserMsg(comment.getReUserId()); comment.setUserImg(comUserMsg.get("user_img_url")); comment.setUserName(comUserMsg.get("user_name")); comment.setFTime(sdf.format(comment.getComTime())); } return ResponseMsg.sendMsg(200,"ok",commentsByComId); } }
package com.duanxr.yith.midium; import java.util.Arrays; /** * @author Duanran 4/23/2020 */ public class FindFirstAndLastPositionOfElementInSortedArray { /** * Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. * * Your algorithm's runtime complexity must be in the order of O(log n). * * If the target is not found in the array, return [-1, -1]. * * Example 1: * * Input: nums = [5,7,7,8,8,10], target = 8 * Output: [3,4] * Example 2: * * Input: nums = [5,7,7,8,8,10], target = 6 * Output: [-1,-1] * * 给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 * * 你的算法时间复杂度必须是 O(log n) 级别。 * * 如果数组中不存在目标值,返回 [-1, -1]。 * * 示例 1: * * 输入: nums = [5,7,7,8,8,10], target = 8 * 输出: [3,4] * 示例 2: * * 输入: nums = [5,7,7,8,8,10], target = 6 * 输出: [-1,-1] */ class Solution { public int[] searchRange(int[] nums, int target) { int[] result = new int[2]; int index = Arrays.binarySearch(nums, target); if (index < 0) { result[0] = -1; result[1] = -1; } else { result[0] = index; result[1] = index; while (result[0] > 0) { if (nums[result[0] - 1] != target) { break; } result[0]--; } while (result[1] < nums.length - 1) { if (nums[result[1] + 1] != target) { break; } result[1]++; } } return result; } } }
package com.tencent.mm.plugin.welab; import android.text.TextUtils; import com.tencent.mm.ak.a.a.c; import com.tencent.mm.plugin.welab.c.a; import com.tencent.mm.sdk.platformtools.x; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; public final class b { private static final b qmL = new b(); public c pNL; public a qmM; public Map<String, com.tencent.mm.plugin.welab.a.a.b> qmN = new HashMap(); public com.tencent.mm.plugin.welab.a.a.b qmO; public b() { c.a aVar = new c.a(); aVar.dXy = true; aVar.dXx = true; this.pNL = aVar.Pt(); } public static b bYI() { return qmL; } public static String a(com.tencent.mm.plugin.welab.c.a.a aVar) { String str = ""; com.tencent.mm.plugin.welab.a.a.b RS = qmL.RS(aVar.field_LabsAppId); if (RS != null) { str = aVar.field_LabsAppId; str = RS.bYR(); x.i("WelabMgr", "get appName from opener , appid %s, appName %s", new Object[]{aVar.field_LabsAppId, str}); } if (TextUtils.isEmpty(str)) { return aVar.Sa("field_Title"); } return str; } public static String b(com.tencent.mm.plugin.welab.c.a.a aVar) { String str = ""; com.tencent.mm.plugin.welab.a.a.b RS = qmL.RS(aVar.field_LabsAppId); if (RS != null) { str = aVar.field_LabsAppId; str = RS.bYQ(); x.i("WelabMgr", "get icon url from opener , appid %s, url %s", new Object[]{aVar.field_LabsAppId, str}); } if (TextUtils.isEmpty(str)) { return aVar.field_Icon; } return str; } private com.tencent.mm.plugin.welab.a.a.b RS(String str) { return (com.tencent.mm.plugin.welab.a.a.b) this.qmN.get(str); } public static void O(boolean z, boolean z2) { f.P(z, z2); } public final List<com.tencent.mm.plugin.welab.c.a.a> bYJ() { List<com.tencent.mm.plugin.welab.c.a.a> bYS = this.qmM.bYS(); Iterator it = bYS.iterator(); while (it.hasNext()) { com.tencent.mm.plugin.welab.c.a.a aVar = (com.tencent.mm.plugin.welab.c.a.a) it.next(); if (!aVar.isRunning() || (!(aVar.field_Switch == 2 || aVar.field_Switch == 1) || "labs1de6f3".equals(aVar.field_LabsAppId))) { it.remove(); } } x.i("WelabMgr", new StringBuilder("online lab ").append(bYS).toString() != null ? bYS.toString() : ""); return bYS; } public final com.tencent.mm.plugin.welab.c.a.a RT(String str) { a aVar = this.qmM; com.tencent.mm.plugin.welab.c.a.a aVar2 = new com.tencent.mm.plugin.welab.c.a.a(); aVar2.field_LabsAppId = str; aVar.b(aVar2, new String[0]); return aVar2; } }
package com.company; public class Main { public static void main(String[] args) { double m = Double.parseDouble(args[0]); double umEuro = 0; double doisEuro = 0; double Cinqucent = 0; while (m != 0) { if (m >= 2) { m -= 2; doisEuro += 1; } else if (m >= 1) { m -= 1; umEuro += 1; } else if (m >= 0.50) { m -= 0.50; Cinqucent += 1; } } System.out.print(doisEuro + " moedas de dois euros "); System.out.print(umEuro + " moedas de um euros "); System.out.print(Cinqucent + " moedas de cinquenta centimos "); } }
package com.youthchina.domain.Qinghong; import java.sql.Timestamp; import java.util.Date; public class PreferSalary { private Integer pre_sala_id; private Integer pre_sala_cap; private Integer pre_sala_floor; private Integer pre_prof_code; private Integer stu_id; private Integer is_delete; private Timestamp is_delete_time; public Integer getPre_sala_id() { return pre_sala_id; } public void setPre_sala_id(Integer pre_sala_id) { this.pre_sala_id = pre_sala_id; } public Integer getPre_sala_cap() { return pre_sala_cap; } public void setPre_sala_cap(Integer pre_sala_cap) { this.pre_sala_cap = pre_sala_cap; } public Integer getPre_sala_floor() { return pre_sala_floor; } public void setPre_sala_floor(Integer pre_sala_floor) { this.pre_sala_floor = pre_sala_floor; } public Integer getPre_prof_code() { return pre_prof_code; } public void setPre_prof_code(Integer pre_prof_code) { this.pre_prof_code = pre_prof_code; } public Integer getStu_id() { return stu_id; } public void setStu_id(Integer stu_id) { this.stu_id = stu_id; } public Integer getIs_delete() { return is_delete; } public void setIs_delete(Integer is_delete) { this.is_delete = is_delete; } public Timestamp getIs_delete_time() { return is_delete_time; } public void setIs_delete_time(Timestamp is_delete_time) { this.is_delete_time = is_delete_time; } }
package fr.umlv.escape.editor; public class ShipEditor { public int health = 100; public String name = "default_ship"; public int x = 50; public int y = -20; public String trajectory = "DownMove"; @Override public String toString() { return name; } }
package pw.we.kd.wavelets; public class Daub { public static final double h0 = (1 + Math.sqrt(3)) / (4 * Math.sqrt(2)); public static final double h1 = (3 + Math.sqrt(3)) / (4 * Math.sqrt(2)); public static final double h2 = (3 - Math.sqrt(3)) / (4 * Math.sqrt(2)); public static final double h3 = (1 - Math.sqrt(3)) / (4 * Math.sqrt(2)); public static final double g0 = h3; public static final double g1 = -h2; public static final double g2 = h1; public static final double g3 = -h0; public static final double Ih0 = h2; public static final double Ih1 = g2; public static final double Ih2 = h0; public static final double Ih3 = g0; public static final double Ig0 = h3; public static final double Ig1 = g3; public static final double Ig2 = h1; public static final double Ig3 = g1; public void transform(double s[][], int start, int end) { for (int i = 0; i < s.length; i++) { for (int j = 0; j < s[i].length; j++) { s[i][j] = s[i][j] * end/start * 0.5; } } int N = s.length; int n; for (n = start; n >= end; n = n/2) { for (int i = 0; i < N; i++) { if (n >= 4) { int m, j; int h = n/2; double tmp[] = new double[n]; m = 0; for (j = 0; j < n - 3; j = j + 2) { tmp[m] = s[i][j] * h0 + s[i][j + 1] * h1 + s[i][j + 2] * h2 + s[i][j + 3] * h3; tmp[m + h] = s[i][j] * g0 + s[i][j + 1] * g1 + s[i][j + 2] * g2 + s[i][j + 3] * g3; m++; } tmp[m] = s[i][n - 2] * h0 + s[i][n - 1] * h1 + s[i][0] * h2 + s[i][1] * h3; tmp[m + h] = s[i][n - 2] * g0 + s[i][n - 1] * g1 + s[i][0] * g2 + s[i][1] * g3; for (m = 0; m < tmp.length; m++) { s[i][m] = tmp[m]; } } } } for (n = start; n >= end; n = n/2) { for (int i = 0; i < N; i++) { if (n >= 4) { int m, j; int h = n/2; double tmp[] = new double[n]; m = 0; for (j = 0; j < n - 3; j = j + 2) { tmp[m] = s[j][i] * h0 + s[j + 1][i] * h1 + s[j + 2][i] * h2 + s[j + 3][i] * h3; tmp[m + h] = s[j][i] * g0 + s[j + 1][i] * g1 + s[j + 2][i] * g2 + s[j + 3][i] * g3; m++; } tmp[m] = s[n - 2][i] * h0 + s[n - 1][i] * h1 + s[0][i] * h2 + s[1][i] * h3; tmp[m + h] = s[n - 2][i] * g0 + s[n - 1][i] * g1 + s[0][i] * g2 + s[1][i] * g3; for (m = 0; m < tmp.length; m++) { s[m][i] = tmp[m]; } } } for (int i = 0; i < s.length; i++) { for (int j = 0; j < s[i].length; j++) { if(s[i][j] > 255.0){ s[i][j] = 255.0; } } } } /* for (int i = 0; i < s.length; i++) { for (int j = 0; j < s[i].length; j++) { s[i][j] = Math.round(s[i][j]); if (s[i][j] > 255) { s[i][j] = 255; } else if (s[i][j] < 0) { s[i][j] = 0; } } }*/ } public void invTransform(double s[][], int start, int end) { for (int i = 0; i < s.length; i++) { for (int j = 0; j < s[i].length; j++) { s[i][j] = s[i][j] * end/start * 2; } } final int N = s.length; int n; for (n = start; n <= end; n = n * 2) { for (int i = 0; i < s.length; i++) { if (n >= 4) { int m, j; int h = n/2; int hP = h + 1; double tmp[] = new double[n]; tmp[0] = s[i][h - 1] * Ih0 + s[i][n - 1] * Ih1 + s[i][0] * Ih2 + s[i][h] * Ih3; tmp[1] = s[i][h - 1] * Ig0 + s[i][n - 1] * Ig1 + s[i][0] * Ig2 + s[i][h] * Ig3; j = 2; for (m = 0; m < h - 1; m++) { tmp[j++] = s[i][m] * Ih0 + s[i][m + h] * Ih1 + s[i][m + 1] * Ih2 + s[i][m + hP] * Ih3; tmp[j++] = s[i][m] * Ig0 + s[i][m + h] * Ig1 + s[i][m + 1] * Ig2 + s[i][m + hP] * Ig3; } for (m = 0; m < n; m++) { s[i][m] = tmp[m]; } } } } for (n = start; n <= end; n = n * 2) { for (int i = 0; i < s.length; i++) { if (n >= 4) { int m, j; int h = n/2; int hP = h + 1; double tmp[] = new double[n]; tmp[0] = s[h - 1][i] * Ih0 + s[n - 1][i] * Ih1 + s[0][i] * Ih2 + s[h][i] * Ih3; tmp[1] = s[h - 1][i] * Ig0 + s[n - 1][i] * Ig1 + s[0][i] * Ig2 + s[h][i] * Ig3; j = 2; for (m = 0; m < h - 1; m++) { tmp[j++] = s[m][i] * Ih0 + s[m + h][i] * Ih1 + s[m + 1][i] * Ih2 + s[m + hP][i] * Ih3; tmp[j++] = s[m][i] * Ig0 + s[m + h][i] * Ig1 + s[m + 1][i] * Ig2 + s[m + hP][i] * Ig3; } for (m = 0; m < n; m++) { s[m][i] = tmp[m]; } } } } /* for (int i = 0; i < coef.length; i++) { for (int j = 0; j < coef[i].length; j++) { coef[i][j] = Math.round(coef[i][j]); if (coef[i][j] > 255) { coef[i][j] = 255; } else if (coef[i][j] < 0) { coef[i][j] = 0; } } }*/ } public static void main(String[] args) { double S[][] = { { 64, 2, 3, 61, 60, 6, 7, 57 }, { 9, 55, 54, 12, 13, 51, 50, 16 }, { 17, 47, 46, 20, 21, 43, 42, 24 }, { 40, 26, 27, 37, 36, 30, 31, 33 }, { 32, 34, 35, 29, 28, 38, 39, 25 }, { 41, 23, 22, 44, 45, 19, 18, 48 }, { 49, 15, 14, 52, 53, 11, 10, 56 }, { 8, 58, 59, 5, 4, 62, 63, 1 } }; Daub d = new Daub(); d.transform(S, 8, 4); System.out.println("TRANS"); for (int i = 0; i < S.length; i++) { for (int j = 0; j < S[i].length; j++) { System.out.print(S[i][j] + " "); } System.out.println(); } d.invTransform(S, 4, 8); System.out.println("INV"); for (int i = 0; i < S.length; i++) { for (int j = 0; j < S[i].length; j++) { System.out.print(S[i][j] + " "); } System.out.println(); } } }
package com.sysh.util; /** * ClassName: <br/> * Function: 身份证号工具类<br/> * date: 2018年06月13日 <br/> * * @author 苏积钰 * @since JDK 1.8 */ public class IDNumberUtil { /** * 截取身份证的性别 * @param s * @return */ public static String sex(String s) { String ss=s.substring(16,17); if(Integer.parseInt(ss)%2==0) { return "女"; } else { return "男"; } } /** * 区别身份证和残疾证 * @param s * @return */ public static String IsIdNumber(String s) { String ss=s.substring(0,17); return ss; } }
package edu.imtl.BlueKare.Activity.Search; import android.content.Context; import android.location.Address; import android.location.Geocoder; import android.transition.AutoTransition; import android.transition.TransitionManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import edu.imtl.BlueKare.R; import edu.imtl.BlueKare.Utils.TreesContent; /******************* Histroy Page에서 사용한 Adapter ***********************/ public class TreesAdapter extends RecyclerView.Adapter<TreesAdapter.TreesHolder> { private List<Trees> trees; private Context context; public TreesAdapter(List<Trees> trees, Context context) { this.trees = trees; this.context = context; } @NonNull @Override public TreesHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_layout, parent, false); return new TreesHolder(view); } @Override public void onBindViewHolder(@NonNull TreesHolder holder, int position) { if(trees.get(position).getTreeName() != null) { holder.mTreeName.setText(trees.get(position).getTreeName()); } if(trees.get(position).getTreeDbh() != null) { holder.mTreeDBH.setText(trees.get(position).getTreeDbh() + " cm"); } if(trees.get(position).getTreeHeight() != null) { holder.mTreeHeight.setText(trees.get(position).getTreeHeight() + " m"); } if(trees.get(position).getTreeSpecies() != null) { holder.mTreeSpecies.setText(trees.get(position).getTreeSpecies()); } if(trees.get(position).getTreeNearLandMark() != null) { holder.mTreeLandmark.setText(trees.get(position).getTreeNearLandMark()); } if(trees.get(position).getTreeLocation()!=null) { /*holder.mTreeLocation.setText(String.format("%.8f",trees.get(position).getTreeLocation().getLatitude()) + " " + String.format("%.8f",trees.get(position).getTreeLocation().getLongitude()));*/ Geocoder mGeocoder = new Geocoder(context); try { List<Address> mResultList = mGeocoder.getFromLocation( trees.get(position).getTreeLocation().getLatitude(), trees.get(position).getTreeLocation().getLongitude(), 10 ); if(mResultList!=null){ holder.mTreeLocation.setText(mResultList.get(0).getAddressLine(0).toString()); } else { holder.mTreeLocation.setText(String.format("%.8f",trees.get(position).getTreeLocation().getLatitude()) + " " + String.format("%.8f",trees.get(position).getTreeLocation().getLongitude())); } } catch (IOException e){ e.printStackTrace(); } } if(trees.get(position).getTreePerson() != null) { holder.mPerson.setText(trees.get(position).getTreePerson()); } //time SimpleDateFormat format1 = new SimpleDateFormat ( "yyyy년 MM월 dd일 HH시 mm분"); if(trees.get(position).getTime()!=null) { String format_time1 = format1.format (1000*(Long.parseLong(trees.get(position).getTime()))); holder.mTime.setText(format_time1); } //image if (trees.get(position).getTreeSpecies().equals("은행")) { holder.tree_image.setImageResource(R.mipmap.ginkgo2_icon_foreground); } else if (trees.get(position).getTreeSpecies().equals("단풍")) { holder.tree_image.setImageResource(R.mipmap.maple2_icon_foreground); } else if (trees.get(position).getTreeSpecies().equals("벚")) { holder.tree_image.setImageResource(R.mipmap.sakura4_icon_foreground); } else if(trees.get(position).getTreeSpecies().equals("메타")) { holder.tree_image.setImageResource(R.mipmap.meta_icon_foreground); } else { holder.tree_image.setImageResource(R.mipmap.tree_icon_foreground); } holder.expandableView.setVisibility(View.GONE); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (holder.expandableView.getVisibility()==View.GONE){ TransitionManager.beginDelayedTransition(holder.cardView, new AutoTransition()); holder.expandableView.setVisibility(View.VISIBLE); holder.arrowBtn.setBackgroundResource(R.drawable.ic_keyboard_arrow_up_black_24dp); } else { TreesContent.updateFirebase(holder.mTreeName.getText().toString(),trees.get(position).getTime()); holder.expandableView.setVisibility(View.GONE); holder.arrowBtn.setBackgroundResource(R.drawable.ic_keyboard_arrow_down_black_24dp); } } }); } @Override public int getItemCount() { return trees.size(); } public void setFilter(List<Trees> treesList) { trees = new ArrayList<>(); trees.addAll(treesList); notifyDataSetChanged(); } public class TreesHolder extends RecyclerView.ViewHolder { TextView mTreeDBH, mTreeHeight, mTreeSpecies, mTreeLocation, mTime, mTreeLandmark, mPerson; EditText mTreeName; RelativeLayout expandableView; ImageView arrowBtn, tree_image; CardView cardView; public TreesHolder(@NonNull View itemView) { super(itemView); mPerson = itemView.findViewById(R.id.person); mTreeName = itemView.findViewById(R.id.name); mTreeDBH = itemView.findViewById(R.id.dbh); mTreeHeight = itemView.findViewById(R.id.height); mTreeSpecies = itemView.findViewById(R.id.species); mTreeLocation = itemView.findViewById(R.id.location); mTreeLandmark = itemView.findViewById(R.id.landmark); mTime = itemView.findViewById(R.id.timeTree); expandableView = itemView.findViewById(R.id.expandableView); arrowBtn = itemView.findViewById(R.id.arrowBtn); cardView = itemView.findViewById(R.id.cardView); tree_image = itemView.findViewById(R.id.tree_image); } } }
package in.swapnilsingh; public class Main { public static void main(String[] args) { Printer printer = new Printer(30, 20, true); System.out.println("Is the printer a duplex printer: " + printer.isDuplexPrinter()); Printer printer1 = new Printer(25, 1, false); System.out.println("Is the printer a duplex printer: " + printer1.isDuplexPrinter()); printer.simulatePagePrinting(); printer1.simulatePagePrinting(); } }
/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ package com.project.setup; import static com.project.constants.MyExtentionConstants.PLATFORM_LOGO_CODE; import de.hybris.platform.core.initialization.SystemSetup; import java.io.InputStream; import com.project.constants.MyExtentionConstants; import com.project.service.MyExtentionService; @SystemSetup(extension = MyExtentionConstants.EXTENSIONNAME) public class MyExtentionSystemSetup { private final MyExtentionService myExtentionService; public MyExtentionSystemSetup(final MyExtentionService myExtentionService) { this.myExtentionService = myExtentionService; } @SystemSetup(process = SystemSetup.Process.INIT, type = SystemSetup.Type.ESSENTIAL) public void createEssentialData() { myExtentionService.createLogo(PLATFORM_LOGO_CODE); } private InputStream getImageStream() { return MyExtentionSystemSetup.class.getResourceAsStream("/myExtention/sap-hybris-platform.png"); } }
package com.face.dao; import java.sql.ResultSet; import java.util.List; import javax.activation.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import com.face.model.Login; import com.face.model.Register; public class UserDaoImpl implements UserDao { DataSource datasource; @Autowired JdbcTemplate jdbctemplate; public void registerUser(Register register) { // TODO Auto-generated method stub String sql = "insert into register (name, username,email, mobile, password) values (?,?,?,?,?)"; jdbctemplate.update(sql, new Object[] { register.getName(), register.getUname(), register.getEmail(), register.getMob(), register.getPswd() }); } public Register validateUser(Login login) { // TODO Auto-generated method stub String sql = "select * from register where email= '" + login.getEmail() + "' and password= '" + login.getPswd() + "' "; List<Register> reg = jdbctemplate. query (sql, new UserMapper()); return reg.size() > 0 ? reg.get(0) : null ; } } class UserMapper implements RowMapper <Register> { public Register mapRow(ResultSet rs, int arg1) { Register register = new Register(); register.setName("name"); register.setUname("uname"); register.setEmail("email"); register.setMob("mob"); register.setPswd("pswd"); return register; } }
package com.medic.quotesbook.services; import android.app.IntentService; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.annotation.Nullable; import android.util.Log; import android.widget.RemoteViews; import com.appspot.quotesbookapp.quotesclient.Quotesclient; import com.appspot.quotesbookapp.quotesclient.model.ApiMessagesQuoteMsg; import com.appspot.quotesbookapp.quotesclient.model.ApiMessagesQuotesCollection; import com.medic.quotesbook.R; import com.medic.quotesbook.SingleQuoteWidgetProvider; import com.medic.quotesbook.models.Quote; import com.medic.quotesbook.utils.QuoteNetwork; import com.medic.quotesbook.utils.QuotesStorage; import java.io.IOException; /** * Created by capi on 7/21/17. */ public class WidgetQuotesReaderService extends IntentService{ public static final String PARAM_WIDGETS_IDS = "widgets_ids"; int[] widgetsIds; public WidgetQuotesReaderService() { super("WidgetQuotesReaderService"); } @Override protected void onHandleIntent(@Nullable Intent intent) { Quotesclient service = QuoteNetwork.getQuotesService(); QuotesStorage qs = new QuotesStorage(SingleQuoteWidgetProvider.WIDGET_QUOTES_FILE, getApplicationContext()); widgetsIds = intent.getIntArrayExtra(PARAM_WIDGETS_IDS); qs.clear(); qs.commit(); try { ApiMessagesQuotesCollection response = service.quotes().some().setLimit(20).execute(); Log.d(getClass().getSimpleName(), "Se reciben frases"); for (ApiMessagesQuoteMsg apiQuote : response.getQuotes()){ Quote quote = new Quote(apiQuote); qs.addQuoteTop(quote); qs.commit(); } } catch (IOException e) { Log.e(getClass().getSimpleName(), e.getMessage(), e); } if (qs.getQuotes().length > 0){ Quote actualQuote = qs.getQuotes()[0]; RemoteViews views = new RemoteViews(getApplicationContext().getPackageName(), R.layout.widget_single_quote); AppWidgetManager awm = (AppWidgetManager) getApplicationContext().getSystemService(Context.APPWIDGET_SERVICE); if (null == awm){ awm = AppWidgetManager.getInstance(getApplicationContext()); } SingleQuoteWidgetProvider.showQuoteInWidget(actualQuote, getApplicationContext(), views, awm, widgetsIds); } } }
package com.apress.books.dao; /* Descripcién: Interface DAO para el acceso a datos de la BD BOOKS. Autor: Carlos Ernesto Guevara Aguilar. F. Creacién: 25 de Noviembre de 2016. F. Cambio: 25 de Noviembre de 2016. */ import java.util.List; import com.apress.books.model.Book; import com.apress.books.model.Category; public interface IBookDAO { //#region Métodos a ser implementados /** * Método que obtiene todos los libros. */ public List<Book> findAllBooks (); /** * Método que obtiene todos los libros por similitud en nombre de libro, nombre de autor o apellido de autor. */ public List<Book> searchBooksByKeyword (String keyword); /** * Método que obtiene todas las categoréas. */ public List<Category> findAllCategories (); /** * Método que inserta un libro. */ public void insert (Book book); /** * Método que actualiza los datos de un libro. */ public void update (Book book); /** * Método que borra un libro. */ public void delete (Long bookId); //#endregion } // public interface IBookDAO {