-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,582 additions
and
1,147 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?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.0.0.xsd"> | ||
<parent> | ||
<artifactId>hydraql-tests</artifactId> | ||
<groupId>com.hydraql</groupId> | ||
<version>1.0.0</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>hydraql-template-test</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<maven.deploy.skip>true</maven.deploy.skip> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.hydraql</groupId> | ||
<artifactId>hydraql-tests-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.hydraql</groupId> | ||
<artifactId>hydraql-template_2.2</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>hydraql-template-test</finalName> | ||
</build> | ||
|
||
</project> |
85 changes: 85 additions & 0 deletions
85
hydraql-tests/hydraql-template-test/src/main/java/com/hydraql/template/model/CityModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.hydraql.template.model; | ||
|
||
import com.hydraql.common.annotations.HBaseColumn; | ||
import com.hydraql.common.annotations.HBaseRowKey; | ||
import com.hydraql.common.annotations.HBaseTable; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author leojie 2022/11/5 13:56 | ||
*/ | ||
@HBaseTable(namespaceName = "default", tableName = "test_table", defaultFamilyName = "f1") | ||
public class CityModel { | ||
@HBaseRowKey | ||
private String cityId; | ||
private String cityName; | ||
private String cityAddress; | ||
|
||
@HBaseColumn(familyName = "f2") | ||
private Integer cityArea; | ||
@HBaseColumn(familyName = "f2", columnName = "TOTAL_POPULATION", toUpperCase = true) | ||
private Integer totalPopulation; | ||
@HBaseColumn(familyName = "f2", columnName = "cityTagList") | ||
private List<CityTag> cityTagList; | ||
|
||
public String getCityId() { | ||
return cityId; | ||
} | ||
|
||
public void setCityId(String cityId) { | ||
this.cityId = cityId; | ||
} | ||
|
||
public String getCityName() { | ||
return cityName; | ||
} | ||
|
||
public void setCityName(String cityName) { | ||
this.cityName = cityName; | ||
} | ||
|
||
public String getCityAddress() { | ||
return cityAddress; | ||
} | ||
|
||
public void setCityAddress(String cityAddress) { | ||
this.cityAddress = cityAddress; | ||
} | ||
|
||
public Integer getCityArea() { | ||
return cityArea; | ||
} | ||
|
||
public void setCityArea(Integer cityArea) { | ||
this.cityArea = cityArea; | ||
} | ||
|
||
public Integer getTotalPopulation() { | ||
return totalPopulation; | ||
} | ||
|
||
public void setTotalPopulation(Integer totalPopulation) { | ||
this.totalPopulation = totalPopulation; | ||
} | ||
|
||
public List<CityTag> getCityTagList() { | ||
return cityTagList; | ||
} | ||
|
||
public void setCityTagList(List<CityTag> cityTagList) { | ||
this.cityTagList = cityTagList; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CityModel{" + | ||
"cityId='" + cityId + '\'' + | ||
", cityName='" + cityName + '\'' + | ||
", cityAddress='" + cityAddress + '\'' + | ||
", cityArea=" + cityArea + | ||
", totalPopulation=" + totalPopulation + | ||
", cityTagList=" + cityTagList + | ||
'}'; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...l-tests/hydraql-template-test/src/main/java/com/hydraql/template/model/CityModelUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.hydraql.template.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author leojie 2023/8/4 23:49 | ||
*/ | ||
public class CityModelUtil { | ||
public static CityModel createDefaultCityModel() { | ||
return cityModel("a10001", "北京", "北京市", 1000000, 40000000, | ||
Arrays.asList("首都", "旅游城市")); | ||
} | ||
|
||
public static List<CityModel> createDefaultCityModelList() { | ||
List<CityModel> cityModels = new ArrayList<>(4); | ||
cityModels.add(cityModel("a10001", "北京", "北京市", 1000000, 40000000, | ||
Arrays.asList("首都", "旅游城市"))); | ||
cityModels.add(cityModel("a10002", "上海", "上海市", 1000000, 20000000, | ||
Arrays.asList("魔都", "旅游城市"))); | ||
cityModels.add(cityModel("b20001", "广州", "广州市", 1000000, 40000000, | ||
Arrays.asList("沿海城市", "旅游城市"))); | ||
cityModels.add(cityModel("b20002", "深圳", "深圳市", 1000000, 40000000, | ||
Arrays.asList("沿海城市", "发达地区"))); | ||
return cityModels; | ||
} | ||
|
||
public static List<CityModel> createDefaultMultiVersionsCityModelList() { | ||
List<CityModel> cityModels = new ArrayList<>(4); | ||
cityModels.add(cityModel("a1000112", "北京", "北京市", 1000001, 40000001, | ||
Arrays.asList("首都", "旅游城市"))); | ||
cityModels.add(cityModel("a1000112", "上海", "上海市", 1000002, 20000002, | ||
Arrays.asList("魔都", "旅游城市"))); | ||
cityModels.add(cityModel("a1000112", "广州", "广州市", 1000003, 40000003, | ||
null)); | ||
cityModels.add(cityModel("a1000112", "深圳", "深圳市", 1000004, 40000004, | ||
Arrays.asList("沿海城市", "发达地区"))); | ||
return cityModels; | ||
} | ||
|
||
public static CityModel cityModel(String cityId, String cityName, String cityAddress, int cityArea, int totalPopulation, | ||
List<String> tagNameList) { | ||
CityModel cityModel = new CityModel(); | ||
cityModel.setCityId(cityId); | ||
cityModel.setCityName(cityName); | ||
cityModel.setCityAddress(cityAddress); | ||
cityModel.setCityArea(cityArea); | ||
cityModel.setTotalPopulation(totalPopulation); | ||
if (tagNameList != null) { | ||
cityModel.setCityTagList(tagNameList.stream().map(CityTag::new).collect(Collectors.toList())); | ||
} | ||
return cityModel; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
hydraql-tests/hydraql-template-test/src/main/java/com/hydraql/template/model/CityTag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.hydraql.template.model; | ||
|
||
/** | ||
* @author leojie 2022/11/5 13:59 | ||
*/ | ||
public class CityTag { | ||
private String tagName; | ||
|
||
public CityTag(String tagName) { | ||
this.tagName = tagName; | ||
} | ||
|
||
public String getTagName() { | ||
return tagName; | ||
} | ||
|
||
public void setTagName(String tagName) { | ||
this.tagName = tagName; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CityTag{" + | ||
"tagName='" + tagName + '\'' + | ||
'}'; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.