/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.apimgt.impl.factory;

import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.model.API;
import org.wso2.carbon.apimgt.api.model.AccessTokenInfo;
import org.wso2.carbon.apimgt.api.model.AccessTokenRequest;
import org.wso2.carbon.apimgt.api.model.KeyManager;
import org.wso2.carbon.apimgt.api.model.KeyManagerConfiguration;
import org.wso2.carbon.apimgt.api.model.OAuthAppRequest;
import org.wso2.carbon.apimgt.api.model.OAuthApplicationInfo;
import org.wso2.carbon.apimgt.api.model.Scope;

import java.util.Map;
import java.util.Set;

public class FakeKeyManagerForTest implements KeyManager {
    @Override public OAuthApplicationInfo createApplication(OAuthAppRequest oAuthAppRequest)
            throws APIManagementException {
        return null;
    }

    @Override public OAuthApplicationInfo updateApplication(OAuthAppRequest oAuthAppRequest)
            throws APIManagementException {
        return null;
    }

    @Override public OAuthApplicationInfo updateApplicationOwner(OAuthAppRequest oAuthAppRequest, String owner)
            throws APIManagementException {
        return null;
    }

    @Override public void deleteApplication(String s) throws APIManagementException {

    }

    @Override public OAuthApplicationInfo retrieveApplication(String s) throws APIManagementException {
        return null;
    }

    @Override public AccessTokenInfo getNewApplicationAccessToken(AccessTokenRequest accessTokenRequest)
            throws APIManagementException {
        return null;
    }

    @Override
    public String getNewApplicationConsumerSecret(AccessTokenRequest tokenRequest) throws APIManagementException {
        return null;
    }

    @Override public AccessTokenInfo getTokenMetaData(String s) throws APIManagementException {
        return null;
    }

    @Override public KeyManagerConfiguration getKeyManagerConfiguration() throws APIManagementException {
        return null;
    }

    @Override public OAuthApplicationInfo buildFromJSON(String s) throws APIManagementException {
        return null;
    }

    @Override public OAuthApplicationInfo buildFromJSON(OAuthApplicationInfo oAuthApplicationInfo, String s)
            throws APIManagementException {
        return null;
    }

    @Override public AccessTokenRequest buildAccessTokenRequestFromJSON(String s, AccessTokenRequest accessTokenRequest)
            throws APIManagementException {
        return null;
    }

    @Override public OAuthApplicationInfo mapOAuthApplication(OAuthAppRequest oAuthAppRequest)
            throws APIManagementException {
        return null;
    }

    @Override public AccessTokenRequest buildAccessTokenRequestFromOAuthApp(OAuthApplicationInfo oAuthApplicationInfo,
            AccessTokenRequest accessTokenRequest) throws APIManagementException {
        return null;
    }

    @Override public void loadConfiguration(KeyManagerConfiguration keyManagerConfiguration)
            throws APIManagementException {

    }

    @Override public boolean registerNewResource(API api, Map map) throws APIManagementException {
        return false;
    }

    @Override public Map getResourceByApiId(String s) throws APIManagementException {
        return null;
    }

    @Override public boolean updateRegisteredResource(API api, Map map) throws APIManagementException {
        return false;
    }

    @Override public void deleteRegisteredResourceByAPIId(String s) throws APIManagementException {

    }

    @Override public void deleteMappedApplication(String s) throws APIManagementException {

    }

    @Override public Set<String> getActiveTokensByConsumerKey(String s) throws APIManagementException {
        return null;
    }

    @Override public AccessTokenInfo getAccessTokenByConsumerKey(String s) throws APIManagementException {
        return null;
    }

    @Override
    public Map<String, Set<Scope>> getScopesForAPIS(String apiIdsString) throws APIManagementException {
        return null;
    }

    @Override
    public void registerScope(Scope scope, String tenantDomain) throws APIManagementException {

    }

    @Override
    public Scope getScopeByName(String scopeName, String tenantDomain) throws APIManagementException {

        return null;
    }

    @Override
    public Map<String, Scope> getAllScopes(String tenantDomain) throws APIManagementException {

        return null;
    }

    @Override
    public Boolean attachScopeToResource(Scope scope, String tenantDomain) throws APIManagementException {

        return null;
    }

    @Override
    public void deleteScope(Scope scope, String tenantDomain) throws APIManagementException {

    }

    @Override
    public void updateScope(Scope scope, String tenantDomain) throws APIManagementException {

    }
}

@@ -1164,16 +1164,69 @@
 l.Scope;
+%0Aimport org.wso2.carbon.apimgt.api.model.URITemplate;
 %0A%0Aimport
@@ -3689,32 +3689,125 @@
 ption %7B%0A%0A    %7D%0A%0A
+    @Override%0A    public void initializeHttpClient() throws APIManagementException %7B%0A%0A    %7D%0A%0A
     @Override pu
@@ -5219,15 +5219,12 @@
 lic 
-Boolean
+void
  att
@@ -5242,16 +5242,50 @@
 esource(
+API api, URITemplate uriTemplate, 
 Scope sc
@@ -5301,32 +5301,44 @@
 ng tenantDomain)
+%0A           
  throws APIManag
@@ -5355,37 +5355,16 @@
 tion %7B%0A%0A
-        return null;%0A
     %7D%0A%0A 
@@ -5592,11 +5592,158 @@
 %7B%0A%0A    %7D
+%0A%0A    @Override%0A    public Boolean isScopeExists(String scopeName, String tenantDomain) throws APIManagementException %7B%0A%0A        return null;%0A    %7D
 %0A%7D%0A

attach scope to resource