Skip to content

Commit

Permalink
Minified springreset example
Browse files Browse the repository at this point in the history
  • Loading branch information
tdl-jturner committed Aug 20, 2019
1 parent 16b054a commit 7bd3df7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 130 deletions.
2 changes: 2 additions & 0 deletions casquatch-examples/.setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,5 @@ echo "---------------------------------------------"
echo "Generate Entity"
echo "---------------------------------------------"
java -Dconfig.file=src/main/resources/application.conf -jar $GENERATOR
mkdir -p src/test/java/com/tmobile/opensource/casquatch/examples/$NAME/
mv src/main/java/com/tmobile/opensource/casquatch/examples/$NAME/*EmbeddedTests.java src/test/java/com/tmobile/opensource/casquatch/examples/$NAME/
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,31 @@
import com.tmobile.opensource.casquatch.annotation.CasquatchSpring;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
* Sample application for Rest API. Swagger available at http://localhost:8080/springrest/swagger-ui.html
*/
@SpringBootApplication
@CasquatchSpring(generateRestDao = true)
@EnableSwagger2
public class SpringRestApplication {
public static void main(String[] args) {
SpringApplication.run(SpringRestApplication.class, args);
}

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.tmobile.opensource.casquatch.examples.springrest"))
.paths(PathSelectors.any())
.build();
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import com.tmobile.opensource.casquatch.AbstractCasquatchEntity;
import com.tmobile.opensource.casquatch.annotation.CasquatchEntity;
import com.tmobile.opensource.casquatch.annotation.CasquatchIgnore;
import com.tmobile.opensource.casquatch.annotation.ClusteringColumn;
import com.tmobile.opensource.casquatch.annotation.PartitionKey;
import java.lang.Integer;
Expand All @@ -13,8 +12,6 @@
import lombok.NoArgsConstructor;
import lombok.Setter;

import org.apache.commons.text.TextStringBuilder;

@CasquatchEntity
@Getter @Setter @NoArgsConstructor
public class TableName extends AbstractCasquatchEntity {
Expand All @@ -26,44 +23,5 @@ public class TableName extends AbstractCasquatchEntity {

private String colOne;
private String colTwo;

/**
* Generated: Initialize with Partition Keys
* @param keyOne Partition Key Named key_one
*/
public TableName(Integer keyOne) {
this.setKeyOne(keyOne);
}

/**
* Generated: Initialize with Partition and Clustering Keys
* @param keyOne Partition Key Named key_one
* @param keyTwo Clustering Key Named key_two
*/
public TableName(Integer keyOne,Integer keyTwo) {
this.setKeyOne(keyOne);
this.setKeyTwo(keyTwo);
}

/**
* Generated: Instance of object containing primary keys only
*/
@CasquatchIgnore
public TableName keys() {
TableName tableName = new TableName();
tableName.setKeyOne(this.getKeyOne());
tableName.setKeyTwo(this.getKeyTwo());
return tableName;
}

/**
* Generated: Returns DDL
* @return DDL for table
*/
public static String getDDL() {
TextStringBuilder ddl = new TextStringBuilder();
ddl.appendln("CREATE TABLE \"table_name\" ( \"key_one\" int, \"key_two\" int, \"col_one\" text, \"col_two\" text, PRIMARY KEY (\"key_one\", \"key_two\") ) WITH bloom_filter_fp_chance = 0.01 AND caching = {'keys':'ALL','rows_per_partition':'NONE'} AND comment = '' AND compaction = {'class':'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy','max_threshold':'32','min_threshold':'4'} AND compression = {'chunk_length_in_kb':'64','class':'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND extensions = {} AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair_chance = 0.0 AND speculative_retry = '99PERCENTILE';");
return ddl.toString();
}
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
casquatch {
basic {
contact-points = [
"127.0.0.1:9064"
"127.0.0.1:9073"
]
session-keyspace = springrest
load-balancing-policy.local-datacenter=datacenter1
Expand All @@ -16,6 +16,7 @@ casquatch {
contactPoints=${casquatch.basic.contact-points}
keyspace=${casquatch.basic.session-keyspace}
datacenter=${casquatch.basic.load-balancing-policy.local-datacenter}
minify=true
}
}

Expand Down

This file was deleted.

0 comments on commit 7bd3df7

Please sign in to comment.