Skip to content

Commit

Permalink
further implementations for #65 - still just in concept phase, nothin…
Browse files Browse the repository at this point in the history
…g works
  • Loading branch information
tkohegyi committed Feb 5, 2016
1 parent 89a78e5 commit 3c6ed52
Show file tree
Hide file tree
Showing 9 changed files with 365 additions and 29 deletions.
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;
}
}
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;
}
}
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() {}

}
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();
}
}
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 {

}
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 {

}

This file was deleted.

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 {

}
Loading

0 comments on commit 3c6ed52

Please sign in to comment.