55 changed files with 827 additions and 218 deletions
@ -0,0 +1,71 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.user; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.springframework.stereotype.Component; |
|||
import org.thingsboard.server.common.data.User; |
|||
import org.thingsboard.server.common.data.security.UserCredentials; |
|||
import org.thingsboard.server.dao.DaoUtil; |
|||
import org.thingsboard.server.dao.model.ModelConstants; |
|||
import org.thingsboard.server.dao.model.sql.UserCredentialsEntity; |
|||
import org.thingsboard.server.dao.sql.JpaAbstractDao; |
|||
import org.thingsboard.server.dao.user.UserCredentialsDao; |
|||
|
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/22/2017. |
|||
*/ |
|||
@Component |
|||
@ConditionalOnProperty(prefix="sql", value="enabled",havingValue = "true", matchIfMissing = false) |
|||
public class JpaUserCredentialsDao extends JpaAbstractDao<UserCredentialsEntity, UserCredentials> implements UserCredentialsDao { |
|||
|
|||
@Autowired |
|||
private UserCredentialsRepository userCredentialsRepository; |
|||
|
|||
@Override |
|||
protected Class<UserCredentialsEntity> getEntityClass() { |
|||
return UserCredentialsEntity.class; |
|||
} |
|||
|
|||
@Override |
|||
protected String getColumnFamilyName() { |
|||
return ModelConstants.USER_CREDENTIALS_COLUMN_FAMILY_NAME; |
|||
} |
|||
|
|||
@Override |
|||
protected CrudRepository<UserCredentialsEntity, UUID> getCrudRepository() { |
|||
return userCredentialsRepository; |
|||
} |
|||
|
|||
@Override |
|||
public UserCredentials findByUserId(UUID userId) { |
|||
return DaoUtil.getData(userCredentialsRepository.findByUserId(userId)); |
|||
} |
|||
|
|||
@Override |
|||
public UserCredentials findByActivateToken(String activateToken) { |
|||
return DaoUtil.getData(userCredentialsRepository.findByActivateToken(activateToken)); |
|||
} |
|||
|
|||
@Override |
|||
public UserCredentials findByResetToken(String resetToken) { |
|||
return DaoUtil.getData(userCredentialsRepository.findByResetToken(resetToken)); |
|||
} |
|||
} |
|||
@ -0,0 +1,91 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.widget; |
|||
|
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.PageRequest; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.springframework.stereotype.Component; |
|||
import org.thingsboard.server.common.data.page.TextPageLink; |
|||
import org.thingsboard.server.common.data.widget.WidgetsBundle; |
|||
import org.thingsboard.server.dao.DaoUtil; |
|||
import org.thingsboard.server.dao.model.sql.WidgetsBundleEntity; |
|||
import org.thingsboard.server.dao.sql.JpaAbstractDao; |
|||
import org.thingsboard.server.dao.widget.WidgetsBundleDao; |
|||
|
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
import static org.thingsboard.server.dao.model.ModelConstants.WIDGETS_BUNDLE_COLUMN_FAMILY_NAME; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/23/2017. |
|||
*/ |
|||
@Component |
|||
public class JpaWidgetsBundleDao extends JpaAbstractDao<WidgetsBundleEntity, WidgetsBundle> implements WidgetsBundleDao { |
|||
|
|||
@Autowired |
|||
private WidgetsBundleRepository widgetsBundleRepository; |
|||
|
|||
@Override |
|||
protected Class<WidgetsBundleEntity> getEntityClass() { |
|||
return WidgetsBundleEntity.class; |
|||
} |
|||
|
|||
@Override |
|||
protected String getColumnFamilyName() { |
|||
return WIDGETS_BUNDLE_COLUMN_FAMILY_NAME; |
|||
} |
|||
|
|||
@Override |
|||
protected CrudRepository<WidgetsBundleEntity, UUID> getCrudRepository() { |
|||
return widgetsBundleRepository; |
|||
} |
|||
|
|||
@Override |
|||
public WidgetsBundle findWidgetsBundleByTenantIdAndAlias(UUID tenantId, String alias) { |
|||
return DaoUtil.getData(widgetsBundleRepository.findWidgetsBundleByTenantIdAndAlias(tenantId, alias)); |
|||
} |
|||
|
|||
@Override |
|||
public List<WidgetsBundle> findSystemWidgetsBundles(TextPageLink pageLink) { |
|||
if (pageLink.getIdOffset() == null) { |
|||
return DaoUtil.convertDataList(widgetsBundleRepository.findSystemWidgetsBundlesFirstPage(pageLink.getLimit() |
|||
, pageLink.getTextSearch())); |
|||
} else { |
|||
return DaoUtil.convertDataList(widgetsBundleRepository.findSystemWidgetsBundlesNextPage(pageLink.getLimit() |
|||
, pageLink.getTextSearch(), pageLink.getIdOffset())); |
|||
} |
|||
//return DaoUtil.convertDataList(widgetsBundleRepository.findBySearchTextStartsWithIgnoreCase(pageLink.getTextSearch().toLowerCase()));
|
|||
//return DaoUtil.convertDataList(widgetsBundleRepository.findBySearchTextStartsWithIgnoreCase(pageLink.getTextSearch().toLowerCase() ,pageable));
|
|||
} |
|||
|
|||
@Override |
|||
public List<WidgetsBundle> findTenantWidgetsBundlesByTenantId(UUID tenantId, TextPageLink pageLink) { |
|||
throw new RuntimeException("Not implemented"); |
|||
} |
|||
|
|||
@Override |
|||
public List<WidgetsBundle> findAllTenantWidgetsBundlesByTenantId(UUID tenantId, TextPageLink pageLink) { |
|||
throw new RuntimeException("Not implemented"); |
|||
} |
|||
|
|||
@Override |
|||
protected boolean isSearchTextDao() { |
|||
return true; |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.widget; |
|||
|
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.data.jpa.repository.JpaRepository; |
|||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
|||
import org.springframework.data.jpa.repository.Query; |
|||
import org.springframework.data.repository.CrudRepository; |
|||
import org.springframework.data.repository.query.Param; |
|||
import org.thingsboard.server.common.data.page.TextPageLink; |
|||
import org.thingsboard.server.dao.model.ToData; |
|||
import org.thingsboard.server.dao.model.sql.WidgetsBundleEntity; |
|||
|
|||
import java.util.Collection; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/23/2017. |
|||
*/ |
|||
//public interface WidgetsBundleRepository extends CrudRepository<WidgetsBundleEntity, UUID> {
|
|||
public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEntity, UUID>, JpaSpecificationExecutor { |
|||
|
|||
WidgetsBundleEntity findWidgetsBundleByTenantIdAndAlias(UUID tenantId, String alias); |
|||
|
|||
@Query(nativeQuery = true, value = "SELECT * FROM WIDGETS_BUNDLE WHERE TENANT_ID IS NULL " + |
|||
"AND LOWER(SEARCH_TEXT) LIKE LOWER(CONCAT(?2, '%')) " + |
|||
"ORDER BY ID LIMIT ?1") |
|||
List<WidgetsBundleEntity> findSystemWidgetsBundlesFirstPage(Integer limit, String searchText); |
|||
|
|||
@Query(nativeQuery = true, value = "SELECT * FROM WIDGETS_BUNDLE WHERE TENANT_ID IS NULL " + |
|||
"AND LOWER(SEARCH_TEXT) LIKE LOWER(CONCAT(?2, '%')) " + |
|||
"AND ID > ?3 ORDER BY ID LIMIT ?1") |
|||
List<WidgetsBundleEntity> findSystemWidgetsBundlesNextPage(Integer limit, String searchText, UUID idOffset); |
|||
|
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao; |
|||
|
|||
import com.github.springtestdbunit.DbUnitTestExecutionListener; |
|||
import org.junit.runner.RunWith; |
|||
import org.springframework.test.context.ContextConfiguration; |
|||
import org.springframework.test.context.TestExecutionListeners; |
|||
import org.springframework.test.context.TestPropertySource; |
|||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; |
|||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
|||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; |
|||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/22/2017. |
|||
*/ |
|||
@RunWith(SpringJUnit4ClassRunner.class) |
|||
@ContextConfiguration(classes = {JpaDaoConfig.class}) |
|||
@TestPropertySource("classpath:jpa-test.properties") |
|||
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class, |
|||
DirtiesContextTestExecutionListener.class, |
|||
DbUnitTestExecutionListener.class }) |
|||
public class AbstractJpaDaoTest extends AbstractTransactionalJUnit4SpringContextTests { |
|||
|
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.user; |
|||
|
|||
import com.github.springtestdbunit.annotation.DatabaseSetup; |
|||
import org.junit.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.thingsboard.server.common.data.security.UserCredentials; |
|||
import org.thingsboard.server.dao.AbstractJpaDaoTest; |
|||
import org.thingsboard.server.dao.user.UserCredentialsDao; |
|||
|
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
import static org.junit.Assert.assertEquals; |
|||
import static org.junit.Assert.assertNotNull; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/22/2017. |
|||
*/ |
|||
public class JpaUserCredentialsDaoTest extends AbstractJpaDaoTest { |
|||
|
|||
@Autowired |
|||
private UserCredentialsDao userCredentialsDao; |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/user_credentials.xml") |
|||
public void testFindAll() { |
|||
List<UserCredentials> userCredentials = userCredentialsDao.find(); |
|||
assertEquals(2, userCredentials.size()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/user_credentials.xml") |
|||
public void testFindByUserId() { |
|||
UserCredentials userCredentials = userCredentialsDao.findByUserId(UUID.fromString("787827e6-27d7-11e7-93ae-92361f002671")); |
|||
assertNotNull(userCredentials); |
|||
assertEquals("4b9e010c-27d5-11e7-93ae-92361f002671", userCredentials.getId().toString()); |
|||
assertEquals(true, userCredentials.isEnabled()); |
|||
assertEquals("password", userCredentials.getPassword()); |
|||
assertEquals("ACTIVATE_TOKEN_2", userCredentials.getActivateToken()); |
|||
assertEquals("RESET_TOKEN_2", userCredentials.getResetToken()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/user_credentials.xml") |
|||
public void testFindByActivateToken() { |
|||
UserCredentials userCredentials = userCredentialsDao.findByActivateToken("ACTIVATE_TOKEN_1"); |
|||
assertNotNull(userCredentials); |
|||
assertEquals("3ed10af0-27d5-11e7-93ae-92361f002671", userCredentials.getId().toString()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/user_credentials.xml") |
|||
public void testFindByResetToken() { |
|||
UserCredentials userCredentials = userCredentialsDao.findByResetToken("RESET_TOKEN_2"); |
|||
assertNotNull(userCredentials); |
|||
assertEquals("4b9e010c-27d5-11e7-93ae-92361f002671", userCredentials.getId().toString()); |
|||
} |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.user; |
|||
|
|||
import com.fasterxml.jackson.databind.JsonNode; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.github.springtestdbunit.annotation.DatabaseSetup; |
|||
import org.junit.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.thingsboard.server.common.data.User; |
|||
import org.thingsboard.server.common.data.id.CustomerId; |
|||
import org.thingsboard.server.common.data.id.TenantId; |
|||
import org.thingsboard.server.common.data.id.UserId; |
|||
import org.thingsboard.server.common.data.security.Authority; |
|||
import org.thingsboard.server.dao.AbstractJpaDaoTest; |
|||
import org.thingsboard.server.dao.user.UserDao; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/18/2017. |
|||
*/ |
|||
public class JpaUserDaoTest extends AbstractJpaDaoTest { |
|||
|
|||
@Autowired |
|||
private UserDao userDao; |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/users.xml") |
|||
public void testFindAll() { |
|||
List<User> users = userDao.find(); |
|||
assertEquals(users.size(), 5); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/users.xml") |
|||
public void findByEmail() { |
|||
User user = userDao.findByEmail("sysadm@thingsboard.org"); |
|||
assertNotNull("User is expected to be not null", user); |
|||
assertEquals("9cb58ba0-27c1-11e7-93ae-92361f002671", user.getId().toString()); |
|||
assertEquals("c97ea14e-27c1-11e7-93ae-92361f002671", user.getTenantId().toString()); |
|||
assertEquals("cdf9c79e-27c1-11e7-93ae-92361f002671", user.getCustomerId().toString()); |
|||
assertEquals(Authority.SYS_ADMIN, user.getAuthority()); |
|||
assertEquals("John", user.getFirstName()); |
|||
assertEquals("Doe", user.getLastName()); |
|||
assertEquals("{\"key\":\"value-0\"}", user.getAdditionalInfo().toString()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/users.xml") |
|||
public void testSave() throws IOException { |
|||
User user = new User(); |
|||
user.setId(new UserId(UUID.fromString("cd481534-27cc-11e7-93ae-92361f002671"))); |
|||
user.setTenantId(new TenantId(UUID.fromString("1edcb2c6-27cb-11e7-93ae-92361f002671"))); |
|||
user.setCustomerId(new CustomerId(UUID.fromString("51477cb4-27cb-11e7-93ae-92361f002671"))); |
|||
user.setEmail("user@thingsboard.org"); |
|||
user.setFirstName("Jackson"); |
|||
user.setLastName("Roberts"); |
|||
ObjectMapper mapper = new ObjectMapper(); |
|||
String additionalInfo = "{\"key\":\"value-100\"}"; |
|||
JsonNode jsonNode = mapper.readTree(additionalInfo); |
|||
user.setAdditionalInfo(jsonNode); |
|||
userDao.save(user); |
|||
assertEquals(6, userDao.find().size()); |
|||
User savedUser = userDao.findByEmail("user@thingsboard.org"); |
|||
assertNotNull(savedUser); |
|||
} |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
/** |
|||
* Copyright © 2016-2017 The Thingsboard Authors |
|||
* |
|||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|||
* you may not use this file except in compliance with the License. |
|||
* You may obtain a copy of the License at |
|||
* |
|||
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
* |
|||
* Unless required by applicable law or agreed to in writing, software |
|||
* distributed under the License is distributed on an "AS IS" BASIS, |
|||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|||
* See the License for the specific language governing permissions and |
|||
* limitations under the License. |
|||
*/ |
|||
package org.thingsboard.server.dao.sql.widget; |
|||
|
|||
import com.datastax.driver.core.utils.UUIDs; |
|||
import com.github.springtestdbunit.annotation.DatabaseSetup; |
|||
import org.junit.Ignore; |
|||
import org.junit.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.thingsboard.server.common.data.id.WidgetsBundleId; |
|||
import org.thingsboard.server.common.data.page.TextPageLink; |
|||
import org.thingsboard.server.common.data.widget.WidgetsBundle; |
|||
import org.thingsboard.server.dao.AbstractJpaDaoTest; |
|||
import org.thingsboard.server.dao.widget.WidgetsBundleDao; |
|||
|
|||
import java.util.List; |
|||
import java.util.UUID; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
/** |
|||
* Created by Valerii Sosliuk on 4/23/2017. |
|||
*/ |
|||
public class JpaWidgetsBundleDaoTest extends AbstractJpaDaoTest { |
|||
|
|||
@Autowired |
|||
private WidgetsBundleDao widgetsBundleDao; |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/widgets_bundle.xml") |
|||
public void testFindAll() { |
|||
assertEquals(7, widgetsBundleDao.find().size()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/widgets_bundle.xml") |
|||
public void testFindWidgetsBundleByTenantIdAndAlias() { |
|||
WidgetsBundle widgetsBundle = widgetsBundleDao.findWidgetsBundleByTenantIdAndAlias( |
|||
UUID.fromString("250aca8e-2825-11e7-93ae-92361f002671"), "WB3"); |
|||
assertEquals("44e6af4e-2825-11e7-93ae-92361f002671", widgetsBundle.getId().toString()); |
|||
} |
|||
|
|||
@Test |
|||
@DatabaseSetup("classpath:dbunit/empty_dataset.xml") |
|||
public void testFindSystemWidgetsBundles() { |
|||
for (int i = 0; i < 30; i++) { |
|||
WidgetsBundle widgetsBundle = new WidgetsBundle(); |
|||
widgetsBundle.setAlias("WB" + i); |
|||
widgetsBundle.setTitle("WB" + i); |
|||
widgetsBundle.setId(new WidgetsBundleId(UUIDs.timeBased())); |
|||
widgetsBundleDao.save(widgetsBundle); |
|||
} |
|||
assertEquals(30, widgetsBundleDao.find().size()); |
|||
// Get first page
|
|||
TextPageLink textPageLink1 = new TextPageLink(10, "WB"); |
|||
List<WidgetsBundle> widgetsBundles1 = widgetsBundleDao.findSystemWidgetsBundles(textPageLink1); |
|||
assertEquals(10, widgetsBundles1.size()); |
|||
for (WidgetsBundle widgetsBundle : widgetsBundles1) { |
|||
System.out.println(widgetsBundle.getSearchText()); |
|||
} |
|||
TextPageLink textPageLink2 = new TextPageLink(10, "WB", widgetsBundles1.get(9).getId().getId(), null); |
|||
List<WidgetsBundle> widgetsBundles2 = widgetsBundleDao.findSystemWidgetsBundles(textPageLink2); |
|||
assertEquals(10, widgetsBundles1.size()); |
|||
for (WidgetsBundle widgetsBundle : widgetsBundles2) { |
|||
System.out.println(widgetsBundle.getSearchText()); |
|||
} |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
<dataset></dataset> |
|||
@ -0,0 +1,28 @@ |
|||
<dataset> |
|||
<user_credentials |
|||
id="uuid'3ed10af0-27d5-11e7-93ae-92361f002671'" |
|||
user_id="uuid'44ee8552-27d5-11e7-93ae-92361f002671'" |
|||
enabled="true" |
|||
password="password" |
|||
activate_token="ACTIVATE_TOKEN_1" |
|||
reset_token="RESET_TOKEN_1" |
|||
/> |
|||
<user_credentials |
|||
id="uuid'4b9e010c-27d5-11e7-93ae-92361f002671'" |
|||
user_id="uuid'787827e6-27d7-11e7-93ae-92361f002671'" |
|||
enabled="true" |
|||
password="password" |
|||
activate_token="ACTIVATE_TOKEN_2" |
|||
reset_token="RESET_TOKEN_2" |
|||
/> |
|||
<!-- |
|||
<user_credentials |
|||
id="" |
|||
user_id="" |
|||
enabled="true" |
|||
password="password" |
|||
activate_token="" |
|||
reset_token="" |
|||
/> |
|||
--> |
|||
</dataset> |
|||
@ -0,0 +1,52 @@ |
|||
<dataset> |
|||
<user id="uuid'9cb58ba0-27c1-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'c97ea14e-27c1-11e7-93ae-92361f002671'" |
|||
customer_id="uuid'cdf9c79e-27c1-11e7-93ae-92361f002671'" |
|||
authority="0" |
|||
email="sysadm@thingsboard.org" |
|||
search_text="SYSADM SEARCH TEXT" |
|||
first_name="John" |
|||
last_name="Doe" |
|||
additional_info="{"key":"value-0"}" |
|||
/> |
|||
<user id="uuid'1312f328-27c7-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'1e1cd4c8-27c7-11e7-93ae-92361f002671'" |
|||
customer_id="uuid'22fe91e8-27c7-11e7-93ae-92361f002671'" |
|||
authority="1" |
|||
email="tenantadm1@thingsboard.org" |
|||
search_text="TENANTADM1 SEARCH TEXT" |
|||
first_name="Samuel" |
|||
last_name="Serif" |
|||
additional_info="{"key":"value-11"}" |
|||
/> |
|||
<user id="uuid'2b090dde-27ca-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'1e1cd4c8-27c7-11e7-93ae-92361f002671'" |
|||
customer_id="uuid'34be535c-27ca-11e7-93ae-92361f002671'" |
|||
authority="1" |
|||
email="tenantadm2@thingsboard.org" |
|||
search_text="TENANTADM2 SEARCH TEXT" |
|||
first_name="Penny" |
|||
last_name="Morgan" |
|||
additional_info="{"key":"value-12"}" |
|||
/> |
|||
<user id="uuid'cc8c1ca8-27c7-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'd2e27caa-27c7-11e7-93ae-92361f002671'" |
|||
customer_id="uuid'd89e128a-27c7-11e7-93ae-92361f002671'" |
|||
authority="2" |
|||
email="customeruser@thingsboard.org" |
|||
search_text="CUSTOMER USER SEARCH TEXT" |
|||
first_name="Norman" |
|||
last_name="Gordon" |
|||
additional_info="{"key":"value-2"}" |
|||
/> |
|||
<user id="uuid'edb2de58-27c7-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'f229675e-27c7-11e7-93ae-92361f002671'" |
|||
customer_id="uuid'f7a3d4e4-27c7-11e7-93ae-92361f002671'" |
|||
authority="3" |
|||
email="refreshtoken@thingsboard.org" |
|||
search_text="REFRESH TOKEN SEARCH TEXT" |
|||
first_name="Dianne" |
|||
last_name="Wensleydale" |
|||
additional_info="{"key":"value-3"}" |
|||
/> |
|||
</dataset> |
|||
@ -0,0 +1,56 @@ |
|||
<dataset> |
|||
<widgets_bundle |
|||
id="uuid'250ac7b4-2825-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'250aca8e-2825-11e7-93ae-92361f002671'" |
|||
alias="WB1" |
|||
title="Widgets Bundle 1" |
|||
search_text="WB SEARCH TEXT 1" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'3269c18a-2825-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'3269c18a-2825-11e7-93ae-92361f002671'" |
|||
alias="WB2" |
|||
title="Widgets Bundle 2" |
|||
search_text="WB SEARCH TEXT 2" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'44e6af4e-2825-11e7-93ae-92361f002671'" |
|||
tenant_id="uuid'250aca8e-2825-11e7-93ae-92361f002671'" |
|||
alias="WB3" |
|||
title="Widgets Bundle 3" |
|||
search_text="WB SEARCH TEXT 3" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'696dc9b4-2830-11e7-93ae-92361f002671'" |
|||
alias="WB4" |
|||
title="Widgets Bundle 4" |
|||
search_text="SYSTEM BUNDLE 1" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'1a83fc50-2840-11e7-93ae-92361f002671'" |
|||
alias="WB5" |
|||
title="Widgets Bundle 5" |
|||
search_text="SYSTEM BUNDLE 2" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'6a593dde-2841-11e7-93ae-92361f002671'" |
|||
alias="WB6" |
|||
title="Widgets Bundle 6" |
|||
search_text="SYSTEM BUNDLE 1" |
|||
/> |
|||
<widgets_bundle |
|||
id="uuid'3beb4b1a-294d-11e7-93ae-92361f002671'" |
|||
alias="WB6" |
|||
title="Widgets Bundle 7" |
|||
search_text="ABC DEF" |
|||
/> |
|||
<!-- |
|||
<widgets_bundle |
|||
id="" |
|||
tenant_id="" |
|||
alias="" |
|||
title="" |
|||
search_text="" |
|||
/> |
|||
--> |
|||
</dataset> |
|||
@ -0,0 +1,7 @@ |
|||
cassandra.enabled=false |
|||
|
|||
sql.enabled=true |
|||
sql.datasource.url=jdbc:h2:mem:thingsboard |
|||
sql.datasource.username=sa |
|||
sql.datasource.password= |
|||
|
|||
Loading…
Reference in new issue