Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
TestGhouse
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ghousemohiddinkhan
TestGhouse
Commits
870e06a4
Commit
870e06a4
authored
Nov 26, 2022
by
ghousemohiddinkhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test use case
parent
b8f775d4
Pipeline
#2343
failed with stages
Changes
17
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
537 additions
and
5 deletions
+537
-5
.classpath
.classpath
+32
-0
.gitignore
.gitignore
+1
-0
.project
.project
+23
-0
org.eclipse.core.resources.prefs
.settings/org.eclipse.core.resources.prefs
+5
-0
org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.core.prefs
+9
-0
org.eclipse.m2e.core.prefs
.settings/org.eclipse.m2e.core.prefs
+4
-0
pom.xml
pom.xml
+48
-5
Application.java
src/main/java/com/altimetrik/Application.java
+2
-0
CustomerController.java
...n/java/com/altimetrik/controllers/CustomerController.java
+64
-0
Customer.java
src/main/java/com/altimetrik/model/Customer.java
+190
-0
PlanName.java
src/main/java/com/altimetrik/model/PlanName.java
+5
-0
PlanNameEntity.java
src/main/java/com/altimetrik/model/PlanNameEntity.java
+40
-0
PlanStatus.java
src/main/java/com/altimetrik/model/PlanStatus.java
+5
-0
CustomerRepo.java
src/main/java/com/altimetrik/repository/CustomerRepo.java
+17
-0
CustomerService.java
src/main/java/com/altimetrik/service/CustomerService.java
+16
-0
CustomerServiceImpl.java
...main/java/com/altimetrik/service/CustomerServiceImpl.java
+60
-0
application.properties
src/main/resources/application.properties
+16
-0
No files found.
.classpath
0 → 100644
View file @
870e06a4
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
output=
"target/classes"
path=
"src/main/java"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
excluding=
"**"
kind=
"src"
output=
"target/classes"
path=
"src/main/resources"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"src"
output=
"target/test-classes"
path=
"src/test/java"
>
<attributes>
<attribute
name=
"optional"
value=
"true"
/>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
<attribute
name=
"test"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"con"
path=
"org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"
>
<attributes>
<attribute
name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry
kind=
"output"
path=
"target/classes"
/>
</classpath>
.gitignore
0 → 100644
View file @
870e06a4
/target/
.project
0 → 100644
View file @
870e06a4
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
demo
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>
org.eclipse.m2e.core.maven2Builder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
org.eclipse.m2e.core.maven2Nature
</nature>
</natures>
</projectDescription>
.settings/org.eclipse.core.resources.prefs
0 → 100644
View file @
870e06a4
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
870e06a4
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
.settings/org.eclipse.m2e.core.prefs
0 → 100644
View file @
870e06a4
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
pom.xml
View file @
870e06a4
...
...
@@ -31,11 +31,8 @@
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
@@ -68,6 +65,52 @@
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<!--
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.4.0</version>
</dependency>
-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
<version>
2.2.2.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-core
</artifactId>
<version>
5.2.2.Final
</version>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-entitymanager
</artifactId>
<version>
3.6.0.Final
</version>
</dependency>
<dependency>
<groupId>
org.hibernate
</groupId>
<artifactId>
hibernate-validator
</artifactId>
<version>
4.1.0.Final
</version>
</dependency>
<!-- MySQL Connector-->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
<version>
8.0.11
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
<version>
2.9.4
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.16.18
</version>
</dependency>
<!-- <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
...
...
src/main/java/com/altimetrik/Application.java
View file @
870e06a4
...
...
@@ -2,10 +2,12 @@ package com.altimetrik;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.scheduling.annotation.EnableAsync
;
@SpringBootApplication
@EnableAsync
@ComponentScan
({
"com.altimetrik.*"
,
"com.altimetrik.controllers"
})
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/altimetrik/controllers/CustomerController.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
controllers
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.altimetrik.model.Customer
;
import
com.altimetrik.model.PlanName
;
import
com.altimetrik.model.PlanStatus
;
import
com.altimetrik.service.CustomerService
;
@RestController
@RequestMapping
(
value
=
"/customer"
)
public
class
CustomerController
{
@Autowired
CustomerService
customerService
;
@GetMapping
(
value
=
"/all"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
ALL_VALUE
)
public
ResponseEntity
<
List
<
Customer
>>
getCustomers
()
{
// System.out.println();
return
new
ResponseEntity
<
List
<
Customer
>>(
customerService
.
getAll
(),
HttpStatus
.
OK
);
}
// @GetMapping(value = "/allSort", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.ALL_VALUE)
// public ResponseEntity<List<Customer>> getCustomersSort() {
//// System.out.println();
// return new ResponseEntity<List<Customer>>(customerService.getAllSort(), HttpStatus.OK);
//
// }
@PostMapping
(
value
=
"/add"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
ALL_VALUE
)
public
ResponseEntity
<
Customer
>
addCustomer
(
@RequestBody
Customer
cust
)
{
return
new
ResponseEntity
<
Customer
>(
customerService
.
addCust
(
cust
),
HttpStatus
.
OK
);
}
@GetMapping
(
value
=
"/allPlans"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
ALL_VALUE
)
public
ResponseEntity
<
List
<
PlanName
>>
getPlans
()
{
// System.out.println();
return
new
ResponseEntity
<
List
<
PlanName
>>(
Arrays
.
asList
(
PlanName
.
values
()),
HttpStatus
.
OK
);
}
@GetMapping
(
value
=
"/allPlanStatus"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
ALL_VALUE
)
public
ResponseEntity
<
List
<
PlanStatus
>>
getPlanStatus
()
{
// System.out.println();
return
new
ResponseEntity
<
List
<
PlanStatus
>>(
Arrays
.
asList
(
PlanStatus
.
values
()),
HttpStatus
.
OK
);
}
}
src/main/java/com/altimetrik/model/Customer.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
model
;
import
java.io.Serializable
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
import
lombok.Setter
;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table
(
name
=
"CUSTOMER"
)
@JsonIgnoreProperties
@Data
public
class
Customer
implements
Serializable
{
public
Customer
()
{
super
();
// TODO Auto-generated constructor stub
}
@Override
public
String
toString
()
{
return
"Customer [id="
+
id
+
", name="
+
name
+
", dob="
+
dob
+
", email="
+
email
+
", adhaar="
+
adhaar
+
", registrationdate="
+
registrationdate
+
", mobile="
+
mobile
+
", planname="
+
planname
+
", plancost="
+
plancost
+
", validity="
+
validity
+
", planstatus="
+
planstatus
+
"]"
;
}
public
Customer
(
Long
id
,
String
name
,
String
dob
,
String
email
,
String
adhaar
,
String
registrationdate
,
String
mobile
,
PlanName
planname
,
String
plancost
,
String
validity
,
PlanStatus
planstatus
)
{
super
();
this
.
id
=
id
;
this
.
name
=
name
;
this
.
dob
=
dob
;
this
.
email
=
email
;
this
.
adhaar
=
adhaar
;
this
.
registrationdate
=
registrationdate
;
this
.
mobile
=
mobile
;
this
.
planname
=
planname
;
this
.
plancost
=
plancost
;
this
.
validity
=
validity
;
this
.
planstatus
=
planstatus
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDob
()
{
return
dob
;
}
public
void
setDob
(
String
dob
)
{
this
.
dob
=
dob
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
String
getAdhaar
()
{
return
adhaar
;
}
public
void
setAdhaar
(
String
adhaar
)
{
this
.
adhaar
=
adhaar
;
}
public
String
getRegistrationdate
()
{
return
registrationdate
;
}
public
void
setRegistrationdate
(
String
registrationdate
)
{
this
.
registrationdate
=
registrationdate
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
public
PlanName
getPlanname
()
{
return
planname
;
}
public
void
setPlanname
(
PlanName
planname
)
{
this
.
planname
=
planname
;
}
public
String
getPlancost
()
{
return
plancost
;
}
public
void
setPlancost
(
String
plancost
)
{
this
.
plancost
=
plancost
;
}
public
String
getValidity
()
{
return
validity
;
}
public
void
setValidity
(
String
validity
)
{
this
.
validity
=
validity
;
}
public
PlanStatus
getPlanstatus
()
{
return
planstatus
;
}
public
void
setPlanstatus
(
PlanStatus
planstatus
)
{
this
.
planstatus
=
planstatus
;
}
public
static
long
getSerialversionuid
()
{
return
serialVersionUID
;
}
private
final
static
long
serialVersionUID
=
770234L
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@Column
(
name
=
"name"
,
length
=
50
,
nullable
=
false
,
unique
=
false
)
private
String
name
;
@Column
(
name
=
"dob"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
dob
;
@Column
(
name
=
"email"
,
length
=
40
,
nullable
=
false
,
unique
=
false
)
private
String
email
;
@Column
(
name
=
"adhaar"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
adhaar
;
@Column
(
name
=
"registrationdate"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
registrationdate
;
@Column
(
name
=
"mobile"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
mobile
;
@Column
(
name
=
"planname"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
@Enumerated
(
EnumType
.
STRING
)
private
PlanName
planname
;
@Column
(
name
=
"plancost"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
plancost
;
@Column
(
name
=
"validity"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
private
String
validity
;
@Column
(
name
=
"planstatus"
,
length
=
20
,
nullable
=
false
,
unique
=
false
)
@Enumerated
(
EnumType
.
STRING
)
private
PlanStatus
planstatus
;
}
src/main/java/com/altimetrik/model/PlanName.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
model
;
public
enum
PlanName
{
Platinum365
,
Gold180
,
Silver90
}
src/main/java/com/altimetrik/model/PlanNameEntity.java
0 → 100644
View file @
870e06a4
//package com.altimetrik.model;
//
//import java.io.Serializable;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
//import javax.persistence.Table;
//
//import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
//
//import lombok.AllArgsConstructor;
//import lombok.Data;
//import lombok.Getter;
//import lombok.NoArgsConstructor;
//import lombok.Setter;
//
//@Getter
//@Setter
//@NoArgsConstructor
//@AllArgsConstructor
//@Entity
//@Table(name = "PLAN_NAME")
//@JsonIgnoreProperties
//@Data
//
//public class PlanNameEntity implements Serializable {
//
// private final static long serialVersionUID = 770223334L;
//
//
// @Id
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// @Column(name = "name", length = 50, nullable = false, unique = false)
// private String name;
//}
src/main/java/com/altimetrik/model/PlanStatus.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
model
;
public
enum
PlanStatus
{
ACTIVE
,
INACTIVE
}
src/main/java/com/altimetrik/repository/CustomerRepo.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
repository
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
com.altimetrik.model.Customer
;
@Repository
public
interface
CustomerRepo
extends
JpaRepository
<
Customer
,
Long
>
{
// @Query("select * from customer order by name asc")
// List<Customer> getAllSort();
}
src/main/java/com/altimetrik/service/CustomerService.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
service
;
import
java.util.List
;
import
org.springframework.data.jpa.repository.Query
;
import
com.altimetrik.model.Customer
;
public
interface
CustomerService
{
List
<
Customer
>
getAll
();
Customer
addCust
(
Customer
cust
);
// List<Customer> getAllSort();
}
src/main/java/com/altimetrik/service/CustomerServiceImpl.java
0 → 100644
View file @
870e06a4
package
com
.
altimetrik
.
service
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.altimetrik.model.Customer
;
import
com.altimetrik.repository.CustomerRepo
;
@Service
public
class
CustomerServiceImpl
implements
CustomerService
{
@Autowired
CustomerRepo
custRepo
;
@Override
public
List
<
Customer
>
getAll
()
{
List
<
Customer
>
allCust
=
custRepo
.
findAll
();
allCust
.
stream
().
filter
(
c
->
c
.
getPlanstatus
().
equals
(
"ACTIVE"
)).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"allCust :"
+
allCust
.
get
(
0
));
return
allCust
;
}
@Override
public
Customer
addCust
(
Customer
cust
)
{
// Customer cust1 = new Customer();
// cust1.setAdhaar(cust.getAdhaar());
// cust1.setDob(cust.getDob());
// cust1.setEmail(cust.getEmail());
// cust1.setMobile(cust.getMobile());
// cust1.setName(cust.getName());
// cust1.setPlancost(cust.getPlancost());
// cust1.setPlanname(cust.getPlanname());
// cust1.setPlanstatus(cust.getPlanstatus());
// cust1.setRegistrationdate(cust.getRegistrationdate());
// cust1.setValidity(cust.getValidity());
// System.out.println("cust1 :" + cust);
System
.
out
.
println
(
"cust1 :"
+
cust
);
return
custRepo
.
save
(
cust
);
}
// @Override
// public List<Customer> getAllSort() {
// // TODO Auto-generated method stub
// return custRepo.getAllSort();
// }
}
src/main/resources/application.properties
View file @
870e06a4
server.contextPath
=
/gmk
server.servlet.context-path
=
/gmk
server.port
=
8081
spring.datasource.url
=
jdbc:mysql://localhost:3306/gmktest?autoReconnect=true&useSSL=false&createDatabaseIfNotExist=true
spring.datasource.username
=
root
spring.datasource.password
=
root
spring.jpa.hibernate.ddl-auto
=
update
spring.datasource.driverClassName
=
com.mysql.jdbc.Driver
spring.datasource.driver-class-name
=
com.mysql.jdbc.Driver
spring.jpa.database-platform
=
org.hibernate.dialect.MySQL5InnoDBDialect
spring.data.jpa.repositories.enabled
=
true
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment