target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testUpdateElement() { Location location = (Location) createElement(); elementGraph.update(traversal, location, Properties::all); InOrder inOrder = inOrder(traversal); inOrder.verify(traversal, times(1)).property("name", "San Francisco"); inOrder.verify(traversal, times(1)).property("startTime", locati... | protected <E extends Element> GraphTraversal update( GraphTraversal traversal, E element, Function<E, Object[]> lister) { return update(traversal, UpdateBy.TRAVERSAL, element, lister); } | ElementGraph { protected <E extends Element> GraphTraversal update( GraphTraversal traversal, E element, Function<E, Object[]> lister) { return update(traversal, UpdateBy.TRAVERSAL, element, lister); } } | ElementGraph { protected <E extends Element> GraphTraversal update( GraphTraversal traversal, E element, Function<E, Object[]> lister) { return update(traversal, UpdateBy.TRAVERSAL, element, lister); } } | ElementGraph { protected <E extends Element> GraphTraversal update( GraphTraversal traversal, E element, Function<E, Object[]> lister) { return update(traversal, UpdateBy.TRAVERSAL, element, lister); } } | ElementGraph { protected <E extends Element> GraphTraversal update( GraphTraversal traversal, E element, Function<E, Object[]> lister) { return update(traversal, UpdateBy.TRAVERSAL, element, lister); } } |
@Test public void testWithIdTraversal() { Element element = createElement(); traverse(element.withId); verify(traversal, times(1)).hasId(element.id()); } | @SuppressWarnings({"PMD.ShortMethodName"}) public final Object id() { if (userSuppliedId != null) { return userSuppliedId; } if (delegate != null) { return delegate.id(); } return null; } | Element implements Comparable<Element> { @SuppressWarnings({"PMD.ShortMethodName"}) public final Object id() { if (userSuppliedId != null) { return userSuppliedId; } if (delegate != null) { return delegate.id(); } return null; } } | Element implements Comparable<Element> { @SuppressWarnings({"PMD.ShortMethodName"}) public final Object id() { if (userSuppliedId != null) { return userSuppliedId; } if (delegate != null) { return delegate.id(); } return null; } Element(Element other); } | Element implements Comparable<Element> { @SuppressWarnings({"PMD.ShortMethodName"}) public final Object id() { if (userSuppliedId != null) { return userSuppliedId; } if (delegate != null) { return delegate.id(); } return null; } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) fi... | Element implements Comparable<Element> { @SuppressWarnings({"PMD.ShortMethodName"}) public final Object id() { if (userSuppliedId != null) { return userSuppliedId; } if (delegate != null) { return delegate.id(); } return null; } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) fi... |
@Test public void testWithLabelTraversal() { Element element = createElement(); traverse(element.withLabel); verify(traversal, times(1)).hasLabel(element.label()); } | public final String label() { return Label.of(getClass()); } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) final Object id(); @SneakyThrows @SuppressWarnings({"PMD.ShortMethodName"}) ElementTo.Element s(String key); void validate(); sta... | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) final Object id(); @SneakyThrows @SuppressWarnings({"PMD.ShortMethodName"}) ElementTo.Element s(String key); void validate(); sta... |
@Test public void testLabelExists() { Element element = createElement(); assertEquals(Label.of(element), element.label()); } | public final String label() { return Label.of(getClass()); } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); } | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) final Object id(); @SneakyThrows @SuppressWarnings({"PMD.ShortMethodName"}) ElementTo.Element s(String key); void validate(); sta... | Element implements Comparable<Element> { public final String label() { return Label.of(getClass()); } Element(Element other); final String label(); @SuppressWarnings({"PMD.ShortMethodName"}) final Object id(); @SneakyThrows @SuppressWarnings({"PMD.ShortMethodName"}) ElementTo.Element s(String key); void validate(); sta... |
@Test public void testExistsIn() { Element element = createElement(); Element other = anotherElement(); assertTrue(element.existsIn(Arrays.asList(element))); assertFalse(element.existsIn(Arrays.asList(other))); } | public boolean existsIn(Collection<? extends Element> elements) { final List<Field> fields = keyFields(getClass()); if (fields.isEmpty()) { fields.addAll(fields(getClass())); } return elements.stream() .anyMatch(element -> valuesOf(fields).compare(element, this) == 0); } | Element implements Comparable<Element> { public boolean existsIn(Collection<? extends Element> elements) { final List<Field> fields = keyFields(getClass()); if (fields.isEmpty()) { fields.addAll(fields(getClass())); } return elements.stream() .anyMatch(element -> valuesOf(fields).compare(element, this) == 0); } } | Element implements Comparable<Element> { public boolean existsIn(Collection<? extends Element> elements) { final List<Field> fields = keyFields(getClass()); if (fields.isEmpty()) { fields.addAll(fields(getClass())); } return elements.stream() .anyMatch(element -> valuesOf(fields).compare(element, this) == 0); } Element... | Element implements Comparable<Element> { public boolean existsIn(Collection<? extends Element> elements) { final List<Field> fields = keyFields(getClass()); if (fields.isEmpty()) { fields.addAll(fields(getClass())); } return elements.stream() .anyMatch(element -> valuesOf(fields).compare(element, this) == 0); } Element... | Element implements Comparable<Element> { public boolean existsIn(Collection<? extends Element> elements) { final List<Field> fields = keyFields(getClass()); if (fields.isEmpty()) { fields.addAll(fields(getClass())); } return elements.stream() .anyMatch(element -> valuesOf(fields).compare(element, this) == 0); } Element... |
@Test public void testConnectsProperly() { Develops develops = createElement(); assertTrue(develops.connects(Person.class, Software.class)); assertFalse(develops.connects(Person.class, Person.class)); } | @SuppressWarnings("PMD.CloseResource") public boolean connects(Vertex from, Vertex to) { return connects(from.getClass(), to.getClass()); } | Edge extends Element { @SuppressWarnings("PMD.CloseResource") public boolean connects(Vertex from, Vertex to) { return connects(from.getClass(), to.getClass()); } } | Edge extends Element { @SuppressWarnings("PMD.CloseResource") public boolean connects(Vertex from, Vertex to) { return connects(from.getClass(), to.getClass()); } } | Edge extends Element { @SuppressWarnings("PMD.CloseResource") public boolean connects(Vertex from, Vertex to) { return connects(from.getClass(), to.getClass()); } org.apache.tinkerpop.gremlin.structure.Edge delegate(); V fromAs(Class<V> vertexType); V toAs(Class<V> vertexType); @SuppressWarnings("PMD.CloseResource") b... | Edge extends Element { @SuppressWarnings("PMD.CloseResource") public boolean connects(Vertex from, Vertex to) { return connects(from.getClass(), to.getClass()); } org.apache.tinkerpop.gremlin.structure.Edge delegate(); V fromAs(Class<V> vertexType); V toAs(Class<V> vertexType); @SuppressWarnings("PMD.CloseResource") b... |
@Test public void testIsElement() { assertTrue(isElement(Person.class)); assertTrue(isElement(Develops.class)); } | public static boolean isElement(Class<?> type) { return is(type, Element.class); } | Classes { public static boolean isElement(Class<?> type) { return is(type, Element.class); } } | Classes { public static boolean isElement(Class<?> type) { return is(type, Element.class); } private Classes(); } | Classes { public static boolean isElement(Class<?> type) { return is(type, Element.class); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> type); static boo... | Classes { public static boolean isElement(Class<?> type) { return is(type, Element.class); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> type); static boo... |
@Test public void testIsVertex() { assertTrue(isVertex(Person.class)); assertFalse(isVertex(Develops.class)); } | public static boolean isVertex(Object object) { return object != null && isVertex(object.getClass()); } | Classes { public static boolean isVertex(Object object) { return object != null && isVertex(object.getClass()); } } | Classes { public static boolean isVertex(Object object) { return object != null && isVertex(object.getClass()); } private Classes(); } | Classes { public static boolean isVertex(Object object) { return object != null && isVertex(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class... | Classes { public static boolean isVertex(Object object) { return object != null && isVertex(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class... |
@Test public void testIsEdge() { assertFalse(isEdge(Person.class)); assertTrue(isEdge(Develops.class)); } | public static boolean isEdge(Object object) { return object != null && isEdge(object.getClass()); } | Classes { public static boolean isEdge(Object object) { return object != null && isEdge(object.getClass()); } } | Classes { public static boolean isEdge(Object object) { return object != null && isEdge(object.getClass()); } private Classes(); } | Classes { public static boolean isEdge(Object object) { return object != null && isEdge(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> ... | Classes { public static boolean isEdge(Object object) { return object != null && isEdge(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> ... |
@Test public void testIsList() { assertFalse(isList(Person.class)); assertTrue(isList(Arrays.asList(develops))); } | public static boolean isList(Object object) { return object != null && isList(object.getClass()); } | Classes { public static boolean isList(Object object) { return object != null && isList(object.getClass()); } } | Classes { public static boolean isList(Object object) { return object != null && isList(object.getClass()); } private Classes(); } | Classes { public static boolean isList(Object object) { return object != null && isList(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> ... | Classes { public static boolean isList(Object object) { return object != null && isList(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?> ... |
@Test public void testInitialState() { Assert.assertEquals(0, counterViewModel.getCount()); } | @Bindable public int getCount() { return count; } | CounterViewModel extends BaseObservable { @Bindable public int getCount() { return count; } } | CounterViewModel extends BaseObservable { @Bindable public int getCount() { return count; } } | CounterViewModel extends BaseObservable { @Bindable public int getCount() { return count; } void increment(); void decrement(); @Bindable int getCount(); } | CounterViewModel extends BaseObservable { @Bindable public int getCount() { return count; } void increment(); void decrement(); @Bindable int getCount(); } |
@Test public void testIncrement() { for (int i = 1; i <= 5; i++) { counterViewModel.increment(); Assert.assertEquals(i, counterViewModel.getCount()); } } | public void increment() { setCount(getCount() + 1); } | CounterViewModel extends BaseObservable { public void increment() { setCount(getCount() + 1); } } | CounterViewModel extends BaseObservable { public void increment() { setCount(getCount() + 1); } } | CounterViewModel extends BaseObservable { public void increment() { setCount(getCount() + 1); } void increment(); void decrement(); @Bindable int getCount(); } | CounterViewModel extends BaseObservable { public void increment() { setCount(getCount() + 1); } void increment(); void decrement(); @Bindable int getCount(); } |
@Test public void testDecrement() { for (int i = 1; i <= 5; i++) { counterViewModel.decrement(); Assert.assertEquals(i * -1, counterViewModel.getCount()); } } | public void decrement() { setCount(getCount() - 1); } | CounterViewModel extends BaseObservable { public void decrement() { setCount(getCount() - 1); } } | CounterViewModel extends BaseObservable { public void decrement() { setCount(getCount() - 1); } } | CounterViewModel extends BaseObservable { public void decrement() { setCount(getCount() - 1); } void increment(); void decrement(); @Bindable int getCount(); } | CounterViewModel extends BaseObservable { public void decrement() { setCount(getCount() - 1); } void increment(); void decrement(); @Bindable int getCount(); } |
@Test void helloShiro() { String username = "admin"; String password = "admin"; IniRealmDemo iniRealmDemo = new IniRealmDemo(); Assert.assertEquals(true, iniRealmDemo.helloShiro(username, password)); } | public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePasswordToken); log... | IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePass... | IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePass... | IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePass... | IniRealmDemo { public boolean helloShiro(String username, String password) { initSecurityUtils(); UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(username, password); usernamePasswordToken.setRememberMe(true); Subject currentUser = SecurityUtils.getSubject(); try { currentUser.login(usernamePass... |
@Test void removeUser() { } | @Override public void removeUser(String name) { log.warn("before remove user"); super.removeUser(name); log.warn("after remove user"); } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void removeUser(String name) { log.warn("before remove user"); super.removeUser(name); log.warn("after remove user"); } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void removeUser(String name) { log.warn("before remove user"); super.removeUser(name); log.warn("after remove user"); } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void removeUser(String name) { log.warn("before remove user"); super.removeUser(name); log.warn("after remove user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void removeUser(String name) { log.warn("before remove user"); super.removeUser(name); log.warn("after remove user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); } |
@Test void getUsername() { } | @Override public String getUsername(String name) { log.warn("before get username"); String username = super.getUsername(name); log.warn("after get username"); return username; } | StaticCglibProxyDemo extends UserServiceImpl { @Override public String getUsername(String name) { log.warn("before get username"); String username = super.getUsername(name); log.warn("after get username"); return username; } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public String getUsername(String name) { log.warn("before get username"); String username = super.getUsername(name); log.warn("after get username"); return username; } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public String getUsername(String name) { log.warn("before get username"); String username = super.getUsername(name); log.warn("after get username"); return username; } @Override void addUser(String name); @Override void removeUser(String name); @Override String ... | StaticCglibProxyDemo extends UserServiceImpl { @Override public String getUsername(String name) { log.warn("before get username"); String username = super.getUsername(name); log.warn("after get username"); return username; } @Override void addUser(String name); @Override void removeUser(String name); @Override String ... |
@Test void getUserService() { jdkProxyDemo.getUserService().addUser("xiaoming"); jdkProxyDemo.getUserService().removeUser("xiaoming"); jdkProxyDemo.getUserService().getUsername("xiaoming"); System.out.println(); jdkProxyDemo.getUserService().getClass(); } | public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } UserService getUserService(); } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } UserService getUserService(); } |
@Test void getUserService2(){ jdkProxyDemo.getUserService().getUsernameFromSelf("xiaoming"); } | public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } UserService getUserService(); } | JDKProxyDemo { public UserService getUserService(){ ProxyHandler proxyHandler = new ProxyHandler(userService); return (UserService) Proxy.newProxyInstance(proxyHandler.getClass().getClassLoader(),userService.getClass().getInterfaces(),proxyHandler); } UserService getUserService(); } |
@Test void getUserService() { cglibProxyDemo.getUserService().getUsernameFromSelf("xiaoming"); } | public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnType(),args); Obje... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... |
@Test void getUserService1() { cglibProxyDemo.getUserService().getUsername("xiaoming"); } | public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnType(),args); Obje... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... | CglibProxyDemo { public UserService getUserService(){ Enhancer en = new Enhancer(); en.setSuperclass(userService.getClass()); en.setCallback((MethodInterceptor) (arg0, method, args, arg3) -> { log.info("pre class: {} method: {} return type:{} args:{}", userService.getClass().getName(),method.getName(),method.getReturnT... |
@Test void serviceLog() { userService.getUsername("xiaomig"); } | @Pointcut("execution(public * org.laidu.learn.spring.aop.service..*(..))") public void serviceLog(){} | LogAop { @Pointcut("execution(public * org.laidu.learn.spring.aop.service..*(..))") public void serviceLog(){} } | LogAop { @Pointcut("execution(public * org.laidu.learn.spring.aop.service..*(..))") public void serviceLog(){} } | LogAop { @Pointcut("execution(public * org.laidu.learn.spring.aop.service..*(..))") public void serviceLog(){} @Pointcut("execution(* org.laidu.learn.spring.aop.service..*(..))") void serviceLog(); @Before("serviceLog()") void doBefore(JoinPoint joinPoint); @AfterReturning(returning = "ret", pointcut = "serviceLog()")... | LogAop { @Pointcut("execution(public * org.laidu.learn.spring.aop.service..*(..))") public void serviceLog(){} @Pointcut("execution(* org.laidu.learn.spring.aop.service..*(..))") void serviceLog(); @Before("serviceLog()") void doBefore(JoinPoint joinPoint); @AfterReturning(returning = "ret", pointcut = "serviceLog()")... |
@Test void getUserInfo() { UserInfo userInfo = userService.getUserInfo("xiaoming"); log.info("user info: {}", userInfo); } | @Override @Cacheable("getUserInfo") public UserInfo getUserInfo(String key) { UserInfo userInfo = redisTemplate.opsForValue().get(key); if (userInfo == null) { log.info("cache null : {}", key); userInfo = addUser("demo","demo"); } return userInfo; } | UserServiceImpl implements UserService { @Override @Cacheable("getUserInfo") public UserInfo getUserInfo(String key) { UserInfo userInfo = redisTemplate.opsForValue().get(key); if (userInfo == null) { log.info("cache null : {}", key); userInfo = addUser("demo","demo"); } return userInfo; } } | UserServiceImpl implements UserService { @Override @Cacheable("getUserInfo") public UserInfo getUserInfo(String key) { UserInfo userInfo = redisTemplate.opsForValue().get(key); if (userInfo == null) { log.info("cache null : {}", key); userInfo = addUser("demo","demo"); } return userInfo; } @Autowired UserServiceImpl(R... | UserServiceImpl implements UserService { @Override @Cacheable("getUserInfo") public UserInfo getUserInfo(String key) { UserInfo userInfo = redisTemplate.opsForValue().get(key); if (userInfo == null) { log.info("cache null : {}", key); userInfo = addUser("demo","demo"); } return userInfo; } @Autowired UserServiceImpl(R... | UserServiceImpl implements UserService { @Override @Cacheable("getUserInfo") public UserInfo getUserInfo(String key) { UserInfo userInfo = redisTemplate.opsForValue().get(key); if (userInfo == null) { log.info("cache null : {}", key); userInfo = addUser("demo","demo"); } return userInfo; } @Autowired UserServiceImpl(R... |
@Test void addUser() { UserInfo userInfo = userService.addUser("xiaoming","123123"); log.info("user info: {}", userInfo); } | @Override @Cacheable("userinfo") public UserInfo addUser(String username, String password) { return UserInfo.builder() .userId(UUID.randomUUID().toString()) .username(username) .build(); } | UserServiceImpl implements UserService { @Override @Cacheable("userinfo") public UserInfo addUser(String username, String password) { return UserInfo.builder() .userId(UUID.randomUUID().toString()) .username(username) .build(); } } | UserServiceImpl implements UserService { @Override @Cacheable("userinfo") public UserInfo addUser(String username, String password) { return UserInfo.builder() .userId(UUID.randomUUID().toString()) .username(username) .build(); } @Autowired UserServiceImpl(RedisTemplate<String, UserInfo> redisTemplate); } | UserServiceImpl implements UserService { @Override @Cacheable("userinfo") public UserInfo addUser(String username, String password) { return UserInfo.builder() .userId(UUID.randomUUID().toString()) .username(username) .build(); } @Autowired UserServiceImpl(RedisTemplate<String, UserInfo> redisTemplate); @Override @Cac... | UserServiceImpl implements UserService { @Override @Cacheable("userinfo") public UserInfo addUser(String username, String password) { return UserInfo.builder() .userId(UUID.randomUUID().toString()) .username(username) .build(); } @Autowired UserServiceImpl(RedisTemplate<String, UserInfo> redisTemplate); @Override @Cac... |
@Test void updateUsername() { IntStream.range(0,1000).parallel() .forEach( i -> { userService.updateUsername("123","xiaoming"+i); }); } | @Override public UserInfo updateUsername(String id, String username) { boolean res = false; UserInfo info = null; RLock lock = redission.getLock("lock_"+id); try { lock.lock(10, TimeUnit.SECONDS); System.out.println("got lock"); }catch (Exception e){ log.warn("获取redis锁失败! {}",id); } finally { try{ lock.unlock(); }final... | UserServiceImpl implements UserService { @Override public UserInfo updateUsername(String id, String username) { boolean res = false; UserInfo info = null; RLock lock = redission.getLock("lock_"+id); try { lock.lock(10, TimeUnit.SECONDS); System.out.println("got lock"); }catch (Exception e){ log.warn("获取redis锁失败! {}",id... | UserServiceImpl implements UserService { @Override public UserInfo updateUsername(String id, String username) { boolean res = false; UserInfo info = null; RLock lock = redission.getLock("lock_"+id); try { lock.lock(10, TimeUnit.SECONDS); System.out.println("got lock"); }catch (Exception e){ log.warn("获取redis锁失败! {}",id... | UserServiceImpl implements UserService { @Override public UserInfo updateUsername(String id, String username) { boolean res = false; UserInfo info = null; RLock lock = redission.getLock("lock_"+id); try { lock.lock(10, TimeUnit.SECONDS); System.out.println("got lock"); }catch (Exception e){ log.warn("获取redis锁失败! {}",id... | UserServiceImpl implements UserService { @Override public UserInfo updateUsername(String id, String username) { boolean res = false; UserInfo info = null; RLock lock = redission.getLock("lock_"+id); try { lock.lock(10, TimeUnit.SECONDS); System.out.println("got lock"); }catch (Exception e){ log.warn("获取redis锁失败! {}",id... |
@Test void declareQueue() throws IOException { SpringClientDemo clientDemo = new SpringClientDemo(); clientDemo.declareQueue(); } | @Override public void declareQueue() throws IOException { RabbitAdmin rabbitAdmin = rabbitAdmin(); try { rabbitAdmin.declareQueue(new Queue("demo2",false,false,false)); }catch (Exception e){ try { if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCause()).getReason()).getReplyCode()) { rabbi... | SpringClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { RabbitAdmin rabbitAdmin = rabbitAdmin(); try { rabbitAdmin.declareQueue(new Queue("demo2",false,false,false)); }catch (Exception e){ try { if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCaus... | SpringClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { RabbitAdmin rabbitAdmin = rabbitAdmin(); try { rabbitAdmin.declareQueue(new Queue("demo2",false,false,false)); }catch (Exception e){ try { if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCaus... | SpringClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { RabbitAdmin rabbitAdmin = rabbitAdmin(); try { rabbitAdmin.declareQueue(new Queue("demo2",false,false,false)); }catch (Exception e){ try { if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCaus... | SpringClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { RabbitAdmin rabbitAdmin = rabbitAdmin(); try { rabbitAdmin.declareQueue(new Queue("demo2",false,false,false)); }catch (Exception e){ try { if (406 == ((AMQImpl.Channel.Close) ((ShutdownSignalException)e.getCause().getCaus... |
@Test @DisplayName("") void sayHello() { new ExtendClass().sayHello(); } | @Override public void sayHello() { log.debug("-*--*--*--*--*--*--*--*--*-- sayHello --*--*--*--*--*--*--*--*--*-: {}","123"); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayHello() { log.debug("-*--*--*--*--*--*--*--*--*-- sayHello --*--*--*--*--*--*--*--*--*-: {}","123"); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayHello() { log.debug("-*--*--*--*--*--*--*--*--*-- sayHello --*--*--*--*--*--*--*--*--*-: {}","123"); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayHello() { log.debug("-*--*--*--*--*--*--*--*--*-- sayHello --*--*--*--*--*--*--*--*--*-: {}","123"); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayHello() { log.debug("-*--*--*--*--*--*--*--*--*-- sayHello --*--*--*--*--*--*--*--*--*-: {}","123"); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } |
@Test void sayBye() { } | @Override public void sayBye() { ((InterfaceA) () -> log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good")).sayBye(); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayBye() { ((InterfaceA) () -> log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good")).sayBye(); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayBye() { ((InterfaceA) () -> log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good")).sayBye(); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayBye() { ((InterfaceA) () -> log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good")).sayBye(); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayBye() { ((InterfaceA) () -> log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good")).sayBye(); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } |
@Test void sayGood() { } | @Override public void sayGood() { log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good"); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayGood() { log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good"); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayGood() { log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good"); } } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayGood() { log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good"); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } | ExtendClass implements InterfaceA,InterfaceB { @Override public void sayGood() { log.debug("-*--*--*--*--*--*--*--*--*-- sayGood --*--*--*--*--*--*--*--*--*-: {}","good"); } @Override void sayHello(); @Override void sayBye(); @Override void sayGood(); static void main(String[] args); } |
@Test void list2String() { log.info("string result: {}", ListStreamDemo.list2String(list)); } | public static String list2String(List<String> list){ return list.parallelStream().collect(Collectors.joining(",")); } | ListStreamDemo { public static String list2String(List<String> list){ return list.parallelStream().collect(Collectors.joining(",")); } } | ListStreamDemo { public static String list2String(List<String> list){ return list.parallelStream().collect(Collectors.joining(",")); } } | ListStreamDemo { public static String list2String(List<String> list){ return list.parallelStream().collect(Collectors.joining(",")); } static String list2String(List<String> list); static String list2String2(List<String> list); static List<Student> distinctBy(List<Student> students); } | ListStreamDemo { public static String list2String(List<String> list){ return list.parallelStream().collect(Collectors.joining(",")); } static String list2String(List<String> list); static String list2String2(List<String> list); static List<Student> distinctBy(List<Student> students); } |
@Test void list2String2() { log.info("String2 result: {}", ListStreamDemo.list2String2(list)); } | public static String list2String2(List<String> list){ return String.join(",",list); } | ListStreamDemo { public static String list2String2(List<String> list){ return String.join(",",list); } } | ListStreamDemo { public static String list2String2(List<String> list){ return String.join(",",list); } } | ListStreamDemo { public static String list2String2(List<String> list){ return String.join(",",list); } static String list2String(List<String> list); static String list2String2(List<String> list); static List<Student> distinctBy(List<Student> students); } | ListStreamDemo { public static String list2String2(List<String> list){ return String.join(",",list); } static String list2String(List<String> list); static String list2String2(List<String> list); static List<Student> distinctBy(List<Student> students); } |
@Test @DisplayName("java 8 新增方法") void join() { String var = "123123"; var = String.join(":", "a","b","c"); log.info("-*--*--*--*- var: {} -*--*--*--*--",var); } | public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } static String join(Cha... | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } static String join(Cha... |
@Test void join1() { String var = "123123"; List<CharSequence> charSequences = Arrays.asList("a","b","c"); var = String.join("-",charSequences); log.info("-*--*--*--*- var: {} -*--*--*--*--",var); } | public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } } | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } static String join(Cha... | StringPartMethod { public static String join(CharSequence delimiter, CharSequence... elements) { Objects.requireNonNull(delimiter); Objects.requireNonNull(elements); StringJoiner joiner = new StringJoiner(delimiter); for (CharSequence cs: elements) { joiner.add(cs); } return joiner.toString(); } static String join(Cha... |
@Test void getHeaders() { CurlParserUtil.getInstance().getHeaders(curlLine); } | public Map<String, String> getHeaders(String curlLine) { Map<String, String> keyValuePairs = keyValuePairs(curlLine); keyValuePairs.remove("Content-Length"); return keyValuePairs; } | CurlParserUtil { public Map<String, String> getHeaders(String curlLine) { Map<String, String> keyValuePairs = keyValuePairs(curlLine); keyValuePairs.remove("Content-Length"); return keyValuePairs; } } | CurlParserUtil { public Map<String, String> getHeaders(String curlLine) { Map<String, String> keyValuePairs = keyValuePairs(curlLine); keyValuePairs.remove("Content-Length"); return keyValuePairs; } private CurlParserUtil(); } | CurlParserUtil { public Map<String, String> getHeaders(String curlLine) { Map<String, String> keyValuePairs = keyValuePairs(curlLine); keyValuePairs.remove("Content-Length"); return keyValuePairs; } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(String curlLine); Map<Stri... | CurlParserUtil { public Map<String, String> getHeaders(String curlLine) { Map<String, String> keyValuePairs = keyValuePairs(curlLine); keyValuePairs.remove("Content-Length"); return keyValuePairs; } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(String curlLine); Map<Stri... |
@Test void getCookies() { CurlParserUtil.getInstance().getCookies(curlLine).forEach((k,v) -> System.out.println(k + " : " + v)); } | public Map<String, String> getCookies(String curlLine) { Map<String, String> cookieMap = new HashMap<>(); StringBuilder cookiesString = new StringBuilder(); cookiesString.append(getHeaders(curlLine).get("Cookie")); cookiesString.append(getBCookiesString(curlLine)); if (StringUtil.isNotBlank(cookiesString.toString())) {... | CurlParserUtil { public Map<String, String> getCookies(String curlLine) { Map<String, String> cookieMap = new HashMap<>(); StringBuilder cookiesString = new StringBuilder(); cookiesString.append(getHeaders(curlLine).get("Cookie")); cookiesString.append(getBCookiesString(curlLine)); if (StringUtil.isNotBlank(cookiesStri... | CurlParserUtil { public Map<String, String> getCookies(String curlLine) { Map<String, String> cookieMap = new HashMap<>(); StringBuilder cookiesString = new StringBuilder(); cookiesString.append(getHeaders(curlLine).get("Cookie")); cookiesString.append(getBCookiesString(curlLine)); if (StringUtil.isNotBlank(cookiesStri... | CurlParserUtil { public Map<String, String> getCookies(String curlLine) { Map<String, String> cookieMap = new HashMap<>(); StringBuilder cookiesString = new StringBuilder(); cookiesString.append(getHeaders(curlLine).get("Cookie")); cookiesString.append(getBCookiesString(curlLine)); if (StringUtil.isNotBlank(cookiesStri... | CurlParserUtil { public Map<String, String> getCookies(String curlLine) { Map<String, String> cookieMap = new HashMap<>(); StringBuilder cookiesString = new StringBuilder(); cookiesString.append(getHeaders(curlLine).get("Cookie")); cookiesString.append(getBCookiesString(curlLine)); if (StringUtil.isNotBlank(cookiesStri... |
@Test void getMethod() { Assert.assertEquals("POST",CurlParserUtil.getInstance().getMethod(curlLine)); } | public String getMethod(String curlLine) { String methodPattern = "-X \\$'([A-Z]{2,5})'"; int methodIndex = 1; return RegexUtil.getInstance().getMacthResult(methodPattern, curlLine, methodIndex, "GET"); } | CurlParserUtil { public String getMethod(String curlLine) { String methodPattern = "-X \\$'([A-Z]{2,5})'"; int methodIndex = 1; return RegexUtil.getInstance().getMacthResult(methodPattern, curlLine, methodIndex, "GET"); } } | CurlParserUtil { public String getMethod(String curlLine) { String methodPattern = "-X \\$'([A-Z]{2,5})'"; int methodIndex = 1; return RegexUtil.getInstance().getMacthResult(methodPattern, curlLine, methodIndex, "GET"); } private CurlParserUtil(); } | CurlParserUtil { public String getMethod(String curlLine) { String methodPattern = "-X \\$'([A-Z]{2,5})'"; int methodIndex = 1; return RegexUtil.getInstance().getMacthResult(methodPattern, curlLine, methodIndex, "GET"); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(Str... | CurlParserUtil { public String getMethod(String curlLine) { String methodPattern = "-X \\$'([A-Z]{2,5})'"; int methodIndex = 1; return RegexUtil.getInstance().getMacthResult(methodPattern, curlLine, methodIndex, "GET"); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(Str... |
@Test void connectionFactory() { } | public ConnectionFactory connectionFactory(){ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("dev"); connectionFactory.setPort(5672); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); connectionFactory.setVirtualHost("/learn"); return connectionFac... | RabbitmqClientDemo implements ClientDemo { public ConnectionFactory connectionFactory(){ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("dev"); connectionFactory.setPort(5672); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); connectionFactory.set... | RabbitmqClientDemo implements ClientDemo { public ConnectionFactory connectionFactory(){ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("dev"); connectionFactory.setPort(5672); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); connectionFactory.set... | RabbitmqClientDemo implements ClientDemo { public ConnectionFactory connectionFactory(){ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("dev"); connectionFactory.setPort(5672); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); connectionFactory.set... | RabbitmqClientDemo implements ClientDemo { public ConnectionFactory connectionFactory(){ ConnectionFactory connectionFactory = new ConnectionFactory(); connectionFactory.setHost("dev"); connectionFactory.setPort(5672); connectionFactory.setUsername("admin"); connectionFactory.setPassword("admin"); connectionFactory.set... |
@Test void getUrl() { Assert.assertEquals("http: } | public String getUrl(String curlLine) { String urlPattern = "\\$'(https?: int urlIndex = 1; return RegexUtil.getInstance().getMacthResult(urlPattern, curlLine, urlIndex); } | CurlParserUtil { public String getUrl(String curlLine) { String urlPattern = "\\$'(https?: int urlIndex = 1; return RegexUtil.getInstance().getMacthResult(urlPattern, curlLine, urlIndex); } } | CurlParserUtil { public String getUrl(String curlLine) { String urlPattern = "\\$'(https?: int urlIndex = 1; return RegexUtil.getInstance().getMacthResult(urlPattern, curlLine, urlIndex); } private CurlParserUtil(); } | CurlParserUtil { public String getUrl(String curlLine) { String urlPattern = "\\$'(https?: int urlIndex = 1; return RegexUtil.getInstance().getMacthResult(urlPattern, curlLine, urlIndex); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(String curlLine); Map<String, Strin... | CurlParserUtil { public String getUrl(String curlLine) { String urlPattern = "\\$'(https?: int urlIndex = 1; return RegexUtil.getInstance().getMacthResult(urlPattern, curlLine, urlIndex); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, String> getHeaders(String curlLine); Map<String, Strin... |
@Test void getBodyString() { String dataString = "jlX3dWILl/dMQ+wc0JAMHlKhylfeLb19HyBcb/QKcPKRMtB5Ri77QJ2OpC6P8Rp/aai3j7awGyo1SD/MckKxnHTeGnUIh9Uopg7S+4Db1n8hVV9vsQMLrmZy+0VCnGFgVuTWYvMgiow9+tZJFFdQ549IhLmXBs4Lm3UkEtzpfvwfdoCZC9vAaTbvc6YrGFk9vTRUag3oT+Wlm+RY8KaejV7JXCzV4+jA98GFbVTAn4yNuPIyIoHyhoELsnvMwlbuVmftKn0DDlVWM7... | public String getBodyString(String curlLine) { String stringBodyPattern = "--data-binary \\$'([^\\$]*)'"; int stringBodyIndex = 1; return RegexUtil.getInstance().getMacthResult(stringBodyPattern, curlLine, stringBodyIndex); } | CurlParserUtil { public String getBodyString(String curlLine) { String stringBodyPattern = "--data-binary \\$'([^\\$]*)'"; int stringBodyIndex = 1; return RegexUtil.getInstance().getMacthResult(stringBodyPattern, curlLine, stringBodyIndex); } } | CurlParserUtil { public String getBodyString(String curlLine) { String stringBodyPattern = "--data-binary \\$'([^\\$]*)'"; int stringBodyIndex = 1; return RegexUtil.getInstance().getMacthResult(stringBodyPattern, curlLine, stringBodyIndex); } private CurlParserUtil(); } | CurlParserUtil { public String getBodyString(String curlLine) { String stringBodyPattern = "--data-binary \\$'([^\\$]*)'"; int stringBodyIndex = 1; return RegexUtil.getInstance().getMacthResult(stringBodyPattern, curlLine, stringBodyIndex); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, S... | CurlParserUtil { public String getBodyString(String curlLine) { String stringBodyPattern = "--data-binary \\$'([^\\$]*)'"; int stringBodyIndex = 1; return RegexUtil.getInstance().getMacthResult(stringBodyPattern, curlLine, stringBodyIndex); } private CurlParserUtil(); static CurlParserUtil getInstance(); Map<String, S... |
@Test void getFormBody() { CurlParserUtil.getInstance().getFormBody(curlLine).forEach((k,v) -> System.out.println(k + " : " + v)); } | public Map<String, String> getFormBody(String curlLine) { Map<String, String> formMap = new HashMap<>(); String formBodyString = getBodyString(curlLine); String formDataPattern = "([^=&]+=[^&']*)+"; int formDataIndex = 1; List<String> formStringList = RegexUtil.getInstance().getMacthAllResult(formDataPattern, formBodyS... | CurlParserUtil { public Map<String, String> getFormBody(String curlLine) { Map<String, String> formMap = new HashMap<>(); String formBodyString = getBodyString(curlLine); String formDataPattern = "([^=&]+=[^&']*)+"; int formDataIndex = 1; List<String> formStringList = RegexUtil.getInstance().getMacthAllResult(formDataP... | CurlParserUtil { public Map<String, String> getFormBody(String curlLine) { Map<String, String> formMap = new HashMap<>(); String formBodyString = getBodyString(curlLine); String formDataPattern = "([^=&]+=[^&']*)+"; int formDataIndex = 1; List<String> formStringList = RegexUtil.getInstance().getMacthAllResult(formDataP... | CurlParserUtil { public Map<String, String> getFormBody(String curlLine) { Map<String, String> formMap = new HashMap<>(); String formBodyString = getBodyString(curlLine); String formDataPattern = "([^=&]+=[^&']*)+"; int formDataIndex = 1; List<String> formStringList = RegexUtil.getInstance().getMacthAllResult(formDataP... | CurlParserUtil { public Map<String, String> getFormBody(String curlLine) { Map<String, String> formMap = new HashMap<>(); String formBodyString = getBodyString(curlLine); String formDataPattern = "([^=&]+=[^&']*)+"; int formDataIndex = 1; List<String> formStringList = RegexUtil.getInstance().getMacthAllResult(formDataP... |
@Test void obj2Xml() throws JAXBException, UnsupportedEncodingException { List<String> names = new ArrayList<>(); names.add("123"); names.add("123"); names.add("123"); names.add("123"); Person person = Person.builder() .name("xiaoming/name>aadsadsa]") .dsaa(names) .sex("nam") .build(); List<Person> people = new ArrayLi... | public String obj2Xml(Object obj) throws JAXBException, UnsupportedEncodingException { ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATT... | JAXBUtil { public String obj2Xml(Object obj) throws JAXBException, UnsupportedEncodingException { ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.J... | JAXBUtil { public String obj2Xml(Object obj) throws JAXBException, UnsupportedEncodingException { ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.J... | JAXBUtil { public String obj2Xml(Object obj) throws JAXBException, UnsupportedEncodingException { ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.J... | JAXBUtil { public String obj2Xml(Object obj) throws JAXBException, UnsupportedEncodingException { ByteArrayOutputStream os = new ByteArrayOutputStream(); JAXBContext jaxbContext = JAXBContext.newInstance(obj.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.setProperty(Marshaller.J... |
@Test void xml2Obj() throws JAXBException { String xmlSource = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<persons>\n" + " <person>\n" + " <dsaa>123</dsaa>\n" + " <dsaa>123</dsaa>\n" + " <dsaa>123</dsaa>\n" + " <dsaa>123</dsaa>\n" + " <name>xiaoming/name>aadsadsa]</name>\n" + " <sex>nam</se... | public <T> T xml2Obj(String xmlSource, Class<T> clazz) throws JAXBException { JAXBContext context; context = JAXBContext.newInstance(clazz); Unmarshaller unmarshal = context.createUnmarshaller(); T obj = (T) unmarshal.unmarshal(new StringReader(xmlSource)); return obj; } | JAXBUtil { public <T> T xml2Obj(String xmlSource, Class<T> clazz) throws JAXBException { JAXBContext context; context = JAXBContext.newInstance(clazz); Unmarshaller unmarshal = context.createUnmarshaller(); T obj = (T) unmarshal.unmarshal(new StringReader(xmlSource)); return obj; } } | JAXBUtil { public <T> T xml2Obj(String xmlSource, Class<T> clazz) throws JAXBException { JAXBContext context; context = JAXBContext.newInstance(clazz); Unmarshaller unmarshal = context.createUnmarshaller(); T obj = (T) unmarshal.unmarshal(new StringReader(xmlSource)); return obj; } private JAXBUtil(); } | JAXBUtil { public <T> T xml2Obj(String xmlSource, Class<T> clazz) throws JAXBException { JAXBContext context; context = JAXBContext.newInstance(clazz); Unmarshaller unmarshal = context.createUnmarshaller(); T obj = (T) unmarshal.unmarshal(new StringReader(xmlSource)); return obj; } private JAXBUtil(); static JAXBUtil ... | JAXBUtil { public <T> T xml2Obj(String xmlSource, Class<T> clazz) throws JAXBException { JAXBContext context; context = JAXBContext.newInstance(clazz); Unmarshaller unmarshal = context.createUnmarshaller(); T obj = (T) unmarshal.unmarshal(new StringReader(xmlSource)); return obj; } private JAXBUtil(); static JAXBUtil ... |
@Test void getMacthAllResult() { } | public List<String> getMacthAllResult(String regex, String source, int index) { return getMacthAllResult(Pattern.compile(regex),source,index); } | RegexUtil { public List<String> getMacthAllResult(String regex, String source, int index) { return getMacthAllResult(Pattern.compile(regex),source,index); } } | RegexUtil { public List<String> getMacthAllResult(String regex, String source, int index) { return getMacthAllResult(Pattern.compile(regex),source,index); } private RegexUtil(); } | RegexUtil { public List<String> getMacthAllResult(String regex, String source, int index) { return getMacthAllResult(Pattern.compile(regex),source,index); } private RegexUtil(); static RegexUtil getInstance(); List<String> getMacthAllResult(String regex, String source, int index); List<String> getMacthAllResult(Patter... | RegexUtil { public List<String> getMacthAllResult(String regex, String source, int index) { return getMacthAllResult(Pattern.compile(regex),source,index); } private RegexUtil(); static RegexUtil getInstance(); List<String> getMacthAllResult(String regex, String source, int index); List<String> getMacthAllResult(Patter... |
@Test void getMacthResult() { String exected = "uuid_tt_dd=1449951587432284316_20171009; bdshare_firstime=1507526697430; _JQCMT_ifcookie=1; _JQCMT_browser=9b9bfcf50ae6c14645788efed25613f9; UN=weixin_38032099; UE=\\\"\\\"; BT=1509089267060; ADHOC_MEMBERSHIP_CLIENT_ID1.0=f4889c67-3d52-6eb3-6cb4-e7a329d9b3c5; Hm_ct_6bcd52... | public String getMacthResult(String regex, String source, int index) { return getMacthResult(regex,source,index,null); } | RegexUtil { public String getMacthResult(String regex, String source, int index) { return getMacthResult(regex,source,index,null); } } | RegexUtil { public String getMacthResult(String regex, String source, int index) { return getMacthResult(regex,source,index,null); } private RegexUtil(); } | RegexUtil { public String getMacthResult(String regex, String source, int index) { return getMacthResult(regex,source,index,null); } private RegexUtil(); static RegexUtil getInstance(); List<String> getMacthAllResult(String regex, String source, int index); List<String> getMacthAllResult(Pattern pattern, String source... | RegexUtil { public String getMacthResult(String regex, String source, int index) { return getMacthResult(regex,source,index,null); } private RegexUtil(); static RegexUtil getInstance(); List<String> getMacthAllResult(String regex, String source, int index); List<String> getMacthAllResult(Pattern pattern, String source... |
@Test void cbcEncrypt() throws DecoderException { byte[] result = AESEncryptionUtil.getInstance().cbcEncrypt(palaintext.getBytes(), key.getBytes(), Base64.decode(ivp)); log.info("result 's value : {}", result); Assert.assertEquals(URLDecoder.decode(cryptograph), Base64.encodeToString(result)); } | public byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } | AESEncryptionUtil { public byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } } | AESEncryptionUtil { public byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); } | AESEncryptionUtil { public byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key,... | AESEncryptionUtil { public byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key,... |
@Test void cbcDecrypt() throws Exception { byte[] result = AESEncryptionUtil.getInstance().cbcDecrypt(Base64.decode(cryptograph), key.getBytes(), Base64.decode(ivp)); log.info("result 's value : {}", new String(result)); Assert.assertEquals(URLDecoder.decode(palaintext), new String(result)); } | public byte[] cbcDecrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } | AESEncryptionUtil { public byte[] cbcDecrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } } | AESEncryptionUtil { public byte[] cbcDecrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); } | AESEncryptionUtil { public byte[] cbcDecrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key,... | AESEncryptionUtil { public byte[] cbcDecrypt(byte[] data, byte[] key, byte[] ivp) { return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_CBC_KEY, key, ivp, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key,... |
@Test void ecbDecrypt() throws DecoderException, UnsupportedEncodingException { String source = "1d6ca0a793eba254b4950253b11b7897860c497ee6cae7f3b2d8035beccb5ab41411467a32786a72a7b2809952fa5a804a37a4028f72b48cd7e22bc3d400b43358f40c327900dff1dc14c322506b4aba87375aa7e0d3b6689eb52fd06ba30ae3"; String key = "q9YCl%!3*m#d&3... | public byte[] ecbDecrypt(byte[] data, byte[] key){ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_ECB_KEY, key, null, data); } | AESEncryptionUtil { public byte[] ecbDecrypt(byte[] data, byte[] key){ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_ECB_KEY, key, null, data); } } | AESEncryptionUtil { public byte[] ecbDecrypt(byte[] data, byte[] key){ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_ECB_KEY, key, null, data); } private AESEncryptionUtil(); } | AESEncryptionUtil { public byte[] ecbDecrypt(byte[] data, byte[] key){ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_ECB_KEY, key, null, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp)... | AESEncryptionUtil { public byte[] ecbDecrypt(byte[] data, byte[] key){ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGORITHM, HelperHolder.ALGORITHM_ECB_KEY, key, null, data); } private AESEncryptionUtil(); static AESEncryptionUtil getInstance(); byte[] cbcEncrypt(byte[] data, byte[] key, byte[] ivp)... |
@Test void connection() { } | public Connection connection(ConnectionFactory connectionFactory){ Connection connection = null; try { connection = connectionFactory.newConnection(); } catch (Exception e) { log.error("connection create error", e); } return connection; } | RabbitmqClientDemo implements ClientDemo { public Connection connection(ConnectionFactory connectionFactory){ Connection connection = null; try { connection = connectionFactory.newConnection(); } catch (Exception e) { log.error("connection create error", e); } return connection; } } | RabbitmqClientDemo implements ClientDemo { public Connection connection(ConnectionFactory connectionFactory){ Connection connection = null; try { connection = connectionFactory.newConnection(); } catch (Exception e) { log.error("connection create error", e); } return connection; } } | RabbitmqClientDemo implements ClientDemo { public Connection connection(ConnectionFactory connectionFactory){ Connection connection = null; try { connection = connectionFactory.newConnection(); } catch (Exception e) { log.error("connection create error", e); } return connection; } ConnectionFactory connectionFactory()... | RabbitmqClientDemo implements ClientDemo { public Connection connection(ConnectionFactory connectionFactory){ Connection connection = null; try { connection = connectionFactory.newConnection(); } catch (Exception e) { log.error("connection create error", e); } return connection; } ConnectionFactory connectionFactory()... |
@Test void toMd5() { } | public String toMd5(String origin){ String re_md5 = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(origin.getBytes()); byte b[] = md.digest(); md = null; int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) { i += 256; } ... | MD5Util { public String toMd5(String origin){ String re_md5 = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(origin.getBytes()); byte b[] = md.digest(); md = null; int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) { i ... | MD5Util { public String toMd5(String origin){ String re_md5 = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(origin.getBytes()); byte b[] = md.digest(); md = null; int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) { i ... | MD5Util { public String toMd5(String origin){ String re_md5 = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(origin.getBytes()); byte b[] = md.digest(); md = null; int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) { i ... | MD5Util { public String toMd5(String origin){ String re_md5 = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(origin.getBytes()); byte b[] = md.digest(); md = null; int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) { i ... |
@Test void getpublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException { bigIntModulus = new BigInteger("bcd32d940d9b013a26767c2a60817a275c688cce324f421e40cb4282bb4f914171c7d362d3ecd651c7391ab1999b1b8a440058a869b53c481d9482370d92afc97b2cb955beb214186a060913748140280e9ecbd4af9cac2765efbc6f7a4c5f5d7b2ab183e7e... | public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Ob... | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Ob... |
@Test void getPrivateKey() { } | public RSAPrivateKey getPrivateKey(Map<String, Object> keyMap){ RSAPrivateKey privateKey = (RSAPrivateKey) keyMap.get(HelperHolder.PRIVATE_KEY); return privateKey; } | RSAencryptionUtil { public RSAPrivateKey getPrivateKey(Map<String, Object> keyMap){ RSAPrivateKey privateKey = (RSAPrivateKey) keyMap.get(HelperHolder.PRIVATE_KEY); return privateKey; } } | RSAencryptionUtil { public RSAPrivateKey getPrivateKey(Map<String, Object> keyMap){ RSAPrivateKey privateKey = (RSAPrivateKey) keyMap.get(HelperHolder.PRIVATE_KEY); return privateKey; } private RSAencryptionUtil(); } | RSAencryptionUtil { public RSAPrivateKey getPrivateKey(Map<String, Object> keyMap){ RSAPrivateKey privateKey = (RSAPrivateKey) keyMap.get(HelperHolder.PRIVATE_KEY); return privateKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<Str... | RSAencryptionUtil { public RSAPrivateKey getPrivateKey(Map<String, Object> keyMap){ RSAPrivateKey privateKey = (RSAPrivateKey) keyMap.get(HelperHolder.PRIVATE_KEY); return privateKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<Str... |
@Test void encrypt() throws NoSuchAlgorithmException, InvalidKeySpecException { bigIntModulus = new BigInteger("8a3706d24b5f0f0fe96afe4b6180d851bf892612b86a0bd5fe54b3ec6c0151a2307e1e2a21c7bbae0fec5ca317c1e81bdc28abcf776fd62c385594ec6c2859569735591bbac268fdfc7bbee37600e601526d9999b2696fead3d7f147c76dc15aa2c0fb6935478159... | public byte[] encrypt(byte[] data, RSAPublicKey publicKey){ return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGOROTHM_KEY,publicKey,data); } | RSAencryptionUtil { public byte[] encrypt(byte[] data, RSAPublicKey publicKey){ return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGOROTHM_KEY,publicKey,data); } } | RSAencryptionUtil { public byte[] encrypt(byte[] data, RSAPublicKey publicKey){ return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGOROTHM_KEY,publicKey,data); } private RSAencryptionUtil(); } | RSAencryptionUtil { public byte[] encrypt(byte[] data, RSAPublicKey publicKey){ return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGOROTHM_KEY,publicKey,data); } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Object... | RSAencryptionUtil { public byte[] encrypt(byte[] data, RSAPublicKey publicKey){ return BasicEncryptionUtil.getInstance().encrypt(HelperHolder.ALGOROTHM_KEY,publicKey,data); } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Object... |
@Test void decrypt() throws Exception { } | public byte[] decrypt(byte[] data, RSAPrivateKey privateKey) throws Exception{ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGOROTHM_KEY,privateKey,data); } | RSAencryptionUtil { public byte[] decrypt(byte[] data, RSAPrivateKey privateKey) throws Exception{ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGOROTHM_KEY,privateKey,data); } } | RSAencryptionUtil { public byte[] decrypt(byte[] data, RSAPrivateKey privateKey) throws Exception{ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGOROTHM_KEY,privateKey,data); } private RSAencryptionUtil(); } | RSAencryptionUtil { public byte[] decrypt(byte[] data, RSAPrivateKey privateKey) throws Exception{ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGOROTHM_KEY,privateKey,data); } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKe... | RSAencryptionUtil { public byte[] decrypt(byte[] data, RSAPrivateKey privateKey) throws Exception{ return BasicEncryptionUtil.getInstance().decrypt(HelperHolder.ALGOROTHM_KEY,privateKey,data); } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKe... |
@Test void getPublicKey() throws Exception { X509EncodedKeySpec keySpec = new X509EncodedKeySpec(Base64.decode("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKNwbSS18PD+lq/kthgNhRv4kmErhqC9X+VLPsbAFRojB+Hiohx7uuD+xcoxfB6BvcKKvPd2/WLDhVlOxsKFlWlzVZG7rCaP38e77jdgDmAVJtmZmyaW/q09fxR8dtwVqiwPtpNUeBWWh1lrtUarY8cQ8KFg5tNYqvqQJ9bN3T... | public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); } | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Ob... | RSAencryptionUtil { public RSAPublicKey getpublicKey(Map<String, Object> keyMap){ RSAPublicKey publicKey = (RSAPublicKey) keyMap.get(HelperHolder.PUBLIC_KEY); return publicKey; } private RSAencryptionUtil(); static RSAencryptionUtil getInstance(); Map<String, Object> initKey(); RSAPublicKey getpublicKey(Map<String, Ob... |
@Test void find() { Random random = new Random(); inputs.forEach(array -> { int randomInt = random.nextInt(40)*10; boolean reault = SearchInDoubleDimArray.findByBinarySearch(randomInt,array); System.out.println(randomInt + " result " + reault); }); } | public static boolean findByBinarySearch(int target, int [][] array) { if (array.length <= 0){ return false; } if (array[0].length <= 0){ return false; } int rowSize = array.length; int rankSize = array[0].length; if (target < array[0][0] || target > array[rowSize-1][rankSize-1]){ return false; } AtomicBoolean result =... | SearchInDoubleDimArray { public static boolean findByBinarySearch(int target, int [][] array) { if (array.length <= 0){ return false; } if (array[0].length <= 0){ return false; } int rowSize = array.length; int rankSize = array[0].length; if (target < array[0][0] || target > array[rowSize-1][rankSize-1]){ return false;... | SearchInDoubleDimArray { public static boolean findByBinarySearch(int target, int [][] array) { if (array.length <= 0){ return false; } if (array[0].length <= 0){ return false; } int rowSize = array.length; int rankSize = array[0].length; if (target < array[0][0] || target > array[rowSize-1][rankSize-1]){ return false;... | SearchInDoubleDimArray { public static boolean findByBinarySearch(int target, int [][] array) { if (array.length <= 0){ return false; } if (array[0].length <= 0){ return false; } int rowSize = array.length; int rankSize = array[0].length; if (target < array[0][0] || target > array[rowSize-1][rankSize-1]){ return false;... | SearchInDoubleDimArray { public static boolean findByBinarySearch(int target, int [][] array) { if (array.length <= 0){ return false; } if (array[0].length <= 0){ return false; } int rowSize = array.length; int rankSize = array[0].length; if (target < array[0][0] || target > array[rowSize-1][rankSize-1]){ return false;... |
@Test void calculate() { String expression = "(2+(2*4))"; int expected = 10; int result = doubleStackArithmeticExpression.calculate(expression); Assert.assertEquals(expected,result); } | public int calculate(String expression){ Stack<Integer> vals = new Stack<>(); Stack<Character> op = new Stack<>(); for (char var : expression.toCharArray()){ } return 0; } | DoubleStackArithmeticExpression { public int calculate(String expression){ Stack<Integer> vals = new Stack<>(); Stack<Character> op = new Stack<>(); for (char var : expression.toCharArray()){ } return 0; } } | DoubleStackArithmeticExpression { public int calculate(String expression){ Stack<Integer> vals = new Stack<>(); Stack<Character> op = new Stack<>(); for (char var : expression.toCharArray()){ } return 0; } } | DoubleStackArithmeticExpression { public int calculate(String expression){ Stack<Integer> vals = new Stack<>(); Stack<Character> op = new Stack<>(); for (char var : expression.toCharArray()){ } return 0; } int calculate(String expression); } | DoubleStackArithmeticExpression { public int calculate(String expression){ Stack<Integer> vals = new Stack<>(); Stack<Character> op = new Stack<>(); for (char var : expression.toCharArray()){ } return 0; } int calculate(String expression); } |
@Test void test1() { Assert.assertEquals(3, firstMissingPositive.firstMissingPositive(new int[]{1,2,0})); Assert.assertEquals(2, firstMissingPositive.firstMissingPositive(new int[]{3,4,-1,1})); Assert.assertEquals(1, firstMissingPositive.firstMissingPositive(new int[]{7,8,9,11,12})); } | public int firstMissingPositive(int[] nums) { int n = nums.length; if (n == 0) { return 1; } if (n == 1) { return nums[0] == 1 ? 2 : 1; } for (int i = 0; i < n; i++) { while (nums[i] > 0 && nums[i] < n && nums[i] != nums[nums[i]]) { swap(nums, i, nums[i]); } } for (int i = 1; i < n; i++) { if (nums[i] != i) { return i;... | FirstMissingPositive { public int firstMissingPositive(int[] nums) { int n = nums.length; if (n == 0) { return 1; } if (n == 1) { return nums[0] == 1 ? 2 : 1; } for (int i = 0; i < n; i++) { while (nums[i] > 0 && nums[i] < n && nums[i] != nums[nums[i]]) { swap(nums, i, nums[i]); } } for (int i = 1; i < n; i++) { if (nu... | FirstMissingPositive { public int firstMissingPositive(int[] nums) { int n = nums.length; if (n == 0) { return 1; } if (n == 1) { return nums[0] == 1 ? 2 : 1; } for (int i = 0; i < n; i++) { while (nums[i] > 0 && nums[i] < n && nums[i] != nums[nums[i]]) { swap(nums, i, nums[i]); } } for (int i = 1; i < n; i++) { if (nu... | FirstMissingPositive { public int firstMissingPositive(int[] nums) { int n = nums.length; if (n == 0) { return 1; } if (n == 1) { return nums[0] == 1 ? 2 : 1; } for (int i = 0; i < n; i++) { while (nums[i] > 0 && nums[i] < n && nums[i] != nums[nums[i]]) { swap(nums, i, nums[i]); } } for (int i = 1; i < n; i++) { if (nu... | FirstMissingPositive { public int firstMissingPositive(int[] nums) { int n = nums.length; if (n == 0) { return 1; } if (n == 1) { return nums[0] == 1 ? 2 : 1; } for (int i = 0; i < n; i++) { while (nums[i] > 0 && nums[i] < n && nums[i] != nums[nums[i]]) { swap(nums, i, nums[i]); } } for (int i = 1; i < n; i++) { if (nu... |
@Test void firstMissingPositive2() { Assert.assertEquals(3, firstMissingPositive.firstMissingPositive2(new int[]{1,2,0})); Assert.assertEquals(2, firstMissingPositive.firstMissingPositive2(new int[]{3,4,-1,1})); Assert.assertEquals(1, firstMissingPositive.firstMissingPositive2(new int[]{7,8,9,11,12})); } | public int firstMissingPositive2(int[] nums) { if (nums.length == 0) { return 1; } if (nums.length == 1) { return nums[0] == 1 ? 2 : 1; } int min = 1; while (contain(nums, min) || min < 1) { ++min; } return min; } | FirstMissingPositive { public int firstMissingPositive2(int[] nums) { if (nums.length == 0) { return 1; } if (nums.length == 1) { return nums[0] == 1 ? 2 : 1; } int min = 1; while (contain(nums, min) || min < 1) { ++min; } return min; } } | FirstMissingPositive { public int firstMissingPositive2(int[] nums) { if (nums.length == 0) { return 1; } if (nums.length == 1) { return nums[0] == 1 ? 2 : 1; } int min = 1; while (contain(nums, min) || min < 1) { ++min; } return min; } } | FirstMissingPositive { public int firstMissingPositive2(int[] nums) { if (nums.length == 0) { return 1; } if (nums.length == 1) { return nums[0] == 1 ? 2 : 1; } int min = 1; while (contain(nums, min) || min < 1) { ++min; } return min; } int firstMissingPositive(int[] nums); int firstMissingPositive2(int[] nums); } | FirstMissingPositive { public int firstMissingPositive2(int[] nums) { if (nums.length == 0) { return 1; } if (nums.length == 1) { return nums[0] == 1 ? 2 : 1; } int min = 1; while (contain(nums, min) || min < 1) { ++min; } return min; } int firstMissingPositive(int[] nums); int firstMissingPositive2(int[] nums); } |
@Test void declareQueue() throws IOException { new RabbitmqClientDemo().declareQueue(); } | @Override public void declareQueue() throws IOException { Connection connection = connection(connectionFactory()); Channel channel = connection.createChannel(); try { channel.queueDeclare("demo1",true,false,false,null); }catch (IOException e){ if ("406".equals(((AMQImpl.Channel.Close) (((ShutdownSignalException)e.getCa... | RabbitmqClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { Connection connection = connection(connectionFactory()); Channel channel = connection.createChannel(); try { channel.queueDeclare("demo1",true,false,false,null); }catch (IOException e){ if ("406".equals(((AMQImpl.Channe... | RabbitmqClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { Connection connection = connection(connectionFactory()); Channel channel = connection.createChannel(); try { channel.queueDeclare("demo1",true,false,false,null); }catch (IOException e){ if ("406".equals(((AMQImpl.Channe... | RabbitmqClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { Connection connection = connection(connectionFactory()); Channel channel = connection.createChannel(); try { channel.queueDeclare("demo1",true,false,false,null); }catch (IOException e){ if ("406".equals(((AMQImpl.Channe... | RabbitmqClientDemo implements ClientDemo { @Override public void declareQueue() throws IOException { Connection connection = connection(connectionFactory()); Channel channel = connection.createChannel(); try { channel.queueDeclare("demo1",true,false,false,null); }catch (IOException e){ if ("406".equals(((AMQImpl.Channe... |
@Test void twoSum() { } | public int[] twoSum(int[] nums, int target) { int len = nums.length; HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < len; ++i) { if (map.containsKey(nums[i])) { return new int[]{map.get(nums[i]), i}; } map.put(target - nums[i], i); } return null; } | TwoSum { public int[] twoSum(int[] nums, int target) { int len = nums.length; HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < len; ++i) { if (map.containsKey(nums[i])) { return new int[]{map.get(nums[i]), i}; } map.put(target - nums[i], i); } return null; } } | TwoSum { public int[] twoSum(int[] nums, int target) { int len = nums.length; HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < len; ++i) { if (map.containsKey(nums[i])) { return new int[]{map.get(nums[i]), i}; } map.put(target - nums[i], i); } return null; } } | TwoSum { public int[] twoSum(int[] nums, int target) { int len = nums.length; HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < len; ++i) { if (map.containsKey(nums[i])) { return new int[]{map.get(nums[i]), i}; } map.put(target - nums[i], i); } return null; } int[] twoSum(int[] nums, int target); in... | TwoSum { public int[] twoSum(int[] nums, int target) { int len = nums.length; HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < len; ++i) { if (map.containsKey(nums[i])) { return new int[]{map.get(nums[i]), i}; } map.put(target - nums[i], i); } return null; } int[] twoSum(int[] nums, int target); in... |
@Test void logExecutionTime() { userService.addUser("xiaoming"); assertThrows(NullPointerException.class, () -> userService.addUser("小明", 123)); } | @Around("pointcut() && @annotation(monitor)") public Object logExecutionTime(ProceedingJoinPoint joinPoint, MethodMonitor monitor) throws Throwable { MethodMonitor.LogPrintLogic logPrintLogic; try { logPrintLogic = context.getBean(monitor.logic()); }catch (Exception ex){ log.error("未找到日志打印逻辑: {}, 将使用默认逻辑打印日志!", monitor... | MethodMonitorProcessor { @Around("pointcut() && @annotation(monitor)") public Object logExecutionTime(ProceedingJoinPoint joinPoint, MethodMonitor monitor) throws Throwable { MethodMonitor.LogPrintLogic logPrintLogic; try { logPrintLogic = context.getBean(monitor.logic()); }catch (Exception ex){ log.error("未找到日志打印逻辑: {... | MethodMonitorProcessor { @Around("pointcut() && @annotation(monitor)") public Object logExecutionTime(ProceedingJoinPoint joinPoint, MethodMonitor monitor) throws Throwable { MethodMonitor.LogPrintLogic logPrintLogic; try { logPrintLogic = context.getBean(monitor.logic()); }catch (Exception ex){ log.error("未找到日志打印逻辑: {... | MethodMonitorProcessor { @Around("pointcut() && @annotation(monitor)") public Object logExecutionTime(ProceedingJoinPoint joinPoint, MethodMonitor monitor) throws Throwable { MethodMonitor.LogPrintLogic logPrintLogic; try { logPrintLogic = context.getBean(monitor.logic()); }catch (Exception ex){ log.error("未找到日志打印逻辑: {... | MethodMonitorProcessor { @Around("pointcut() && @annotation(monitor)") public Object logExecutionTime(ProceedingJoinPoint joinPoint, MethodMonitor monitor) throws Throwable { MethodMonitor.LogPrintLogic logPrintLogic; try { logPrintLogic = context.getBean(monitor.logic()); }catch (Exception ex){ log.error("未找到日志打印逻辑: {... |
@Test void addUser() { staticJdkProxyDemo.addUser("xiaoming"); } | @Override public void addUser(String name) { log.warn("before add user"); userService.addUser(name); log.warn("after add user"); } | StaticJdkProxyDemo implements UserService { @Override public void addUser(String name) { log.warn("before add user"); userService.addUser(name); log.warn("after add user"); } } | StaticJdkProxyDemo implements UserService { @Override public void addUser(String name) { log.warn("before add user"); userService.addUser(name); log.warn("after add user"); } } | StaticJdkProxyDemo implements UserService { @Override public void addUser(String name) { log.warn("before add user"); userService.addUser(name); log.warn("after add user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); @Override String getUser... | StaticJdkProxyDemo implements UserService { @Override public void addUser(String name) { log.warn("before add user"); userService.addUser(name); log.warn("after add user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); @Override String getUser... |
@Test void removeUser() { staticJdkProxyDemo.getUsernameFromSelf("xiaoming"); } | @Override public void removeUser(String name) { log.warn("before remove user"); userService.removeUser(name); log.warn("after remove user"); } | StaticJdkProxyDemo implements UserService { @Override public void removeUser(String name) { log.warn("before remove user"); userService.removeUser(name); log.warn("after remove user"); } } | StaticJdkProxyDemo implements UserService { @Override public void removeUser(String name) { log.warn("before remove user"); userService.removeUser(name); log.warn("after remove user"); } } | StaticJdkProxyDemo implements UserService { @Override public void removeUser(String name) { log.warn("before remove user"); userService.removeUser(name); log.warn("after remove user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); @Override St... | StaticJdkProxyDemo implements UserService { @Override public void removeUser(String name) { log.warn("before remove user"); userService.removeUser(name); log.warn("after remove user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); @Override St... |
@Test void getUsername() { } | @Override public String getUsername(String name) { log.warn("before get username"); String username = userService.getUsername(name); log.warn("after get username"); return username; } | StaticJdkProxyDemo implements UserService { @Override public String getUsername(String name) { log.warn("before get username"); String username = userService.getUsername(name); log.warn("after get username"); return username; } } | StaticJdkProxyDemo implements UserService { @Override public String getUsername(String name) { log.warn("before get username"); String username = userService.getUsername(name); log.warn("after get username"); return username; } } | StaticJdkProxyDemo implements UserService { @Override public String getUsername(String name) { log.warn("before get username"); String username = userService.getUsername(name); log.warn("after get username"); return username; } @Override void addUser(String name); @Override void removeUser(String name); @Override Stri... | StaticJdkProxyDemo implements UserService { @Override public String getUsername(String name) { log.warn("before get username"); String username = userService.getUsername(name); log.warn("after get username"); return username; } @Override void addUser(String name); @Override void removeUser(String name); @Override Stri... |
@Test void addUser() { cglibProxyDemo.addUser("xiaoming"); } | @Override public void addUser(String name) { log.warn("before add user"); super.addUser(name); log.warn("after add user"); } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void addUser(String name) { log.warn("before add user"); super.addUser(name); log.warn("after add user"); } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void addUser(String name) { log.warn("before add user"); super.addUser(name); log.warn("after add user"); } } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void addUser(String name) { log.warn("before add user"); super.addUser(name); log.warn("after add user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); } | StaticCglibProxyDemo extends UserServiceImpl { @Override public void addUser(String name) { log.warn("before add user"); super.addUser(name); log.warn("after add user"); } @Override void addUser(String name); @Override void removeUser(String name); @Override String getUsername(String name); } |
@Test public void resourceIdRequestsAreNotTransformed() { Request input = new Request.Builder(12).build(); Request output = transformer.transformRequest(input); assertThat(output).isSameAs(input); } | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void simpleResizeWithCenterInsideAndEncryption() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).centerInside().build(); Request output = secureTransformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); assertThat(output.centerInside)... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void resourceIdRequestsAreNotTransformedWhenAlwaysTransformIsTrue() { Request input = new Request.Builder(12).build(); Request output = alwaysResizeTransformer.transformRequest(input); assertThat(output).isSameAs(input); } | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void nonHttpRequestsAreNotTransformed() { Request input = new Request.Builder(IMAGE_URI).build(); Request output = transformer.transformRequest(input); assertThat(output).isSameAs(input); } | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void nonResizedRequestsAreNotTransformed() { Request input = new Request.Builder(IMAGE_URI).build(); Request output = transformer.transformRequest(input); assertThat(output).isSameAs(input); } | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void nonResizedRequestsAreTransformedWhenAlwaysTransformIsSet() { Request input = new Request.Builder(IMAGE_URI).build(); Request output = alwaysResizeTransformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); String expected = Thumbor.create(HOST).b... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void simpleResize() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).build(); Request output = transformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); String expected = Thumbor.create(HOST).buildImage(IMAGE).resize(50, 50).toUrl(); ... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Config(sdk = 18) @Test public void simpleResizeOnJbMr2UsesWebP() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).build(); Request output = transformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); String expected = Thumbor.create(HOST) .buildIma... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void simpleResizeWithCenterCrop() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).centerCrop().build(); Request output = transformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); assertThat(output.centerCrop).isFalse(); String expect... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void simpleResizeWithCenterInside() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).centerInside().build(); Request output = transformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); assertThat(output.centerInside).isFalse(); String ... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void simpleResizeWithEncryption() { Request input = new Request.Builder(IMAGE_URI).resize(50, 50).build(); Request output = secureTransformer.transformRequest(input); assertThat(output).isNotSameAs(input); assertThat(output.hasSize()).isFalse(); String expected = Thumbor.create(HOST, KEY).buildImage(IMAGE)... | @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(sche... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... | PollexorRequestTransformer implements RequestTransformer { @NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); ... |
@Test public void testEmptyDeserialize() throws Exception { ClientWave wave = new ClientWave(new JSONRpcHandler() { public String request(String jsonBody) throws Exception { Assert .assertEquals( "[{\"method\":\"wave.robot.fetchWave\",\"id\":\"op1\",\"params\":{\"waveId\":\"googlewave.com!testwaveid\",\"waveletId\":\"g... | public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); } | ClientWave { public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); } } | ClientWave { public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); } ClientWave(JSONRpcHandler jsonHandler); } | ClientWave { public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); } ClientWave(JSONRpcHandler jsonHandler); List<JsonRpcResponse> submit(Wavelet wavelet); Wavelet blindWavelet(WaveId waveId, WaveletId waveletId); Wavelet blindWavelet(... | ClientWave { public Wavelet fetchWavelet(WaveId waveId, WaveletId waveletId) throws ClientWaveException { return fetchWavelet(waveId, waveletId, null); } ClientWave(JSONRpcHandler jsonHandler); List<JsonRpcResponse> submit(Wavelet wavelet); Wavelet blindWavelet(WaveId waveId, WaveletId waveletId); Wavelet blindWavelet(... |
@Test public void makeClient_Default() { DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .build(); HttpRequestFactory f = factory.makeClient(options); assertNotNull(f.getTransport()); assertTrue(f.getTransport() instanceof NetHttpTransport); } | public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == null ? new NetHttpTra... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... |
@Test public void initializer() throws Exception { options.initializer(new HttpRequestInitializer() { @Override public void initialize(HttpRequest request) { request.getHeaders().setCookie("magic"); } }); Datastore datastore = factory.create(options.build()); MockDatastoreFactory mockClient = (MockDatastoreFactory) fac... | public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } } | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... |
@Test public void allocateIds() throws Exception { AllocateIdsRequest.Builder request = AllocateIdsRequest.newBuilder(); AllocateIdsResponse.Builder response = AllocateIdsResponse.newBuilder(); expectRpc("allocateIds", request.build(), response.build()); } | public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } } | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... | Datastore { public AllocateIdsResponse allocateIds(AllocateIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("allocateIds", request)) { return AllocateIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("allocateIds", exception); } } Datastore(R... |
@Test public void lookup() throws Exception { LookupRequest.Builder request = LookupRequest.newBuilder(); LookupResponse.Builder response = LookupResponse.newBuilder(); expectRpc("lookup", request.build(), response.build()); } | public LookupResponse lookup(LookupRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("lookup", request)) { return LookupResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("lookup", exception); } } | Datastore { public LookupResponse lookup(LookupRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("lookup", request)) { return LookupResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("lookup", exception); } } } | Datastore { public LookupResponse lookup(LookupRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("lookup", request)) { return LookupResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("lookup", exception); } } Datastore(RemoteRpc remoteRpc); } | Datastore { public LookupResponse lookup(LookupRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("lookup", request)) { return LookupResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("lookup", exception); } } Datastore(RemoteRpc remoteRpc); void rese... | Datastore { public LookupResponse lookup(LookupRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("lookup", request)) { return LookupResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("lookup", exception); } } Datastore(RemoteRpc remoteRpc); void rese... |
@Test public void beginTransaction() throws Exception { BeginTransactionRequest.Builder request = BeginTransactionRequest.newBuilder(); BeginTransactionResponse.Builder response = BeginTransactionResponse.newBuilder(); response.setTransaction(ByteString.copyFromUtf8("project-id")); expectRpc("beginTransaction", request... | public BeginTransactionResponse beginTransaction(BeginTransactionRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("beginTransaction", request)) { return BeginTransactionResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("beginTransaction", exception... | Datastore { public BeginTransactionResponse beginTransaction(BeginTransactionRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("beginTransaction", request)) { return BeginTransactionResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("beginTransaction... | Datastore { public BeginTransactionResponse beginTransaction(BeginTransactionRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("beginTransaction", request)) { return BeginTransactionResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("beginTransaction... | Datastore { public BeginTransactionResponse beginTransaction(BeginTransactionRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("beginTransaction", request)) { return BeginTransactionResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("beginTransaction... | Datastore { public BeginTransactionResponse beginTransaction(BeginTransactionRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("beginTransaction", request)) { return BeginTransactionResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("beginTransaction... |
@Test public void commit() throws Exception { CommitRequest.Builder request = CommitRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); CommitResponse.Builder response = CommitResponse.newBuilder(); expectRpc("commit", request.build(), response.build()); } | public CommitResponse commit(CommitRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("commit", request)) { return CommitResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("commit", exception); } } | Datastore { public CommitResponse commit(CommitRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("commit", request)) { return CommitResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("commit", exception); } } } | Datastore { public CommitResponse commit(CommitRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("commit", request)) { return CommitResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("commit", exception); } } Datastore(RemoteRpc remoteRpc); } | Datastore { public CommitResponse commit(CommitRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("commit", request)) { return CommitResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("commit", exception); } } Datastore(RemoteRpc remoteRpc); void rese... | Datastore { public CommitResponse commit(CommitRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("commit", request)) { return CommitResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("commit", exception); } } Datastore(RemoteRpc remoteRpc); void rese... |
@Test public void reserveIds() throws Exception { ReserveIdsRequest.Builder request = ReserveIdsRequest.newBuilder(); ReserveIdsResponse.Builder response = ReserveIdsResponse.newBuilder(); expectRpc("reserveIds", request.build(), response.build()); } | public ReserveIdsResponse reserveIds(ReserveIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("reserveIds", request)) { return ReserveIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("reserveIds", exception); } } | Datastore { public ReserveIdsResponse reserveIds(ReserveIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("reserveIds", request)) { return ReserveIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("reserveIds", exception); } } } | Datastore { public ReserveIdsResponse reserveIds(ReserveIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("reserveIds", request)) { return ReserveIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("reserveIds", exception); } } Datastore(RemoteR... | Datastore { public ReserveIdsResponse reserveIds(ReserveIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("reserveIds", request)) { return ReserveIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("reserveIds", exception); } } Datastore(RemoteR... | Datastore { public ReserveIdsResponse reserveIds(ReserveIdsRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("reserveIds", request)) { return ReserveIdsResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("reserveIds", exception); } } Datastore(RemoteR... |
@Test public void rollback() throws Exception { RollbackRequest.Builder request = RollbackRequest.newBuilder(); request.setTransaction(ByteString.copyFromUtf8("project-id")); RollbackResponse.Builder response = RollbackResponse.newBuilder(); expectRpc("rollback", request.build(), response.build()); } | public RollbackResponse rollback(RollbackRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("rollback", request)) { return RollbackResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("rollback", exception); } } | Datastore { public RollbackResponse rollback(RollbackRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("rollback", request)) { return RollbackResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("rollback", exception); } } } | Datastore { public RollbackResponse rollback(RollbackRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("rollback", request)) { return RollbackResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("rollback", exception); } } Datastore(RemoteRpc remoteRpc... | Datastore { public RollbackResponse rollback(RollbackRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("rollback", request)) { return RollbackResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("rollback", exception); } } Datastore(RemoteRpc remoteRpc... | Datastore { public RollbackResponse rollback(RollbackRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("rollback", request)) { return RollbackResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("rollback", exception); } } Datastore(RemoteRpc remoteRpc... |
@Test public void runQuery() throws Exception { RunQueryRequest.Builder request = RunQueryRequest.newBuilder(); request.getQueryBuilder(); RunQueryResponse.Builder response = RunQueryResponse.newBuilder(); response.getBatchBuilder() .setEntityResultType(EntityResult.ResultType.FULL) .setMoreResults(QueryResultBatch.Mor... | public RunQueryResponse runQuery(RunQueryRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("runQuery", request)) { return RunQueryResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("runQuery", exception); } } | Datastore { public RunQueryResponse runQuery(RunQueryRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("runQuery", request)) { return RunQueryResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("runQuery", exception); } } } | Datastore { public RunQueryResponse runQuery(RunQueryRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("runQuery", request)) { return RunQueryResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("runQuery", exception); } } Datastore(RemoteRpc remoteRpc... | Datastore { public RunQueryResponse runQuery(RunQueryRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("runQuery", request)) { return RunQueryResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("runQuery", exception); } } Datastore(RemoteRpc remoteRpc... | Datastore { public RunQueryResponse runQuery(RunQueryRequest request) throws DatastoreException { try (InputStream is = remoteRpc.call("runQuery", request)) { return RunQueryResponse.parseFrom(is); } catch (IOException exception) { throw invalidResponseException("runQuery", exception); } } Datastore(RemoteRpc remoteRpc... |
@Test public void testArgs() throws DatastoreEmulatorException { DatastoreEmulator datastore = new DatastoreEmulator(null, "blar", options) { @Override void startEmulatorInternal( String emulatorDir, String projectId, List<String> cmdLineOpts) { } }; try { datastore.start(null, "projectId"); fail("expected exception");... | @Deprecated public synchronized void start(String emulatorDir, String projectId, String... commandLineOptions) throws DatastoreEmulatorException { checkNotNull(emulatorDir, "emulatorDir cannot be null"); checkNotNull(projectId, "projectId cannot be null"); checkState(state == State.NEW, "Cannot call start() more than o... | DatastoreEmulator extends Datastore { @Deprecated public synchronized void start(String emulatorDir, String projectId, String... commandLineOptions) throws DatastoreEmulatorException { checkNotNull(emulatorDir, "emulatorDir cannot be null"); checkNotNull(projectId, "projectId cannot be null"); checkState(state == State... | DatastoreEmulator extends Datastore { @Deprecated public synchronized void start(String emulatorDir, String projectId, String... commandLineOptions) throws DatastoreEmulatorException { checkNotNull(emulatorDir, "emulatorDir cannot be null"); checkNotNull(projectId, "projectId cannot be null"); checkState(state == State... | DatastoreEmulator extends Datastore { @Deprecated public synchronized void start(String emulatorDir, String projectId, String... commandLineOptions) throws DatastoreEmulatorException { checkNotNull(emulatorDir, "emulatorDir cannot be null"); checkNotNull(projectId, "projectId cannot be null"); checkState(state == State... | DatastoreEmulator extends Datastore { @Deprecated public synchronized void start(String emulatorDir, String projectId, String... commandLineOptions) throws DatastoreEmulatorException { checkNotNull(emulatorDir, "emulatorDir cannot be null"); checkNotNull(projectId, "projectId cannot be null"); checkState(state == State... |
@Test public void testMakeKey_BadTypeForKind() { try { DatastoreHelper.makeKey(new Object()); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void makeClient_WithCredential() { NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(transport) .build(); DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .credential(credential) .build(); HttpRequ... | public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == null ? new NetHttpTra... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... |
@Test public void testMakeKey_BadTypeForNameId() { try { DatastoreHelper.makeKey("kind", new Object()); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_Empty() { assertEquals(Key.newBuilder().build(), DatastoreHelper.makeKey().build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_Incomplete() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo")) .build(), makeKey("Foo").build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_IdInt() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)) .build(), makeKey("Foo", 1).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_IdLong() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)) .build(), makeKey("Foo", 1L).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_IdShort() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setId(1)) .build(), makeKey("Foo", (short) 1).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_Name() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")) .build(), makeKey("Foo", "hi").build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KindNameKind() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Foo").setName("hi")) .addPath(Key.PathElement.newBuilder().setKind("Bar")) .build(), makeKey("Foo", "hi", "Bar").build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KeyKind() { assertEquals( Key.newBuilder() .addPath(PARENT.getPath(0)) .addPath(Key.PathElement.newBuilder().setKind("Child")) .build(), makeKey(PARENT, "Child").build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KindIdKeyKind() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Grandparent").setId(24L)) .addPath(PARENT.getPath(0)) .addPath(Key.PathElement.newBuilder().setKind("Child")) .build(), makeKey("Grandparent", 24L, PARENT, "Child").build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void makeClient_WithTransport() { NetHttpTransport transport = new NetHttpTransport(); DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .transport(transport) .build(); HttpRequestFactory f = factory.makeClient(options); assertEquals(transport, f.getTransport()); } | public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == null ? new NetHttpTra... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... |
@Test public void testMakeKey_KindIdKey() { assertEquals( Key.newBuilder() .addPath(Key.PathElement.newBuilder().setKind("Grandparent").setId(24L)) .addPath(PARENT.getPath(0)) .build(), makeKey("Grandparent", 24L, PARENT).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.