-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add golden image unit test for java codegen
- Loading branch information
Showing
3 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
86 changes: 86 additions & 0 deletions
86
...pts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ClusterWriteMapping.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package chip.devicecontroller; | ||
|
||
import chip.clusterinfo.CommandParameterInfo; | ||
import chip.clusterinfo.InteractionInfo; | ||
import chip.devicecontroller.ChipClusters.DefaultClusterCallback; | ||
import java.util.HashMap; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class ClusterWriteMapping { | ||
public Map<String, Map<String, InteractionInfo>> getWriteAttributeMap() { | ||
Map<String, Map<String, InteractionInfo>> writeAttributeMap = new HashMap<>(); | ||
Map<String, InteractionInfo> writeFirstInteractionInfo = new LinkedHashMap<>(); | ||
Map<String, CommandParameterInfo> writeFirstSomeIntegerCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); | ||
CommandParameterInfo firstsomeIntegerCommandParameterInfo = | ||
new CommandParameterInfo( | ||
"value", | ||
Integer.class, | ||
Integer.class | ||
); | ||
writeFirstSomeIntegerCommandParams.put( | ||
"value", | ||
firstsomeIntegerCommandParameterInfo | ||
); | ||
InteractionInfo writeFirstSomeIntegerAttributeInteractionInfo = new InteractionInfo( | ||
(cluster, callback, commandArguments) -> { | ||
((ChipClusters.FirstCluster) cluster).writeSomeIntegerAttribute( | ||
(DefaultClusterCallback) callback, | ||
(Integer) commandArguments.get("value") | ||
); | ||
}, | ||
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), | ||
writeFirstSomeIntegerCommandParams | ||
); | ||
writeFirstInteractionInfo.put("writeSomeIntegerAttribute", writeFirstSomeIntegerAttributeInteractionInfo); | ||
writeAttributeMap.put("first", writeFirstInteractionInfo); | ||
Map<String, InteractionInfo> writeSecondInteractionInfo = new LinkedHashMap<>(); | ||
writeAttributeMap.put("second", writeSecondInteractionInfo); | ||
Map<String, InteractionInfo> writeThirdInteractionInfo = new LinkedHashMap<>(); | ||
Map<String, CommandParameterInfo> writeThirdSomeEnumCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); | ||
CommandParameterInfo thirdsomeEnumCommandParameterInfo = | ||
new CommandParameterInfo( | ||
"value", | ||
Integer.class, | ||
Integer.class | ||
); | ||
writeThirdSomeEnumCommandParams.put( | ||
"value", | ||
thirdsomeEnumCommandParameterInfo | ||
); | ||
InteractionInfo writeThirdSomeEnumAttributeInteractionInfo = new InteractionInfo( | ||
(cluster, callback, commandArguments) -> { | ||
((ChipClusters.ThirdCluster) cluster).writeSomeEnumAttribute( | ||
(DefaultClusterCallback) callback, | ||
(Integer) commandArguments.get("value") | ||
); | ||
}, | ||
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), | ||
writeThirdSomeEnumCommandParams | ||
); | ||
writeThirdInteractionInfo.put("writeSomeEnumAttribute", writeThirdSomeEnumAttributeInteractionInfo); | ||
Map<String, CommandParameterInfo> writeThirdOptionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>(); | ||
CommandParameterInfo thirdoptionsCommandParameterInfo = | ||
new CommandParameterInfo( | ||
"value", | ||
Integer.class, | ||
Integer.class | ||
); | ||
writeThirdOptionsCommandParams.put( | ||
"value", | ||
thirdoptionsCommandParameterInfo | ||
); | ||
InteractionInfo writeThirdOptionsAttributeInteractionInfo = new InteractionInfo( | ||
(cluster, callback, commandArguments) -> { | ||
((ChipClusters.ThirdCluster) cluster).writeOptionsAttribute( | ||
(DefaultClusterCallback) callback, | ||
(Integer) commandArguments.get("value") | ||
); | ||
}, | ||
() -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), | ||
writeThirdOptionsCommandParams | ||
); | ||
writeThirdInteractionInfo.put("writeOptionsAttribute", writeThirdOptionsAttributeInteractionInfo); | ||
writeAttributeMap.put("third", writeThirdInteractionInfo);return writeAttributeMap; | ||
} | ||
} |