-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
further implementations for #65 - still just in concept phase, nothin…
…g works
- Loading branch information
Showing
9 changed files
with
365 additions
and
29 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
wilma-service-api/src/main/java/com/epam/wilma/service/unit/RequestConditionBuilder.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,74 @@ | ||
package com.epam.wilma.service.unit; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
import com.epam.wilma.service.unit.request.RequestCondition; | ||
|
||
/** | ||
* A Request Condition class builder. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class RequestConditionBuilder { | ||
|
||
public RequestConditionBuilder andStart() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder andEnd() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder orStart() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder orEnd() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder not() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder condition() { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder comingFrom(String localhost) { | ||
return this; | ||
} | ||
|
||
public ResponseDescriptorBuilder willResponseWith() { | ||
return new ResponseDescriptorBuilder(build()); | ||
} | ||
|
||
public RequestCondition build() { | ||
return new RequestCondition(); | ||
} | ||
|
||
public RequestConditionBuilder withHeader(String blah) { | ||
return this; | ||
} | ||
|
||
public RequestConditionBuilder textInUrl(String textInUrl) { | ||
return this; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
wilma-service-api/src/main/java/com/epam/wilma/service/unit/ResponseDescriptorBuilder.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,63 @@ | ||
package com.epam.wilma.service.unit; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
import com.epam.wilma.service.unit.request.RequestCondition; | ||
import com.epam.wilma.service.unit.request.RequestConditionBase; | ||
import com.epam.wilma.service.unit.response.ResponseDescriptor; | ||
|
||
/** | ||
* Builder class for building a complete Stub Configuration. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class ResponseDescriptorBuilder { | ||
private RequestConditionBase requestConditionBase; | ||
|
||
public ResponseDescriptorBuilder(RequestCondition requestCondition) { | ||
this.requestConditionBase = requestCondition; | ||
} | ||
|
||
public ResponseDescriptorBuilder plainTextResponse(String plainTextResponse) { | ||
return this; | ||
} | ||
|
||
public ResponseDescriptor buildResponseDescriptor() { | ||
return new ResponseDescriptor(); | ||
} | ||
|
||
public Stub build() { | ||
//need to validate both the request condition, and the response descriptor | ||
Stub stub = new Stub(requestConditionBase, buildResponseDescriptor()); | ||
return stub; | ||
} | ||
|
||
public ResponseDescriptorBuilder withStatus(int i) { | ||
return this; | ||
} | ||
|
||
public ResponseDescriptorBuilder applyFormatter() { | ||
return this; | ||
} | ||
|
||
public ResponseDescriptorBuilder generatedResponse() { | ||
return this; | ||
} | ||
} |
43 changes: 40 additions & 3 deletions
43
wilma-service-api/src/main/java/com/epam/wilma/service/unit/Stub.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 |
---|---|---|
@@ -1,12 +1,49 @@ | ||
package com.epam.wilma.service.unit; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
import com.epam.wilma.service.unit.request.RequestCondition; | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
import com.epam.wilma.service.unit.request.RequestConditionBase; | ||
import com.epam.wilma.service.unit.response.ResponseDescriptor; | ||
|
||
/** | ||
* Created by tkohegyi on 2016. 01. 27.. | ||
* Class that represents a stubbed request-response pairs. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class Stub { | ||
private RequestCondition requestCondition; | ||
private RequestConditionBase requestConditionBase; | ||
private ResponseDescriptor responseDescriptor; | ||
|
||
public Stub(RequestConditionBase requestConditionBase, ResponseDescriptor responseDescriptor) { | ||
this.requestConditionBase = requestConditionBase; | ||
this.responseDescriptor = responseDescriptor; | ||
} | ||
|
||
public void start() { | ||
} | ||
|
||
public void stop() { | ||
} | ||
|
||
public void disable() {} | ||
public void enable() {} | ||
public void drop() {} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
wilma-service-api/src/main/java/com/epam/wilma/service/unit/StubConfigurationBuilder.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,32 @@ | ||
package com.epam.wilma.service.unit; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
/** | ||
* Builder class for building a complete Stub Configuration. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class StubConfigurationBuilder { | ||
|
||
public RequestConditionBuilder forRequestsLike() { | ||
return new RequestConditionBuilder(); | ||
} | ||
} |
24 changes: 23 additions & 1 deletion
24
wilma-service-api/src/main/java/com/epam/wilma/service/unit/request/RequestCondition.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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
package com.epam.wilma.service.unit.request; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
/** | ||
* Created by tkohegyi on 2016. 01. 27.. | ||
* A Request Condition class. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class RequestCondition implements RequestConditionBase { | ||
|
||
} |
24 changes: 23 additions & 1 deletion
24
...a-service-api/src/main/java/com/epam/wilma/service/unit/request/RequestConditionBase.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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
package com.epam.wilma.service.unit.request; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
/** | ||
* Created by tkohegyi on 2016. 01. 27.. | ||
* A Request Condition base class, parent of all kind of request condition class. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public interface RequestConditionBase { | ||
|
||
} |
23 changes: 0 additions & 23 deletions
23
...ervice-api/src/main/java/com/epam/wilma/service/unit/request/RequestConditionBuilder.java
This file was deleted.
Oops, something went wrong.
24 changes: 23 additions & 1 deletion
24
wilma-service-api/src/main/java/com/epam/wilma/service/unit/response/ResponseDescriptor.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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
package com.epam.wilma.service.unit.response; | ||
/*========================================================================== | ||
Copyright 2013-2016 EPAM Systems | ||
This file is part of Wilma. | ||
Wilma is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Wilma is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Wilma. If not, see <http://www.gnu.org/licenses/>. | ||
===========================================================================*/ | ||
|
||
/** | ||
* Created by tkohegyi on 2016. 01. 27.. | ||
* A Response Descriptor class. | ||
* | ||
* @author Tamas_Kohegyi | ||
* | ||
*/ | ||
public class ResponseDescriptor { | ||
|
||
} |
Oops, something went wrong.