test

Spring学习之实验十九:使用Spring的单元测试

左心房为你撑大大i 提交于 2020-02-04 01:47:38
1.导包,导入Spring的测试包:spring-test-4.0.0.RELEASE.jar 2.@ContextConfiguration("")用来指定Spring的配置文件的位置 3.@RunWith(SpringJUnit4ClassRunner.class)可以指定哪种驱动进行单元测试(默认是junit) 使用Spring的单元测试模块来执行标了@Test注解的测试方法 以前Test注解只是由junit执行 优点:不用ioc.getBean();来获取容器中的组件了,可以直接用@Autowired,Spring为我们自动装配 来源: CSDN 作者: 残·影 链接: https://blog.csdn.net/Walker7143/article/details/104156663

Codeforces——Array Sharpening

▼魔方 西西 提交于 2020-02-03 19:36:24
Codeforces——Array Sharpening You’re given an array a1,…,an of n non-negative integers. Let’s call it sharpened if and only if there exists an integer 1≤k≤n such that a1<a2<…ak+1>…>an. In particular, any strictly increasing or strictly decreasing array is sharpened. For example: The arrays [4], [0,1], [12,10,8] and [3,11,15,9,7,4] are sharpened; The arrays [2,8,2,8,6,5], [0,1,1,0] and [2,5,6,9,8,8] are not sharpened. You can do the following operation as many times as you want: choose any strictly positive element of the array, and decrease it by one. Formally, you can choose any i (1≤i≤n) such

SpringDataRedis入门到实战

别等时光非礼了梦想. 提交于 2020-02-03 19:14:38
1.项目常见问题思考 对于电商系统的广告后台管理和广告前台展示,首页每天有大量的人访问,对数据库造成很大的访问压力,甚至是瘫痪。那如何解决呢?我们通常的做法有两种:一种是数据缓存、一种是网页静态化。我们今天讨论第一种解决方案。 2.Redis redis是一款开源的Key-Value数据库,运行在内存中,由ANSI C编写。企业开发通常采用Redis来实现缓存。同类的产品还有memcache 、memcached 、MongoDB等。 3.Jedis Jedis是Redis官方推出的一款面向Java的客户端,提供了很多接口供Java语言调用。可以在Redis官网下载,当然还有一些开源爱好者提供的客户端,如Jredis、SRP等等,推荐使用Jedis 4.Spring Data Redis Spring-data-redis是spring大家族的一部分,提供了在srping应用中通过简单的配置访问redis服务,对reids底层开发包(Jedis, JRedis, and RJC)进行了高度封装,RedisTemplate提供了redis各种操作、异常处理及序列化,支持发布订阅,并对spring 3.1 cache进行了实现。 spring-data-redis针对jedis提供了如下功能: 1.连接池自动管理,提供了一个高度封装的“RedisTemplate”类 2

K8S 之 kubectl详解

妖精的绣舞 提交于 2020-02-03 18:43:16
一、kubectl陈述式管理方法 kubectl小洁: kubectl是官方的CLI命令行工具,用于apiserver进行通信,将用户在命令行输入的命令,组织并转化为apiserver能识别的信息,进而实现管理k8s各种资源的一种有效途径。 1、查看当前集群所有命名空间 [root@test-nodes1 ~]# kubectl get namespace NAME STATUS AGE default Active 42h kube-node-lease Active 42h kube-public Active 42h kube-system Active 42h 2、查看default命名空间下的所有资源 [root@test-nodes1 ~]# kubectl get all -n default NAME READY STATUS RESTARTS AGE pod/nginx-ds-76fr8 0/1 ImagePullBackOff 0 39h pod/nginx-ds-zz7jn 0/1 ErrImagePull 0 39h pod/nginx-ds1-qg45q 1/1 Running 0 39h pod/nginx-ds1-whnmv 1/1 Running 0 39h #pod资源 NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S

Codeforces Round #616(Div.2) Array Sharpening

末鹿安然 提交于 2020-02-03 17:32:12
You're given an array a 1 , … , a n a1,…,an of n n non-negative integers. Let's call it sharpened if and only if there exists an integer 1 ≤ k ≤ n 1≤k≤n such that a 1 < a 2 < … < a k a1<a2<…<ak and a k > a k + 1 > … > a n ak>ak+1>…>an. In particular, any strictly increasing or strictly decreasing array is sharpened. For example: The arrays [ 4 ] [4], [ 0 , 1 ] [0,1], [ 12 , 10 , 8 ] [12,10,8] and [ 3 , 11 , 15 , 9 , 7 , 4 ] [3,11,15,9,7,4] are sharpened; The arrays [ 2 , 8 , 2 , 8 , 6 , 5 ] [2,8,2,8,6,5], [ 0 , 1 , 1 , 0 ] [0,1,1,0] and [ 2 , 5 , 6 , 9 , 8 , 8 ] [2,5,6,9,8,8] are not sharpened

Codeforces Round #616(Div.2) Even But Not Even

眉间皱痕 提交于 2020-02-03 15:55:23
Let's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 2 but the number itself is not divisible by 2 2. For example, 13 13, 1227 1227, 185217 185217 are ebne numbers, while 12 12, 2 2, 177013 177013, 265918 265918 are not. If you're still unsure what ebne numbers are, you can look at the sample notes for more clarification. You are given a non-negative integer s s, consisting of n n digits. You can delete some digits (they are not necessary consecutive/successive) to make the given number ebne. You cannot change the order of the digits, that is, after

PLSQL——10、函数实现返回表

∥☆過路亽.° 提交于 2020-02-03 15:39:31
如果要通过oracle函数实现返回表,应该如何实现呢? PIPELINED管道函数 从oracle 9i 开始,提供了一个叫做“管道化表函数”的概念,来解决这个问题。 这种类型的函数,必须返回一个集合类型,且标明 pipelined; 这个oracle函数不能返回具体变量,必须以一个空 return 返回; 这个oracle函数中,通过 pipe row () 语句来送出要返回的表中的每一行; 调用这个oracle函数的时候,通过 table() 关键字把管道流仿真为一个数据集。 以下是一个十分简单的实例: ----建表并插入数据 create table tb1(k number, v varchar2(10)); insert into tb1(k, v) values(100,'aaa'); insert into tb1(k, v) values(200,'bbb'); insert into tb1(k, v) values(200,'ccc'); ----创建type create type row_type1 as object(k number, v varchar2(10)); create type table_type1 as table of row_type1; --创建管道函数 create or replace function fun1 return

testng学习(依赖,忽略,超时等测试场景)

穿精又带淫゛_ 提交于 2020-02-03 15:18:00
依赖测试: 依赖测试主要用于,某个接口需要用到上个接口的返回值,这种数据关联性的场景。 如图:本来是test01()先运行,但是加上@Test(dependsOnMethods = { "test02" })标签就变成test02先执行,然后在运行test01。 package com.mg.java.maven.day06; import org.testng.annotations.Test; /** * 依赖测试 * * @author admin * */ public class DepengenryDemo { @Test(dependsOnMethods = { "test02" }) public void test01() { System.out.println("DepengenryDemo.test01()"); // 字符编码顺序执行 } @Test public void test02() { System.out.println("DepengenryDemo.test02()"); } } 忽略测试: 忽略测试。主要用于我们不想某条用例执行,就可以用@Test(enabled = false)来使这条用例不执行。 package com.mg.java.maven.day06; import org.testng.annotations.Test;

NLP入门(1)

扶醉桌前 提交于 2020-02-03 15:16:04
自然语言处理,简称:NLP,是指对人们平时日常使用的交流语言进行处理的一项技术。NLP 经过多年的发展,现今可以划分为两部分内容,即:自然语言的理解和自然语言的生成。 本文将以文本分类为目标,介绍自然语言处理相关的基础操作和应用。 (来自 https://www.shiyanlou.com/courses/1208 ) 做一个中文文本分类任务,首先要做的是文本的预处理,对文本进行分词和去停用词操作,来把字符串分割成词与词组合而成的字符串集合并去掉其中的一些非关键词汇(像是:的、地、得等)。再就是对预处理过后的文本进行特征提取。最后将提取到的特征送进分类器进行训练。 术语解释: 分词:词是 NLP 中能够独立活动的有意义的语言成分。即使某个中文单字也有活动的意义,但其实这些单字也是词,属于单字成词。 词性标注:给每个词语的词性进行标注,比如 跑/动词、美丽的/形容词等等。 命名实体识别:从文本中识别出具有特定类别的实体。像是识别文本中的日期,地名等等。 词义消歧:多义词判断最合理的词义。 句法分析:解析句子中各个成分的依赖关系。 指代消解:消除和解释代词「这个,他,你」等的指代问题。 1.Python字符串操作 变量名.count("A"):返回子串A在字符串中出现的次数 .strip() 方法可以去除字符串首尾的指定符号。无指定时,默认去除空格符 ' ' 和换行符 '\n'

SpringBoot之优雅关闭系统

☆樱花仙子☆ 提交于 2020-02-03 12:20:03
在使用SpringBoot的时候,通常情况下,我都是使用 ps -ef | grep java 找到对于的服务器id,然后通过 kill -9 进程号 进行删除的,这样会导致正在进行的进程也会被关闭,而没有将目前的工作进行保存,最近看到一篇文章,也就自己进行尝试,参考链接放在了最后面 通过SpringBoot提供的actuator actuator提供审计,健康检查,HTTP跟踪等功能,能够帮助我们监控和管理SpringBoot,在这里他提供了执行shutdown的功能 <!-- 添加依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> #在application.yml 中进行配置,shutdown默认是关闭的,这里需要将其设置为true,同时将接口暴露出来到web上 management: endpoint: shutdown: enabled: true endpoints: web: exposure: include: shutdown // 配置controller import org.junit.Test; import org.slf4j.Logger;