minor refactoring
This commit is contained in:
		
							parent
							
								
									93e191856f
								
							
						
					
					
						commit
						f28f14f2fc
					
				@ -713,7 +713,8 @@ public class EntityQueryControllerTest extends AbstractControllerTest {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // all devices with ownerName = TEST TENANT
 | 
					        // all devices with ownerName = TEST TENANT
 | 
				
			||||||
        EntityCountQuery query = new EntityCountQuery(filter, List.of(activeAlarmTimeFilter, tenantOwnerNameFilter));
 | 
					        EntityCountQuery query = new EntityCountQuery(filter, List.of(activeAlarmTimeFilter, tenantOwnerNameFilter));
 | 
				
			||||||
        countByQueryAndCheck(query, numOfDevices);
 | 
					        await().atMost(TIMEOUT, TimeUnit.SECONDS).until(() -> countByQuery(query),
 | 
				
			||||||
 | 
					                result -> result == numOfDevices);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // all devices with ownerName = TEST TENANT
 | 
					        // all devices with ownerName = TEST TENANT
 | 
				
			||||||
        EntityCountQuery activeAlarmTimeToLongQuery = new EntityCountQuery(filter, List.of(activeAlarmTimeToLongFilter, tenantOwnerNameFilter));
 | 
					        EntityCountQuery activeAlarmTimeToLongQuery = new EntityCountQuery(filter, List.of(activeAlarmTimeToLongFilter, tenantOwnerNameFilter));
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,5 @@ ZOOKEEPER_ENABLED=true
 | 
				
			|||||||
ZOOKEEPER_URL=zookeeper:2181
 | 
					ZOOKEEPER_URL=zookeeper:2181
 | 
				
			||||||
TB_KAFKA_SERVERS=kafka:9092
 | 
					TB_KAFKA_SERVERS=kafka:9092
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TB_EDQS_STATS_ENABLED=false
 | 
					 | 
				
			||||||
METRICS_ENABLED=true
 | 
					METRICS_ENABLED=true
 | 
				
			||||||
METRICS_ENDPOINTS_EXPOSE=prometheus
 | 
					METRICS_ENDPOINTS_EXPOSE=prometheus
 | 
				
			||||||
 | 
				
			|||||||
@ -164,10 +164,8 @@ public class ContainerTestSuite {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // to trigger edqs synchronization
 | 
					            // to trigger edqs synchronization
 | 
				
			||||||
            if (true) {
 | 
					            addToFile(targetDir, "tb-node.env",
 | 
				
			||||||
                addToFile(targetDir, "tb-node.env",
 | 
					                    Map.of("TB_EDQS_SYNC_ENABLED", "true"));
 | 
				
			||||||
                        Map.of("TB_EDQS_SYNC_ENABLED", "true"));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            testContainer = new DockerComposeContainerImpl<>(composeFiles)
 | 
					            testContainer = new DockerComposeContainerImpl<>(composeFiles)
 | 
				
			||||||
                    .withPull(false)
 | 
					                    .withPull(false)
 | 
				
			||||||
 | 
				
			|||||||
@ -114,28 +114,6 @@ public class TestRestClient {
 | 
				
			|||||||
        requestSpec.header(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
 | 
					        requestSpec.header(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public JsonNode getActivateRequest(String password) {
 | 
					 | 
				
			||||||
        ObjectNode response = given().spec(requestSpec).get("/api/noauth/activate?activateToken={activateToken}", token)
 | 
					 | 
				
			||||||
                .then()
 | 
					 | 
				
			||||||
                .statusCode(HTTP_OK)
 | 
					 | 
				
			||||||
                .extract()
 | 
					 | 
				
			||||||
                .as(ObjectNode.class);
 | 
					 | 
				
			||||||
        return JacksonUtil.newObjectNode()
 | 
					 | 
				
			||||||
                .put("activateToken", this.token)
 | 
					 | 
				
			||||||
                .put("password", password);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void activateAndLoginAsUser(JsonNode activateRequest) {
 | 
					 | 
				
			||||||
        ObjectNode tokenInfo = given().spec(requestSpec).body(activateRequest)
 | 
					 | 
				
			||||||
                .post("/api/noauth/activate")
 | 
					 | 
				
			||||||
                .then()
 | 
					 | 
				
			||||||
                .extract()
 | 
					 | 
				
			||||||
                .as(ObjectNode.class);
 | 
					 | 
				
			||||||
        token = tokenInfo.get("token").asText();
 | 
					 | 
				
			||||||
        refreshToken = tokenInfo.get("refreshToken").asText();
 | 
					 | 
				
			||||||
        requestSpec.header(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public Tenant postTenant(Tenant tenant) {
 | 
					    public Tenant postTenant(Tenant tenant) {
 | 
				
			||||||
        return given().spec(requestSpec).body(tenant)
 | 
					        return given().spec(requestSpec).body(tenant)
 | 
				
			||||||
                .post("/api/tenant")
 | 
					                .post("/api/tenant")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user