This file contains hidden or 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
| function sendRequest() { | |
| var requestID = "666"; | |
| Ext.Ajax.request({ | |
| url:'/url' | |
| success: function(response) { | |
| alert("Request " + requestID + " returned"); | |
| } | |
| }); | |
| } |
This file contains hidden or 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
| ## From the book Clojure in Action | |
| ### A small program written in our fictitious XML-based language | |
| <program> | |
| <function name=addToStock> | |
| <param name=counter></param> | |
| <callFunction name=increment> |
This file contains hidden or 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
| // Code From Clean Code Book | |
| public void registerItem(Item item) { | |
| if (item != null) { | |
| ItemRegistry registry = peristentStore.getItemRegistry(); | |
| if (registry != null) { | |
| Item existing = registry.getItem(item.getID()); | |
| if (existing.getBillingPeriod().hasRetailOwner()) { | |
| existing.register(item); | |
| } | |
| } |
This file contains hidden or 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
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>XXXX</groupId> | |
| <artifactId>XXXX</artifactId> | |
| <version>0.0.1-SNAPSHOT</version> | |
| <packaging>jar</packaging> | |
| <name>arch</name> |
This file contains hidden or 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
| protected void registerPathmaps() { | |
| String umlResourcePath = UMLResourcesUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath(); | |
| try { | |
| umlResourcePath = URLDecoder.decode(umlResourcePath, "UTF-8"); | |
| } catch (UnsupportedEncodingException e) { | |
| e.printStackTrace(); | |
| } | |
| URI umlResourcePluginURI = URI.createURI("jar:file:" + umlResourcePath + "!/"); | |
| RESOURCE_SET.getURIConverter().getURIMap().put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), |
This file contains hidden or 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
| public org.eclipse.uml2.uml.Package load(URI uri, String pathAbsolute) { | |
| org.eclipse.uml2.uml.Package package_ = null; | |
| if (!"".equals(pathAbsolute)) | |
| getResources().getResource(URI.createFileURI(pathAbsolute), true); | |
| try { | |
| Resource resource = getResources().getResource(uri, true); | |
| package_ = (org.eclipse.uml2.uml.Package) EcoreUtil | |
| .getObjectByType(resource.getContents(), | |
| UMLPackage.Literals.PACKAGE); |
This file contains hidden or 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
| public class TestUnit{ | |
| public void defineSenario("Create a User"){ | |
| public void testUnit1(){ | |
| assertEquals(1 == 1); | |
| } | |
| } | |
| public void defineSenario("Delete User"){ | |
| public void testUnit2(){ |
This file contains hidden or 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
| protected <T extends Element> void assertContains(List<T> list, String ... expected) { | |
| for (Element t : list) { | |
| String name = t.getName(); | |
| if(list.get(0) instanceof mestrado.arquitetura.representation.Package) | |
| for (String str : expected) if(str.equalsIgnoreCase(name)) return ; | |
| if(list.get(0) instanceof mestrado.arquitetura.representation.Class) | |
| for (String str : expected) if(str.equalsIgnoreCase(name)) return ; | |
| } |
This file contains hidden or 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
| @Test | |
| public void shouldLoadDependencyClassWithoutPackageAndClassWithPackage() throws Exception{ | |
| String uriToArchitecture = getUrlToModel("classPacote"); | |
| Architecture architecture = new ArchitectureBuilder().create(uriToArchitecture); | |
| assertNotNull(architecture); | |
| assertEquals(2, architecture.getClasses().size()); | |
| assertEquals(1, architecture.getInterClassRelationships().size()); | |
| DependencyInterClassRelationship r = (DependencyInterClassRelationship) architecture.getInterClassRelationships().get(0); |
This file contains hidden or 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
| public List<GeneralizationInterClassRelationship> getAllGeneralizations(){ | |
| List<GeneralizationInterClassRelationship> generalizations = new ArrayList<GeneralizationInterClassRelationship>(); | |
| for (InterClassRelationship relation : interClassRelationships) | |
| if (relation instanceof GeneralizationInterClassRelationship) | |
| generalizations.add(((GeneralizationInterClassRelationship)relation)); | |
| return generalizations; | |
| } |