Lettuce

How can I sync the html/session used between Django's 'Client' and Selenium's webdriver

半城伤御伤魂 提交于 2019-12-11 03:22:49
问题 I'm trying to test that logged in users can log out on my Django site with Lettuce, Selenium and lettuce_webdriver. In my terrain.py I have: @before.all def setup_browser(): profile = webdriver.FirefoxProfile() profile.set_preference('network.dns.disableIPv6', True) world.browser = webdriver.Firefox(profile) world.client = Client(HTTP_USER_AGENT='Mozilla/5.0') And then when I 'login': @step(r'I am logged in as "(\w*)"') def log_in(step, name): world.client.login(username=name, password=name)

Using lettuce, how can I verify that an email sent from a Django web application has the correct contents?

怎甘沉沦 提交于 2019-12-09 19:57:20
问题 I have a Django-based web application that is required to send a confirmation email to the user on an attempt to change the registered email address. The functionality has been implemented, but the lettuce test intended to verify the contents of the email is failing. To verify the operation, my plan was to use the file backend (EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend') then verify the contents of the file within my lettuce step. When running "normally" (e.g. via

Create Lettuce StatefulRedisConnection for storing string as keys and byte array as value

喜欢而已 提交于 2019-12-08 05:26:25
I have a Spring boot application which connects to a Redis cluster on AWS. I was trying out Lettuce, and want to create a StatefulRedisConnection for storing keys as string, but values as byte array. I tried using the built-in ByteArrayCodec , but it takes both the key and value as a byte array. I'm new to Lettuce, so I'm not sure whether I need to write a custom codec. If so, how would I write it? And would there be any performance issues? Or am I going down the wrong path? Below code will allow you to have string key and byte array as value. public class StringByteCodec implements RedisCodec

spring-boot整合redis

孤人 提交于 2019-12-05 05:13:04
redis是一个nosql(非关系型数据库) , 可以用作数据库,缓存,消息中间件 连接redis需要注意的几点: 在redis.conf里设置 : 1.把daemonize 设置为yes, 这个属性不影响连接, 这只是把redis启动设置为后台启动 2.找到pretected-mode把他放开,并且设置为no ; 这是把安全模式关掉 3.把bind 127.0.0.1 : : 1这行注释掉 ,这样才能用别的ip地址还是什么去了 4. redis 版本在五点几之后,就需要给redis设置密码了 : requirepass xxx 创建spring-boot工程,在创建的时候选web里的web和nosql里的redis ,这里用的是spring data redis 创建好了工程后 , 再添加一pool2依赖 整体依赖如下 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4

Using lettuce, how can I verify that an email sent from a Django web application has the correct contents?

时光毁灭记忆、已成空白 提交于 2019-12-04 17:31:59
I have a Django-based web application that is required to send a confirmation email to the user on an attempt to change the registered email address. The functionality has been implemented, but the lettuce test intended to verify the contents of the email is failing. To verify the operation, my plan was to use the file backend (EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend') then verify the contents of the file within my lettuce step. When running "normally" (e.g. via manage.py runserver), the email file is created as expected. When run via lettuce (manage.py harvest), the

springboot redis笔记

佐手、 提交于 2019-12-04 13:37:24
1、首先创建一个springboot项目,就不解释了,然后添加一个redis引用 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> 2、在配置文件中添加redis的连接配置信息 spring: redis: #数据库索引 database: 0 host: 192.168.1.1 port: 6379 password: 123456 3、然后创建一个控制器 就这么简单,但是你会发现,存入redis是一堆乱七八糟的玩意。 方式一: @Autowired(required = false) public void setRedisTemplate(RedisTemplate redisTemplate) { RedisSerializer stringSerializer = new StringRedisSerializer(); redisTemplate.setKeySerializer(stringSerializer); redisTemplate.setValueSerializer(stringSerializer); redisTemplate

J2Cache 中使用 Lettuce 替代 Jedis 管理 Redis 连接

≯℡__Kan透↙ 提交于 2019-12-04 04:59:11
一直以来 J2Cache 都是使用 Jedis 连接 Redis 服务的。Jedis 是一个很老牌的 Redis 的 Java 开发包,使用很稳定,作者维护很勤勉,社区上能搜到的文章也非常非常多。算是使用范围最广的 Redis 开发包。但是 Jedis 比较推出时间比较早,整个设计思路比较传统,例如不支持异步操作,接口设计比较繁琐老套(相比其他开发包而已),使用连接池占用很多的物理连接资源。当然,这个是可以理解的,比较一个比较早期的开发包,相对其做大的结构调整是很难的,而且用户也不一定会接受。 自从 2.7.0 版本开始,J2Cache 就增加了 Lettuce 的支持。Lettuce是一个可伸缩线程安全的 Redis 客户端。多个线程可以共享同一个RedisConnection。它利用优秀 Netty NIO 框架来高效地管理多个连接。 相比较 Jedis ,我觉得 Lettuce 的优点有如下几个方面: 更加直观、结构更加良好的接口设计 基于 Netty NIO 可以高效管理 Redis 连接,不用连接池方式 支持异步操作(J2Cache 暂时没用到这个特性) 文档非常详尽 不过 Lettuce 需要至少 Java 8 的支持,好在 J2Cache 也要求至少 Java 8 ,就这么愉快的决定了。 在 J2Cache 2.7.0 版本以及以后的更新版本中,想使用 Lettuce

聊聊spring-boot-starter-data-redis的配置变更

喜你入骨 提交于 2019-12-03 02:00:24
序 本文主要研究一下spring-boot-starter-data-redis的配置变更 配置变更 以前是spring-boot的1.4.x版本的(spring-data-redis为1.7.x版本),最近切到2.0.4.RELEASEB版本(spring-data-redis为2.0.5.RELEASE版本),发现配置有变更。 旧版配置 spring.redis.database=0 spring.redis.host=192.168.99.100 spring.redis.port=6379 #spring.redis.password= # Login password of the redis server. spring.redis.pool.max-active=8 spring.redis.pool.max-idle=8 spring.redis.pool.max-wait=-1 spring.redis.pool.min-idle=0 #spring.redis.sentinel.master= # Name of Redis server. #spring.redis.sentinel.nodes= # Comma-separated list of host:port pairs. spring.redis.timeout=10 新版本配置 spring

聊聊lettuce的指标监控

丶灬走出姿态 提交于 2019-12-03 01:59:49
序 本文主要研究一下lettuce的指标监控 DefaultCommandLatencyEventPublisher lettuce-core-5.0.4.RELEASE-sources.jar!/io/lettuce/core/event/metrics/DefaultCommandLatencyEventPublisher.java public class DefaultCommandLatencyEventPublisher implements MetricEventPublisher { private final EventExecutorGroup eventExecutorGroup; private final EventPublisherOptions options; private final EventBus eventBus; private final CommandLatencyCollector commandLatencyCollector; private final Runnable EMITTER = this::emitMetricsEvent; private volatile ScheduledFuture<?> scheduledFuture; public DefaultCommandLatencyEventPublisher

聊聊lettuce的sentinel连接

一曲冷凌霜 提交于 2019-12-03 01:59:37
序 本文主要研究一下lettuce的sentinel连接 RedisClient.connectSentinel lettuce-core-5.0.4.RELEASE-sources.jar!/io/lettuce/core/RedisClient.java private <K, V> StatefulRedisSentinelConnection<K, V> connectSentinel(RedisCodec<K, V> codec, RedisURI redisURI, Duration timeout) { assertNotNull(codec); checkValidRedisURI(redisURI); ConnectionBuilder connectionBuilder = ConnectionBuilder.connectionBuilder(); connectionBuilder.clientOptions(ClientOptions.copyOf(getOptions())); connectionBuilder.clientResources(clientResources); DefaultEndpoint endpoint = new DefaultEndpoint(clientOptions);