VaadinConnectClientGenerator { final String relativizeEndpointPrefixWithUrlMapping(String endpointPrefix, String urlMapping){ urlMapping = removeTrailingStar(urlMapping); endpointPrefix = removeTrailingStar(endpointPrefix); Path urlMappingPath = Paths.get(urlMapping).normalize(); Path endpointPrefixPath = Paths.get(endpointPrefix).normalize(); return FrontendUtils.getUnixRelativePath(urlMappingPath, endpointPrefixPath); } VaadinConnectClientGenerator(
            Properties applicationProperties); void generateVaadinConnectClientFile(Path outputFilePath); static final String CONNECT_CLIENT_NAME; static final String CUSTOM_CONNECT_CLIENT_NAME; static final String CONNECT_CLIENT_IMPORT_PATH; }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_both_default_values(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping(VaadinConnectClientGenerator.DEFAULT_PREFIX, "/*"); Assert.assertEquals("connect", result); }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_custom_url_mapping_and_default_endpoint_prefix(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping(VaadinConnectClientGenerator.DEFAULT_PREFIX, "/myapp/*"); Assert.assertEquals("../connect", result); }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_default_url_mapping_and_custom_endpoint_prefix(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping("/my-connect", "/*"); Assert.assertEquals("my-connect", result); }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_custom_url_mapping_and_custom_endpoint_prefix(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping("/my-connect", "/myapp/*"); Assert.assertEquals("../my-connect", result); }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_multiple_level_url_mapping_and_custom_endpoint_prefix(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping("/my-connect", "/myapp/yourapp/*"); Assert.assertEquals("../../my-connect", result); }
@Test public void relativizeEndpointPrefixWithUrlMapping_should_work_with_multiple_level_url_mapping_and_multiple_level_endpoint_prefix(){ VaadinConnectClientGenerator generator = new VaadinConnectClientGenerator( new Properties()); String result = generator.relativizeEndpointPrefixWithUrlMapping("/my-connect/your-connect", "/myapp/yourapp/*"); Assert.assertEquals("../../my-connect/your-connect", result); }