Java Code Examples for org.wso2.carbon.apimgt.impl.APIConstants#API_CUSTOM_SEQUENCE_LOCATION
The following examples show how to use
org.wso2.carbon.apimgt.impl.APIConstants#API_CUSTOM_SEQUENCE_LOCATION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: APIUtilTest.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Test public void testGetMediationSequenceUuidInSequence() throws Exception { APIIdentifier apiIdentifier = Mockito.mock(APIIdentifier.class); ServiceReferenceHolder serviceReferenceHolder = Mockito.mock(ServiceReferenceHolder.class); RegistryService registryService = Mockito.mock(RegistryService.class); UserRegistry registry = Mockito.mock(UserRegistry.class); PowerMockito.mockStatic(ServiceReferenceHolder.class); Mockito.when(ServiceReferenceHolder.getInstance()).thenReturn(serviceReferenceHolder); Mockito.when(serviceReferenceHolder.getRegistryService()).thenReturn(registryService); Mockito.when(registryService.getGovernanceSystemRegistry(eq(1))).thenReturn(registry); Collection collection = Mockito.mock(Collection.class); String path = APIConstants.API_CUSTOM_SEQUENCE_LOCATION + File.separator + APIConstants.API_CUSTOM_SEQUENCE_TYPE_IN; Mockito.when(registry.get(eq(path))).thenReturn(collection); String[] childPaths = {"test"}; Mockito.when(collection.getChildren()).thenReturn(childPaths); String expectedUUID = UUID.randomUUID().toString(); InputStream sampleSequence = new FileInputStream(Thread.currentThread().getContextClassLoader(). getResource("sampleSequence.xml").getFile()); Resource resource = Mockito.mock(Resource.class); Mockito.when(registry.get(eq("test"))).thenReturn(resource); Mockito.when(resource.getContentStream()).thenReturn(sampleSequence); Mockito.when(resource.getUUID()).thenReturn(expectedUUID); String actualUUID = APIUtil.getMediationSequenceUuid("sample", 1, "in", apiIdentifier); Assert.assertEquals(expectedUUID, actualUUID); sampleSequence.close(); }
Example 2
Source File: APIUtilTest.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Test public void testGetMediationSequenceUuidOutSequence() throws Exception { APIIdentifier apiIdentifier = Mockito.mock(APIIdentifier.class); ServiceReferenceHolder serviceReferenceHolder = Mockito.mock(ServiceReferenceHolder.class); RegistryService registryService = Mockito.mock(RegistryService.class); UserRegistry registry = Mockito.mock(UserRegistry.class); PowerMockito.mockStatic(ServiceReferenceHolder.class); Mockito.when(ServiceReferenceHolder.getInstance()).thenReturn(serviceReferenceHolder); Mockito.when(serviceReferenceHolder.getRegistryService()).thenReturn(registryService); Mockito.when(registryService.getGovernanceSystemRegistry(eq(1))).thenReturn(registry); Collection collection = Mockito.mock(Collection.class); String path = APIConstants.API_CUSTOM_SEQUENCE_LOCATION + File.separator + APIConstants.API_CUSTOM_SEQUENCE_TYPE_OUT; Mockito.when(registry.get(eq(path))).thenReturn(collection); String[] childPaths = {"test"}; Mockito.when(collection.getChildren()).thenReturn(childPaths); String expectedUUID = UUID.randomUUID().toString(); InputStream sampleSequence = new FileInputStream(Thread.currentThread().getContextClassLoader(). getResource("sampleSequence.xml").getFile()); Resource resource = Mockito.mock(Resource.class); Mockito.when(registry.get(eq("test"))).thenReturn(resource); Mockito.when(resource.getContentStream()).thenReturn(sampleSequence); Mockito.when(resource.getUUID()).thenReturn(expectedUUID); String actualUUID = APIUtil.getMediationSequenceUuid("sample", 1, "out", apiIdentifier); Assert.assertEquals(expectedUUID, actualUUID); sampleSequence.close(); }
Example 3
Source File: APIUtilTest.java From carbon-apimgt with Apache License 2.0 | 5 votes |
@Test public void testGetMediationSequenceUuidFaultSequence() throws Exception { APIIdentifier apiIdentifier = Mockito.mock(APIIdentifier.class); ServiceReferenceHolder serviceReferenceHolder = Mockito.mock(ServiceReferenceHolder.class); RegistryService registryService = Mockito.mock(RegistryService.class); UserRegistry registry = Mockito.mock(UserRegistry.class); PowerMockito.mockStatic(ServiceReferenceHolder.class); Mockito.when(ServiceReferenceHolder.getInstance()).thenReturn(serviceReferenceHolder); Mockito.when(serviceReferenceHolder.getRegistryService()).thenReturn(registryService); Mockito.when(registryService.getGovernanceSystemRegistry(eq(1))).thenReturn(registry); Collection collection = Mockito.mock(Collection.class); String path = APIConstants.API_CUSTOM_SEQUENCE_LOCATION + File.separator + APIConstants.API_CUSTOM_SEQUENCE_TYPE_FAULT; Mockito.when(registry.get(eq(path))).thenReturn(collection); String[] childPaths = {"test"}; Mockito.when(collection.getChildren()).thenReturn(childPaths); String expectedUUID = UUID.randomUUID().toString(); InputStream sampleSequence = new FileInputStream(Thread.currentThread().getContextClassLoader(). getResource("sampleSequence.xml").getFile()); Resource resource = Mockito.mock(Resource.class); Mockito.when(registry.get(eq("test"))).thenReturn(resource); Mockito.when(resource.getContentStream()).thenReturn(sampleSequence); Mockito.when(resource.getUUID()).thenReturn(expectedUUID); String actualUUID = APIUtil.getMediationSequenceUuid("sample", 1, "fault", apiIdentifier); Assert.assertEquals(expectedUUID, actualUUID); sampleSequence.close(); }